Jump to: navigation, search

CrossProject:Integration Group:Create System Test Environment

Maintainer

integration-dev@lists.opendaylight.org

Introduction

The purpose of this instruction is to setup a test environment that can be used to verify system test code as well as to run the complete system test suite. Please note that all the different components: mininet, controller and test tools can be installed in the same VM like in this instruction or in separated VMs like in OpenDaylight Lab (split setup).

Test VM

You can skip all steps below if you just download our Test VM. Soon there will be a Vagrantfile in the integration git repository test/tools/tools_vm/ directory that provides everything you need for system test.

Installation Procedure

Prerequisites

This instruction has been verified on Ubuntu 14.04

Install Mininet 2.1.0 with OVS 2.0.1 (current version in CI)

Mininet 2.1.0 requires a patch in order to work correctly with OVS OF1.3 simulation. The first step is to create a patch file. Using VI (vi newOptions.patch), edit a file called "newOptions.patch" and paste in the following contents:

--- mininet/node.py	2014-09-12 13:48:03.165628683 +0100
+++ mininet/node.py	2014-09-12 13:50:39.021630236 +0100
@@ -952,6 +952,10 @@
            datapath: userspace or kernel mode (kernel|user)"""
         Switch.__init__( self, name, **params )
         self.failMode = failMode
+        protKey = 'protocols'
+        if self.params and protKey in self.params:
+               print 'have protcol params!'
+               self.opts += protKey + '=' + self.params[protKey]
         self.datapath = datapath
 
     @classmethod
@@ -1027,8 +1031,9 @@
         if self.datapath == 'user':
             self.cmd( 'ovs-vsctl set bridge', self,'datapath_type=netdev' )
         int( self.dpid, 16 ) # DPID must be a hex string
+        print 'OVSswitch opts: ',self.opts
         self.cmd( 'ovs-vsctl -- set Bridge', self,
-                  'other_config:datapath-id=' + self.dpid )
+                  self.opts+' other_config:datapath-id=' + self.dpid )
         self.cmd( 'ovs-vsctl set-fail-mode', self, self.failMode )
         for intf in self.intfList():
             if not intf.IP():

Now that we have created a patch file, which need to download the mininet git repository, apply the patch, and then install mininet.

git clone git://github.com/mininet/mininet
cd mininet/
git checkout -b 2.1.0p1 2.1.0p1
git apply -p0 < ../newOptions.patch
cd ./util
./install.sh -nfv

Verify mininet installation:

odluser@odl-vm:~\$ sudo mn --test=pingall
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 
*** Adding switches:
s1 
*** Adding links:
(h1, s1) (h2, s1) 
*** Configuring hosts
h1 h2 
*** Starting controller
*** Starting 1 switches
s1 OVSswitch opts:  

*** Ping: testing ping reachability
h1 -> h2 
h2 -> h1 
*** Results: 0% dropped (2/2 received)
*** Stopping 1 switches
s1 ..
*** Stopping 2 hosts
h1 h2 
*** Stopping 1 controllers
c0 
*** Done
completed in 0.541 seconds

Verify mininet works for OF1.3:

odluser@odl-vm:~\$ sudo mn --controller=remote,ip=10.125.136.52 --topo tree,2 --switch ovsk,protocols=OpenFlow13
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4 
*** Adding switches:
have protcol params!
s1 have protcol params!
s2 have protcol params!
s3 
*** Adding links:
(h1, s2) (h2, s2) (h3, s3) (h4, s3) (s1, s2) (s1, s3) 
*** Configuring hosts
h1 h2 h3 h4 
*** Starting controller
*** Starting 3 switches
s1 OVSswitch opts:  protocols=OpenFlow13
s2 OVSswitch opts:  protocols=OpenFlow13
s3 OVSswitch opts:  protocols=OpenFlow13

*** Starting CLI:
mininet> 

To test the version of used protocol by switch "s1":

odluser@odl-vm:~\$ sudo ovs-ofctl -O OpenFlow13 show s1
OFPT_FEATURES_REPLY (OF1.3) (xid=0x2): dpid:0000000000000001
n_tables:254, n_buffers:256
capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS
OFPST_PORT_DESC reply (OF1.3) (xid=0x3):
 1(s1-eth1): addr:ee:79:6e:02:34:21
     config:     0
     state:      0
     current:    10GB-FD COPPER
     speed: 10000 Mbps now, 0 Mbps max
 2(s1-eth2): addr:32:84:1e:d5:cd:03
     config:     0
     state:      0
     current:    10GB-FD COPPER
     speed: 10000 Mbps now, 0 Mbps max
 LOCAL(s1): addr:f6:b3:b1:51:ce:4b
     config:     PORT_DOWN
     state:      LINK_DOWN
     speed: 0 Mbps now, 0 Mbps max
OFPT_GET_CONFIG_REPLY (OF1.3) (xid=0x5): frags=normal miss_send_len=0

odluser@odl-vm:~\$ sudo ovs-ofctl -O OpenFlow13 dump-flows s1
OFPST_FLOW reply (OF1.3) (xid=0x2):
 cookie=0xa, duration=159.024s, table=0, n_packets=295, n_bytes=54292, send_flow_rem priority=0 actions=CONTROLLER:65535

Install Mininet 2.2.1 with OVS 2.3.1 (new version in CI)

Download openvswitch 2.3.1 (http://openvswitch.org/releases/openvswitch-2.3.1.tar.gz) and build the library according to instructions in ~/openvswitch-2.3.1/INSTALL.Debian

Install the debian packages:

odluser@odl-vm:~\$ sudo dpkg -i openvswitch-common*.deb openvswitch-datapath-dkms*.deb openvswitch-controller*.deb openvswitch-pki*.deb openvswitch-switch*.deb

Disable OVS controller:

odluser@odl-vm:~\$ sudo /etc/init.d/openvswitch-controller stop
odluser@odl-vm:~\$ sudo update-rc.d openvswitch-controller disable

Verify OVS installation:

odluser@odl-vm:~\$ sudo ovs-vsctl show
bd38d7bd-7419-40d1-b80e-b48cf773c960
    ovs_version: "2.3.1"

Now Install mininet from source without overwriting OVS version:

git clone git://github.com/mininet/mininet
cd mininet/
git checkout -b 2.2.1 2.2.1
cd ./util
./install.sh -nf

NOTE: OVS 2.3.1 starts OpenFlow 1.3 by default so there is no need to apply any patch to mininet.

Wireshark 1.12.0

Download Wireshark 1.12.0 https://www.wireshark.org/download.html (for this distro should be the Source Code option)

Wireshark >1.12.0 has filters for openflow 1.3

odluser@odl-vm:~\$ sudo apt-get install -y autoconf automake libtool bison flex make pkg-config \
                   gnutls-bin g++ qt4-dev-tools libqt4-core automake autoconf \
                   libgtk-3-dev libgtk2.0-dev libglib2.0-dev libpcap0.8-dev flex bison
odluser@odl-vm:~\$ cd wireshark/ #source code folder
odluser@odl-vm:~\$ ./autogen.sh
odluser@odl-vm:~\$ ./configure
odluser@odl-vm:~\$ make
odluser@odl-vm:~\$ # Make sure you don't have any version of wireshark installed
odluser@odl-vm:~\$ # if you want you can stop here and run
odluser@odl-vm:~\$ ./wireshark
odluser@odl-vm:~\$ # if you want to install it run the command bellow
odluser@odl-vm:~\$ # sudo make install

Install Robot Framework

Check you have Python 2.6 or 2.7 installed (this is normally coming in most distributions):

odluser@odl-vm:~\$ python 
Python 2.7.3 (default, Sep 26 2013, 20:03:06) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

In case it is not there, you can install it with:

odluser@odl-vm:~\$ sudo apt-get install python2.7 

Also install python pip and paramiko if not there:

odluser@odl-vm:~\$ sudo apt-get install python-pip
odluser@odl-vm:~\$ sudo apt-get install python-paramiko 

Install Robot Framework and required libraries:

odluser@odl-vm:~\$ sudo pip install requests
odluser@odl-vm:~\$ sudo pip install robotframework
odluser@odl-vm:~\$ sudo pip install robotframework-sshlibrary
odluser@odl-vm:~\$ sudo pip install -U robotframework-requests
odluser@odl-vm:~\$ sudo pip install --upgrade robotframework-httplibrary

Verify Robot installation:

odluser@odl-vm:~\$ pybot --version
Robot Framework 2.8.2 (Python 2.7.3 on linux2)

Install Robot Framework RIDE

Prerequisites:

Python
 RIDE runs only on the regular Python, not on Jython or Iron Python. Python 2.5 is the minimum version

wxPython toolkit version 2.8.6 or newer with Unicode support is required. RIDE's GUI is implemented using wxPython toolkit. The ANSI 
 version is not supported

*Note that similarly as Robot Framework, RIDE does not yet support Python 3.

Most other operating systems other than Windows have a recent enough Python installed by default. 
You can get Windows installers and plenty of other information from http://python.org. In OSX RIDE needs 32-bit Python.

  Using easy_install 

Starting from RIDE 0.31 you can install RIDE with command:
  * easy_install robotframework-ride
The above command should always install the latest version. To get a specific version, you can use this version instead:
  * easy_install robotframework-ride==0.31

This installation approach works on all operating systems but requires you to have setup tools installed. 

*Note 
You may need to prefix the command with sudo on unix machines.
In Ubuntu/GNOME recommended wxPython version is 2.8.10.0 or newer.

In Windows 7 recommended wxPython version is 2.8.11.0 or newer.

*Note
For more information, installation instructions, and download packages see http://wxpython.org. 
On Linux you should be able to install wxPython with your package manager (e.g. on Ubuntu with sudo apt-get install python-wxgtk2.8). 
On the latest OS X versions you should have suitable wxPython version automatically, but unfortunately all RIDE features don't yet work on that platform.

Start-up 
After a successful installation RIDE can be started from the command line with command:
   ride.py [inpath]

On Windows this requires having <PythonInstallationDir>\Scripts in your PATH. 
The ride.py file will contain an incorrect shebang line in Windows. 
This will have effect only if you are trying to start RIDE in Windows from Cygwin. 
In that case, you will need to edit ride.py manually and insert path to correct Python. 
If pybot and jybot commands work you should be fine.

Robot Environment Adjustment

Create public key for regular user (odluser):

odluser@odl-vm:~\$ ssh-keygen

Mininet Environment Adjustment

Copy the just generated public key (~/.ssh/id_rsa.pub) into the file ~/.ssh/authorized_keys

odluser@odl-vm:~\$ cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys

Change ~/.ssh/authorized_keys permissions to 600

odluser@odl-vm:~\$ chmod 600 ~/.ssh/authorized_keys

Allow sudo access with no password:

Edit /etc/sudoers file and add follow line at the end:

odluser@odl-vm:~\$ sudo vi /etc/sudoers
...
odluser ALL=NOPASSWD: ALL
...

Change the user prompt termination from "$" to ">"

Edit ~/.bashrc file and change the prompt (PS1) termination from "$" to ">":

odluser@odl-vm:~\$ vi ~/.bashrc
...
if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\> '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\> '
fi
...

Finally it is recommended to disable reverse IP resolution on SSH server.

Edit sshd_config file and add following line:

odluser@odl-vm:~\$ sudo vi /etc/ssh/sshd_config
...
UseDNS no
...

Install OpenDaylight controller

Follow Controller Artifacts wiki to install desirable controller distribution

Download and Run System Test

Now you are ready for Download and Run System Test