OpenFlow v1.0 Test Network

From OpenFlow Wiki

Jump to: navigation, search

Contents

Test Network Topology

OpenFlow v1 TestNet.gif OpenFlow v1 TestNet-Inband.gif

Port Assignment

Soekris32

  • Switch Name: soekris32.stanford.edu.
  • Controller: openflow7.stanford.edu:7000
Port#Media VLAN ID(local)VLAN TAG # Connected to
eth0 100BASE-T74 NO Comm 3.3 soekris33 port eth0
eth1 100BASE-T74 NO Uplink HP gates-sw-3-2 B20
eth2 100BASE-T74 NO 3.2.3083X (G350, Brandon)
eth3 100BASE-T74 NO not used
eth4 100BASE-T74 NO not used
eth5 100BASE-T74 NO not used
eth6 100BASE-T74 NO not used
eth7 100BASE-T74 NO CTRL PORT(HP gates-sw-3-2:B15)

Soekris33

  • Switch Name: soekris33.stanford.edu.
  • Controller: openflow7.stanford.edu:7000
Port# Media VLAN ID(local)VLAN TAG # Connected to
eth0 100BASE-T74 NO (Uplink) Comm 3.2 soekris32 port eth0
eth1 100BASE-T74 NO not used
eth2 100BASE-T74 NO 3.3.3071U (G337 Masa)
eth3 100BASE-T74 NO 3.3.3070U (G343 Guido)
eth4 100BASE-T74 NO not used
eth5 100BASE-T74 NO not used
eth6 100BASE-T74 NO not used
eth7 100BASE-T74 NO CTRL PORT (Cisco in Comm3.3 port 5/7)

Controller Configuration

Nox v1.0 controller

  • It is currently running on openflow7:7000 (as basenox user)
  • To start
$ cd ~basenox/nox_v1.0/src
$ ./start-nox.sh
  • To restart (the restart event is logged in nox-restart.log in the noxcore program dir)
$ cd ~basenox/nox_v1.0/src
$ ./restart-nox.sh
  • Check if nox is dead and restart (if dead). This script will run from cron daemon every min.
$ cd ~basenox/nox_v1.0/src
$ ./nox-livecheck.sh
  • What start-nox.sh is doing?
#! /bin/sh
NOX=/home/basenox/nox_v1.0/src/nox_core
NOXDIR=/home/basenox/nox_v1.0/src/
PORT=7000
MODULES="routing"
if [ -e /var/run/nox.pid ]; then
  echo "there is nox.pid in /var/run .. exitting"
  exit
fi
echo "starting nox on port $PORT with modules $MODULES"
cd $NOXDIR
#$NOX -d --verbose="ANY:syslog:DBG" -i ptcp:$PORT $MODULES
$NOX  --verbose="ANY:syslog:DBG" -i ptcp:$PORT $MODULES > nox.log  2>&1 &
  • What restart-nox.sh is doing?
STARTSCRIPT=/home/basenox/nox_v1.0/src/start-nox.sh
LOG=/home/basenox/nox_v1.0/src/nox-restart.log
PORT=7000
pid=`ps -edalf | grep -v grep | grep lt-nox_core | grep $PORT| awk '{print $4}'`
kill -KILL $pid
DATE=`date`
touch $LOG
echo -n "$DATE : "  >> $LOG
echo "killed nox on port $PORT and Resarting.." >> $LOG
echo "killed nox on port $PORT and Resarting.."
. $STARTSCRIPT
  • What nox-livecheck.sh is doing?
#! /bin/sh
STARTSCRIPT=/home/basenox/nox_v1.0/src/start-nox.sh
LOG=/home/basenox/nox_v1.0/src/nox-restart.log
MAIL=/home/basenox/bin/mail.sh
PORT=700
pid=`ps -edalf | grep -v grep | grep lt-nox_core | grep $PORT| awk '{print $4}'`
#echo $pid
DATE=`date`
if [ x$pid == "x" ]; then
 touch $LOG
 echo -n "$DATE : "  >> $LOG
 echo "nox on port $PORT is dead. Restarting.." >> $LOG
 echo "nox on port $PORT is dead. Restarting.." | $MAIL "ERROR: nox restart"
 echo "nox on port $PORT is dead. Restarting.."
 $STARTSCRIPT
else
 echo -n "$DATE : " 
 echo "nox on port $PORT is alive (pid $pid)"
fi

Reference controller (We stopped using this as of Dec 08/2009)

  • Currently we run reference controller on TCP port 7000 at openflow7.stanford.edu
$ su - basenox
$ cd ~basenox/openflow-0.9.0-rev1/controller
$ ./controller ptcp:7000
  • To upgrade (Example: 0.9.0-rev1)
Compile
$ cd ~basenox
$ wget http://openflowswitch.org/downloads/openflow-0.9.0-rev1.tar.gz
$ tar zxvf openflow-0.9.0-rev1.tar.gz
$ cd openflow-0.9.0-rev1
$ ./configure
$ make
Kill the current controller
$ killall controller
Start new one
$ cd controller
$ ./controller ptcp:7000

Soekris Box Configuration

Upgrade OpenFlow Version

  • Download & Compile OpenFlow
  • Recreate the link /noxbox/openflow so that it points to the new OpenFlow compiled directory
  • Example (to upgrade to v0.9)
 Compile
 # cd /root
 # wget http://openflowswitch.org/downloads/openflow-0.9.0-rev1.tar.gz
 # tar zxvf openflow-0.9.0-rev1.tar.gz
 # cd openflow-0.9.0-rev1
 # ./configure --with-l26=/lib/modules/`uname -r`/build
 # make
 Stop OpenFLow
 # /etc/init.d/openflow_secchan stop
 # /etc/init.d/openflow stop
 Renew Symlink
 # cd /noxbox
 # rm openflow
 # ln -s /root/openflow-0.9.0-rev1 /noxbox/openflow
 Start OpenFLow
 # /etc/init.d/openflow start
 # /etc/init.d/openflow_secchan start

To change IP address (control channel)

Set in /etc/network/interfaces

OpenFlow Setup

Configuration file is /etc/noxbox.conf

OPENFLOW_MAC="00:00:24:CC:4A:57"  ## used for DPID
OPENFLOW_INTERFACES="eth0 eth1 eth2 eth3 eth4 eth5 eth6"
FAIL_OPEN=false   # set false or true
CONTROLLER_ADDR=172.27.74.158:7000  # Controller's IP and TCP port number
INACTIVITY_PROBE=5    # Inactivity Probe interval (in sec) (for ofprotocol)

Start/Stop OpenFlow

  • To start (Always start openflow first then secchan(ofprotocol)).
 # /etc/init.d/openflow start
 # /etc/init.d/openflow_secchan start
  • To stop
 # /etc/init.d/openflow_secchan stop
 # /etc/init.d/openflow stop
  • To restart secchan only
 # /etc/init.d/openflow_secchan stop
 # /etc/init.d/openflow_secchan start


Change to Userspace switch, Kernel space switch

  • To change to userspace switch
 # /etc/init.d/openflow_secchan stop
 # /etc/init.d/openflow stop
 # rm /etc/init.d/openflow /etc/init.d/openflow_secchan
 # ln -s /etc/init.d/openflow_user /etc/init.d/openflow
 # ln -s /etc/init.d/openflow_secchan_user /etc/init.d/openflow_secchan
 # /etc/init.d/openflow start
 # /etc/init.d/openflow_secchan start

Actually there is a shell script prepared to do all the above at once:

 # /etc/init.d/change-to-userspace.sh


  • To change to kernel switch
 # /etc/init.d/openflow_secchan stop
 # /etc/init.d/openflow stop
 # rm /etc/init.d/openflow /etc/init.d/openflow_secchan
 # ln -s /etc/init.d/openflow_kernel /etc/init.d/openflow
 # ln -s /etc/init.d/openflow_secchan_kernel /etc/init.d/openflow_secchan
 # /etc/init.d/openflow start
 # /etc/init.d/openflow_secchan start

Actually there is a shell script prepared to do all the above at once:

 # /etc/init.d/change-to-kernelsw.sh

Note on dpctl in Soekris

  • dpctl command is at /noxbox/bin/dpctl (which is a symlink poining to the current version of dpctl).
  • If you're running Kernel switch, refer to "nl:0" for datapath
 /noxbox/bin/dpctl dump-flows nl:0
  • If you're running userspace switch, refer to unix:/var/run/dp0 for datapath
 /noxbox/bin/dpctl dump-flows unix:/var/run/dp0


Change between In-band and Out-of-band control

On both soekris32 and 33, we assign IP address to eth7 for out-of-band control. For inband control, we assign it on of0 (if it is kernel switch) or tap0 (if it is usespace switch). To assign IP address on eth7, change /etc/network/intefaces file. To assign IP address on of0/tap0, change /etc/noxbox.conf file. Here is the examples:

  • To change to inband control (i.e., remove IP address from eth7 and assign it to of0/tap0)

Comment out (add # in the beginning of the lines) the following lines in /etc/network/interface

 iface eth7 inet static
   address 172.24.74.141
   netmask 255.255.255.0
   gateway 172.24.74.1

Comment in (remove #) in the following lines in /etc/noxbox.conf

 #INBAND_IP=172.24.74.141
 #INBAND_MASK=255.255.255.0
 #INBAND_GW=172.24.74.1

And then reboot

 # shutdown -r now
  • To change to out-of-band control (i.e., remove IP address from tap0/of0 and assign it to eth7)

Comment in (remove #) the following lines in /etc/network/interface

 #iface eth7 inet static
 # address 172.24.74.141
 # netmask 255.255.255.0
 # gateway 172.24.74.1

Comment out (add # in front) the following lines in /etc/noxbox.conf

 INBAND_IP=172.24.74.141
 INBAND_MASK=255.255.255.0
 INBAND_GW=172.24.74.1

And then reboot

 # shutdown -r now