Removing unused manuals for Lithium
[docs.git] / manuals / developer-guide / src / main / asciidoc / vtn / VTN_Coordinator_Hacking.adoc
1 === Hacking VTN Coordinator
2
3 ==== Prior preparation
4 . Arrange a server with any one of the supported 64-bit OS environment.
5
6 * RHEL 6 / 7
7 * CentOS 6 / 7
8 * Fedora(19/20)
9 * Ubuntu (12.04/12.10/13.04/14.04)
10
11 * Install necessary packages.
12 * RHEL/Fedora/Cent OS
13 [source,perl]
14 ----
15     yum install make glibc-devel gcc gcc-c++ boost-devel openssl-devel \
16     ant perl-ExtUtils-MakeMaker unixODBC-devel perl-Digest-SHA uuid libxslt libcurl libcurl-devel git
17 ----
18 * Ubuntu 13.10/14.04
19 [source,perl]
20 ----
21    apt-get install pkg-config gcc make  ant g++ maven git libboost-dev libcurl4-openssl-dev \
22     libjson0-dev libssl-dev openjdk-7-jdk unixodbc-dev xmlstarlet
23 ----
24 * Ubuntu 12.04
25 [source,perl]
26 ----
27    apt-get install pkg-config gcc make  ant g++ maven git libboost-dev libcurl4-openssl-dev \
28     libssl-dev openjdk-7-jdk unixodbc-dev
29 ----
30 NOTE: Install libjson0-dev from packages of ubuntu versions (>12.04)
31
32 * Install JDK 7, and add the JAVA_HOME environment variable (Only for RHEL/Cent OS/Fedora)
33 * RHEL 6.1/Cent OS 6.1
34
35 . Download Oracle JDK 7 from the following page, and install it.
36    http://www.oracle.com/technetwork/java/javase/downloads/index.html
37
38 . Set JAVA_HOME to the location of the JDK.
39
40 [source,perl]
41 ----
42  export JAVA_HOME=/usr/java/default
43 ----
44
45 * RHEL 6.4,Cent OS 6.4 ,Fedora (17,20)
46
47 .1.Install OpenJDK 7
48
49 [source,perl]
50 ----
51 yum install java-1.7.0-openjdk-devel
52 ----
53
54 .2. Set JAVA_HOME to the location of the JDK.
55 [source,perl]
56 ----
57 export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk.x86_64
58 ----
59 * Preperation for Execution
60
61 * RHEL 6/Fedora/Cent OS 6
62 [source,perl]
63 ----
64  Download the following PostgreSQL 9.1 files (latest versions) from http://yum.postgresql.org/9.1/redhat/rhel-6.4-x86_64/ (RHEL 6.4) or http://yum.postgresql.org/9.1/redhat/rhel-6.1-x86_64/ (RHEL 6.1)and install.
65 postgresql91-libs
66 postgresql91
67 postgresql91server
68 postgresql91-contrib
69 postgresql91-odbc
70 ----
71
72 NOTE: The above procedure caters only for RHEL 6, For Fedora and CentOS, Please visit http://yum.postgresql.org and install the corresponding rpm for the particular version of Linux distro
73
74 * RHEL 7/Cent OS 7
75
76 . Download and install the Postgres 9.3 by installing the rpm
77 NOTE: For RHEL 7, Please install the below rpm
78 [source,perl]
79 ----
80    rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-redhat93-9.3-1.noarch.rpm
81   yum install postgresql93-libs postgresql93 postgresql93-server postgresql93-contrib postgresql93-odbc
82 ----
83 NOTE: For Cent OS 7, Please install the below rpm
84 [source,perl]
85 ----
86  rpm -ivh http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm
87  yum install postgresql93-libs postgresql93 postgresql93-server postgresql93-contrib postgresql93-odbc
88 ----
89
90 * Ubuntu 13.10/12.04
91 [source,perl]
92 ----
93    apt-get install  postgresql-9.1 postgresql-client-9.1 postgresql-client-common postgresql-contrib-9.1 odbc-postgresql
94 ----
95
96 * Install Maven. (RHEL/Cent OS/Fedora)
97 . Download Maven from the following page and install it folloiwng the instruction in the page.
98 . http://maven.apache.org/download.cgi
99
100 . Install gtest-devel, json-c libraries
101
102 * RHEL/Fedora/Cent OS
103
104 [source,perl]
105 ----
106    wget <nowiki>http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm</nowiki>
107    rpm -Uvh epel-release-6-8.noarch.rpm
108    yum install gtest-devel json-c json-c-devel
109 ----
110
111 NOTE: For RHEL7 and CentOS7, the json-c is part of the default repo, Please install json-c and json-c-devel from the default repo and gtest-devel alsone from the EPEL repo (http://dl.fedoraproject.org/pub/epel/7/x86_64/)
112
113 *  Ubuntu 13.10/Ubuntu 12.04
114 [source,perl]
115 ----
116    apt-get install cmake libgtest-dev
117    cp -R /usr/src/gtest gtest-work
118    cd gtest-work
119    cmake CMakeLists.txt
120    make
121    sudo cp *.a /usr/lib
122    cd ..
123    rm -rf gtest-work
124 ----
125
126 ==== Build
127
128 NOTE: User is not required to be mandatorily root, but the user must own the directory /usr/local/vtn
129
130 * Example :
131 .The directory should appear as below (assuming the user as "vtn"):
132 [source,perl]
133 ----
134  # ls -l /usr/local/
135    drwxr-xr-x. 12 vtn  vtn  4096 Mar 14 21:53 vtn
136 ----
137
138 * Download the code from git.
139 [source,perl]
140 ----
141  git clone ssh://<username>@git.opendaylight.org:29418/vtn.git
142  git clone https://git.opendaylight.org/gerrit/p/vtn.git
143 ----
144
145 * Build and install VTN Coordinator.
146 [source,perl]
147 ----
148  cd vtn/coordinator
149  mvn -f dist/pom.xml install
150  tar -C/ -jxvf dist/target/distribution.vtn-coordinator-6.1.0.0-SNAPSHOT-bin.tar.bz2
151 ----
152
153 ==== Run VTN Coordinator
154
155 ===== Prior preparation
156 ====== To change the port
157 . By Default coordinator will listen on port 8083
158 . To change the listening port modify the TOMCAT_PORT in below file
159 [source,perl]
160 ----
161  /usr/local/vtn/tomcat/conf/tomcat-env.sh.
162 ----
163
164 . Set up the DB.
165 [source,perl]
166 ----
167  /usr/local/vtn/sbin/db_setup
168 ----
169
170 If any problem in setting up db, Please visit: * https://wiki.opendaylight.org/view/OpenDaylight_Virtual_Tenant_Network_(VTN):Installation:Troubleshooting#After_executing_db_setup.2C_you_have_encountered_the_error_.22Failed_to_setup_database.22.3F
171
172 ==== Start
173 .1. Start VTN Coordinator.
174
175 [source,perl]
176 ----
177  /usr/local/vtn/bin/vtn_start
178 ----
179
180 .2. Execute the following commands while stopping.
181 [source,perl]
182 ----
183  /usr/local/vtn/bin/vtn_stop
184 ----
185
186 ==== WebAPI
187 * VTN Coordinator version information will be displayed if following command is executed when VTN has started successfully.
188 [source,perl]
189 ----
190 curl --user admin:adminpass -H 'content-type: application/json' -X GET \
191 'http://127.0.0.1:8083/vtn-webapi/api_version.json'
192 ----
193
194 * The expected response message:
195 [source,perl]
196 ----
197  {"api_version":{"version":"V1.2"}}
198 ----