SDN

ODL Virtual Tenant Network Coordinator: Configuration from Sources on Ubuntu 12.04

March 12, 2014
ODL Virtual Tenant Network Coordinator: Configuration from Sources on Ubuntu 12.04

Continuing our exploration of the recently released OpenDaylight Hydrogen (read the first part of our research here), we would like to share another portion of it. Today we will be speaking about OpenDaylight Virtual Tenant Network (VTN) coordinator, which is “part of the network application, orchestration and services layer… [that] …uses OpenDaylight APIs (REST) to construct the virtual network in ODCs [OpenDaylight controllers]”.

Source: https://wiki.opendaylight.org

 

We have noticed that there are several issues with Virtual Tenant Network Coordinator installation on Ubuntu 12.04. Since there isn’t any meaningful guide available yet, we are providing details on its installation from sources. Our work is primarily based on this guide, which is missing several key points specific to Ubuntu 12.04.

Prerequisites

Create vanilla Ubuntu VM image, and install Oracle Java 7 development environment following these guidelines.

Build environment

Generic utilities for building Virtual Tenant Network coordinator:

                    
                        
                            sudo apt-get install pkg-config gcc make ant g++ maven git libboost-dev libcurl4-openssl-dev libssl-dev unixodbc-dev                        

PostgreSQL database:

                    
                        
                            sudo apt-get install  postgresql-9.1 postgresql-client-9.1 postgresql-client-common postgresql-contrib-9.1 odbc-postgresql                        

Ubuntu 12.04 provides a bit outdated libjson, and that’s why we need to install the newest version from sources on Github repo for json-c.

                    
                        
                            git clone https://github.com/json-c/json-c.git
cd json-c
sh autogen.sh
                        

Minor changes need to be made to build it in this environment. In files test/modules/stub/restjsonutil/json_build_parse.hh and test/modules/stub/restjsonutil/json_type_util.hh

change

                    
                        
                            #include <json.h>                        

to

                    
                        
                            #include <json/json.h>                        

Now build and install it:

                    
                        
                            ./configure
make
make install
sudo cp /usr/local/lib/pkgconfig/json-c.pc /usr/share/pkgconfig/
                        

Install gtest-dev library:

                    
                        
                            sudo apt-get install cmake libgtest-dev
cp -R /usr/src/gtest gtest-work
cd gtest-work
cmake CMakeLists.txt
make
sudo cp *.a /usr/lib
cd ..
rm -rf gtest-work
                        

Building the Virtual Tenant Network Coordinator

We are finally ready to build the VTN coordinator:

                    
                        
                            git clone https://git.opendaylight.org/gerrit/p/vtn.git
cd vtn/coordinator/
mvn -f dist/pom.xml package
sudo make install
                        

To be able to run the Virtual Tenant Network Coordinator, we need to install Apache Tomcat:

                    
                        
                            cd ~
mkdir tomcat
cd tomcat
wget https://archive.apache.org/dist/tomcat/tomcat-7/v7.0.39/bin/apache-tomcat-7.0.39.tar.gz
                        

Configure Tomcat for VTN service:

                    
                        
                            sudo ln -s /usr/local/vtn/tomcat/webapps/vtn-webapi /usr/share/java/apache-tomcat-7.0.39/webapps/vtn-webapi
sudo vi /usr/share/java/apache-tomcat-7.0.39/conf/catalina.properties
                        

Set:

                    
                        
                            common.loader=/usr/local/vtn/tomcat/lib,/usr/local/vtn/tomcat/lib/*.jar
shared.loader=/usr/local/vtn/tomcat/shared/lib/*.jar

sudo vi /usr/share/java/apache-tomcat-7.0.39/conf/server.xml
                        

Add the following to <Server … </Server>:

                    
                        
                            <Listener className="org.opendaylight.vtn.tomcat.server.StateListener" />                        

Set up database. DB configuration script needs to be adjusted to Ubuntu 12.04 environment:

Modify /usr/local/vtn/sbin/db_setup:

                    
                        
                            diff db_setup db_setup.org
28d27
< PGINST_LIST="$PGINST_LIST /usr/lib*"
318c317
<               [ "$lp64" = "1" ] && for libdir in lib64 lib64/odbc x86_64-linux-gnu/odbc; do
---
>               [ "$lp64" = "1" ] && for libdir in lib64 lib64/odbc; do
                        

Configure database:

                    
                        
                            sudo /usr/local/vtn/sbin/db_setup                        

Finally, Virtual Tenant Network Coordinator is ready for use and we can start it:

                    
                        
                            /usr/local/vtn/bin/vtn_start
/usr/share/java/apache-tomcat-7.0.39/bin/catalina.sh start
                        

Make sure that OpenDaylight controller is started with VTN Manger component:

                    
                        
                            sudo odl-hyd-virt -virt vtn                        

Simple remote checks to make sure that it’s running (change VTN_COORD_IP to actual value):

                    
                        
                            curl -X GET -H 'content-type: application/json' -H 'username: admin' -H 'password: adminpass'   -H 'ipaddr:VTN_COORD_IP' http://8080/vtn-webapi/api_version.json                        

In order to terminate the Virtual Tenant Network coordinator:

                    
                        
                            /usr/share/java/apache-tomcat-7.0.39/bin/catalina.sh stop
/usr/local/vtn/bin/vtn_stop
                        

Future updates

Ubuntu 12.04 version will be supported through April 2017, so the presented solution will remain relevant at least until then. As you probably know, a new version of Ubuntu (14.04) is coming soon, and it is possible that this approach will work on it as well. We will update the post with information on Ubuntu 14.04 as soon as we have it available.

Update: 23/07/14

In order to compile and install VTN Coordinator under brand new Ubuntu 14.04, simply follow the instructions provided by the OpenDaylight Wiki page for Ubuntu 13.10. No special tricks required as with Ubuntu 12.04.

Andriy Kokhan

Networking Solutions Architect at PLVision
With 15 years of experience in networking software development, Andriy has been highly
instrumental in integrations with open source projects performed by PLVision for our customers in semiconductor and networking domains.
Andriy Kokhan

Latest posts by Andriy Kokhan (see all)