Changes between Version 12 and Version 13 of GENIExperimenter/Tutorials/WiMAXOpenFlow/Design-Setup


Ignore:
Timestamp:
10/27/13 14:38:11 (7 years ago)
Author:
Ryan Izard
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENIExperimenter/Tutorials/WiMAXOpenFlow/Design-Setup

    v12 v13  
    4646   1.  Using the Orbit images for the client, server, and AP, load each onto a separate node in an Orbit testbed. Make sure the node supports the hardware requirements for the experiment (Intel 6250 WiMAX and Atheros 5000 or 9000 series for the client and server, and Atheros 5000 or 9000 series for the AP). Boot these images after they are loaded and SSH into each machine.
    4747
    48    2.  Remove the Forwarding module from the Floodlight OpenFlow controller. Floodlight uses what it calls a '''module loading system''', where the user can write modules to perform a certain task or set of tasks. Each module can register for certain events. For example, the Forwarding module registers for PACKET_IN events where the controller is sent a packet from a connected switch. Upon such an event, the Forwarding module will send the packet out the correct port(s) depending on the destination. This module essentially implements a standard '''learning switch''' function where the OpenFlow-enabled switch behaves as if it were a standard network switch. We do not want this functionality, since we would like to have exclusive control over which port(s) our packets get forwarded.
    49       a. In the client and the server nodes, remove the Forwarding module.
    50       b. The '''module loading system''' maintains a list of the modules to be loaded at runtime. To remove the Forwarding module from this list (and thus disable it), open the '''/root/floodlight-0.90/src/main/resources/floodlightdefault.properties''' file and remove the line '''net.floodlightcontroller.forwarding.Forwarding,\'''.
    51       c. Browse to the root directory of the Floodlight project -- /root/floodlight-0.90. Execute '''ant''' in the terminal. ant is a Java-based build tool to build and compile Java projects. Upon success, ant will produce an updated executable jar file in the /root/floodlight-0.90/target directory named '''floodlight.jar'''.
    52    3. In the client, determine the MAC addresses of the WiMAX and WiFi network interface cards (NICs) for use in OpenFlow flows.
    53       a. Load the kernel modules for each of the NICs by executing '''modprobe i2400m_usb''' and '''modprobe ath5k''', respectively.
    54       b. After the kernel modules are loaded, the devices should be visible in the system. Execute '''ifconfig wmx0''' and '''ifconfig wlan1''', respectively and note the MAC addresses of each NIC. These will be used in later steps.
     48   2.  In the client, remove the Forwarding module from the Floodlight OpenFlow controller. Floodlight uses what it calls a '''module loading system''', where the user can write modules to perform a certain task or set of tasks. Each module can register for certain events. For example, the Forwarding module registers for PACKET_IN events where the controller is sent a packet from a connected switch. Upon such an event, the Forwarding module will send the packet out the correct port(s) depending on the destination. This module essentially implements a standard '''learning switch''' function where the OpenFlow-enabled switch behaves as if it were a standard network switch. We do not want this functionality, since we would like to have exclusive control over which port(s) our packets get forwarded.
     49      a.  Remove the Forwarding module.
     50      b.  The '''module loading system''' maintains a list of the modules to be loaded at runtime. To remove the Forwarding module from this list (and thus disable it), open the '''/root/floodlight-0.90/src/main/resources/floodlightdefault.properties''' file and remove the line '''net.floodlightcontroller.forwarding.Forwarding,\'''.
     51      c.  Browse to the root directory of the Floodlight project -- '''/root/floodlight-0.90'''. Execute '''ant''' in the terminal. '''ant''' is a Java-based build tool to build and compile Java projects. Upon success, '''ant''' will produce an updated executable jar file in the '''/root/floodlight-0.90/target''' directory named '''floodlight.jar'''.
     52   3.  In the client, determine the MAC addresses of the WiMAX and WiFi network interface cards (NICs). These will be used in OpenFlow flows and will be discussed shortly.
     53      a.  Load the kernel modules for each of the NICs by executing '''modprobe i2400m_usb''' and '''modprobe ath5k''', respectively.
     54      b.  After the kernel modules are loaded, the devices should be visible in the system. Execute '''ifconfig wmx0''' and '''ifconfig wlan1''', respectively and note the MAC addresses of each NIC. These will be used in later steps.
    5555   {{{
    5656   $ ifconfig wmx0
     
    7171          Interrupt:19 Base address:0x14a4
    7272   }}}
    73    4. Also in the client, customize the setup script '''gec18_setup.sh''' in /root/StartupScripts. This script is designed to (1) define user variables, (2) configure the tap interface with OpenVPN, (3) start Floodlight, (4) initialize and start Open vSwitch, and (5) configure Linux networking.
     73   4. Also in the client, customize the setup script '''gec18_setup.sh''' in '''/root/StartupScripts'''. This script is designed to (1) define user variables, (2) configure the tap interface with OpenVPN, (3) start Floodlight, (4) initialize and start Open vSwitch, and (5) configure Linux networking.
    7474      a. Open the script with the text editor of your choice (vim, gedit, pico, nano, etc):
    7575      {{{
    76       $ gedit gec18_setup.sh
    77       }}}
    78       e.  There are numerous user defined variables at the top of the script. These are placeholders for commonly used system and configuration specific information throughout the script. We need to change a few of them to suit our needs for this tutorial. Modify the MAC address for '''IFACE_D_MAC''' to match that of the WiMAX interface noted from '''ifconfig wmx0'''. Also, modify the '''IFACE_bridge_E_IP''' variable to be an IP in the same subnet as the server node (yet to be configured). For the tutorial at GEC18, the server node will be configured for you and you will be assigned an IP to give your client node. Assign the IP you have been provided with to the '''IFACE_bridge_E_IP''' variable. Another variable that needs to be configured in the client is the MAC address, SSID, and channel of the AP node. The client needs these pieces of information in order to successfully associate with the AP. For this tutorial, the AP will also be pre-configured. Use the information about the AP that is provided.
     76      $ vim gec18_setup.sh
     77      }}}
     78      b.  There are numerous user defined variables at the top of the script. These are placeholders for commonly used system and configuration specific information throughout the script. We need to change a few of them to suit our needs for this tutorial. Modify the MAC address for '''IFACE_D_MAC''' to match that of the WiMAX interface noted from '''ifconfig wmx0'''. Also, modify the '''IFACE_bridge_E_IP''' variable to be an IP in the same subnet as the server node (yet to be configured). For the tutorial at GEC18, the server node will be configured for you and you will be assigned an IP to give your client node. Assign the IP you have been provided with to the '''IFACE_bridge_E_IP''' variable. Another variable that needs to be configured in the client is the MAC address, SSID, and channel of the AP node. The client needs these pieces of information in order to successfully associate with the AP. For this tutorial, the AP will also be pre-configured. Use the information about the AP that is provided.
    7979      {{{
    8080      ###################
    8181      #USR DEF VARIABLES#
    8282      ###################
    83       }}}
    84       f. Next, we need to remove any running instances of Floodlight and OVS. We do not want more than one instance of these processes running, otherwise chaos might ensue. So, a simple loop and kill works to terminate all running processes.
    85       g. Next, we need to create our tap interface. This is the network interface that will funnel all outbound packets from the applications on our client and send them into our OpenVswitch network.
    86       {{{
     83
     84      SERVER_IP=10.41.14.3
     85      SERVER_MAC=00:1d:e1:3b:62:a6
     86
     87      #IFACE_bridge_A=br_eth
     88      IFACE_bridge_B=br_wifi1
     89      #IFACE_bridge_C=br_wifi1
     90      IFACE_bridge_D=br_wimax
     91      IFACE_bridge_E=br_tap
     92      IFACE_bridge_E_IP=10.41.14.1/16
     93     
     94      #IFACE_A=eth0
     95      IFACE_B=wlan1
     96      IFACE_B_AP_ESSID=GENI_WiFi_AP
     97      IFACE_B_AP_MAC=00:60:B3:B0:C6:6C
     98      IFACE_B_AP_channel=11
     99      IFACE_B_AP_mode=Managed
     100      IFACE_B_kernel_module=ath5k
     101      #IFACE_C=wlan1
     102      IFACE_D=wmx0
     103      IFACE_D_network_ID=51
     104      IFACE_D_DEV_NAME=/dev/sg1
     105      IFACE_D_kernel_module=i2400m_usb
     106      IFACE_D_MAC=00:1d:e1:3b:48:1d
     107      IFACE_E=tap0
     108      IFACE_E_MAC=12:51:16:90:8f:ee
     109     
     110      #IFACE_patch_bridge_A_to_bridge_E=eth-tap
     111      #IFACE_patch_bridge_E_to_bridge_A=tap-eth
     112      IFACE_patch_bridge_B_to_bridge_E=wlan1-tap
     113      IFACE_patch_bridge_E_to_bridge_B=tap-wlan1
     114      #IFACE_patch_bridge_C_to_bridge_E=wlan0-tap
     115      #IFACE_patch_bridge_E_to_bridge_C=tap-wlan0
     116      IFACE_patch_bridge_D_to_bridge_E=wimax-tap
     117     
     118      OVS_kernel_module_path=/root/openvswitch-1.9.0/datapath/linux/openvswitch.ko
     119      #OVS_switchDPID_A=0000000000000001
     120      OVS_switchDPID_B=0000000000000002
     121      #OVS_switchDPID_C=0000000000000003
     122      OVS_switchDPID_D=0000000000000004
     123      OVS_switchDPID_E=0000000000000005
     124      OVS_controllerIP=127.0.0.1:6633
     125     
     126      FL_contRESTIP=127.0.0.1
     127      FL_path=/root/floodlight-0.90/target/floodlight.jar
     128      FL_log=/root/floodlight-output
     129      FL_clear_flows_script=/root/SwitchingScripts/clear_flows.sh
     130      FL_initial_flows_script=/root/SwitchingScripts/gec18_switch_to_wifi.sh
     131      ...
     132      }}}
     133      c.  Next, we need to remove any running instances of Floodlight and OVS. We do not want more than one instance of these processes running, otherwise chaos might ensue. So, a simple loop and kill works to terminate all running processes.
     134      {{{
     135      ...
     136      ##########
     137      #CLEAN UP#
     138      ##########
     139     
     140      while [ -n "$(ps aux | grep floodlight | grep -v grep | awk '{print $2}')" ];
     141      do
     142              echo "PRE: Cleaning up previous Floodlight..."
     143              kill -9 $(ps aux | grep floodlight | grep -v grep | awk '{print $2}')
     144      done
     145      while [ -n "$(ps aux | grep ovs[^_] | grep -v grep | awk '{print $2}')" ];
     146      do
     147              echo "PRE: Cleaning up previous OVS..."
     148              kill -9 $(ps aux | grep ovs[^_] | grep -v grep | awk '{print $2}')
     149      done
     150      ...
     151      }}}
     152      d.  The next thing to do is load our WiFi and WiMAX kernel modules. We have already done this to get the MAC addresses of the interfaces, but we should also do this here so that this script can be run without any prerequisites aside from this initial configuration process.
     153      {{{
     154      ...
     155      #################
     156      #ADD WIMAX IFACE#
     157      #################
     158     
     159      echo "WM: Installing WiMAX kernel module..."
     160      modprobe $IFACE_D_kernel_module
     161     
     162      sleep 3
     163     
     164      echo "WM: Testing WiMAX connection to basestation..."
     165      wimaxcu roff
     166      sleep 2
     167      wimaxcu ron
     168      sleep 2
     169      wimaxcu connect network $IFACE_D_network_ID
     170     
     171      echo "WiFi: Installing WiFi kernel module..."
     172      modprobe $IFACE_B_kernel_module
     173      ...
     174      }}}
     175      e.  Next, we need to create our tap interface. This is the network interface that will funnel all outbound packets from the applications on our client and send them into our OpenVswitch network.
     176      {{{
     177      ...
    87178      ###############
    88       #ADD TAP IFACE#
     179      #ADD TAP IFAC1#
    89180      ###############
    90181     
    91       echo "OVPN: Installing tap interface, $IFACE_tap"
    92       openvpn --mktun --dev $IFACE_tap --lladdr 12:51:16:90:8f:ee
    93       }}}
    94       h. After the tap interface, we need to start the Floodlight controller. The path to the controller executable generated by '''ant''' previosly is defined as the variable '''FL_path'''. Once Floodlight starts, it will not be connected to anything -- we haven't configured our OVS network yet. Once we do this, Floodlight will automatically detect and begin talking to the OVS bridges.
    95       {{{
     182      echo "OVPN: Installing tap interface, $IFACE_E"
     183      openvpn --mktun --dev $IFACE_E --lladdr $IFACE_E_MAC
     184      ...
     185      }}}
     186      f.  After the tap interface, we need to start the Floodlight controller. The path to the controller executable generated by '''ant''' previosly is defined as the variable '''FL_path'''. Once Floodlight starts, it will not be connected to anything -- we haven't configured our OVS network yet. Once we do this, Floodlight will automatically detect and begin talking to the OVS bridges.
     187      {{{
     188      ...
    96189      ##################
    97190      #START FLOODLIGHT#
     
    99192     
    100193      echo "FL: Starting Floodlight..."
    101       cd / && ((java -jar ./root/floodlight/target/floodlight.jar) > floodlight-output 2>&1 &)
     194      (java -jar $FL_path) > $FL_log 2>&1 &
    102195      echo "FL: Finished!"
    103       }}}
    104       i.  Next, we need to insert the Open vSwitch kernel module:
    105       {{{
     196      ...
     197      {{{
     198      g.  Now that Floodlight is running, we need to give the OpenFlow controller something to connect to, which is out OVS network. The first thing to to wirth regard to OVS is to load its kernel module and initialize it's database.
     199      {{{
     200      ...
    106201      ###################
    107202      #START OPENVSWITCH#
     
    110205      echo "OVS: Configuring OVS..."
    111206      echo "OVS: Checking for kernel module..."
    112       if [ -e $(lsmod | grep openvswitch) ]     
     207      if [ -e $(lsmod | grep openvswitch) ]
    113208      then
    114            echo "OVS: ...inserting kernel module"
    115            /sbin/rmmod bridge
    116            sleep 1
    117            insmod /root/openvswitch-1.7.1/datapath/linux/openvswitch.ko
     209              echo "OVS: ...inserting kernel module"
     210              insmod $OVS_kernel_module_path
    118211      else
    119            echo "OVS: ...kernel module already present"
     212              echo "OVS: ...kernel module already present"
    120213      fi
    121       }}}
    122       j. After that, we need to initialize Open vSwitch and its database:
    123       {{{
     214      ##################################################################
    124215      echo "OVS: Creating database"
    125216      ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock \
     
    133224      echo "OVS: Starting OVS..."
    134225      ovs-vswitchd --pidfile --detach
    135       }}}
    136       k. Now, we need to take down any pre-existing OVS bridges and create new ones. If we later try to create bridges with the same names, OVS will produce an error. There are options called '''--if-exists''' and '''--may-exists''' that are supposed to allow the creation of an OVS bridge/port under the condition it does not exist already. I have not been able to get these options to work, so we will use Bash scripting instead:
    137       {{{
    138       echo "OVS: Removing any existing bridge, $IFACE_bridge_eth $IFACE_bridge_wlan0"
    139       echo "OVS: $IFACE_bridge_wimax $IFACE_bridge_int ..."
    140      
    141       ...
    142      
    143       ## Wlan0
    144       echo "OVS: Removing any existing bridge, $IFACE_bridge_wlan0..."
    145       if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_wlan0)" ]     
    146       then
    147            echo "OVS: ...removing $IFACE_bridge_wlan0"
    148            ovs-vsctl del-br $IFACE_bridge_wlan0
    149       fi
    150      
    151       ## WiMAX
    152       if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_wimax)" ]
    153       then
    154            echo "OVS: ...removing $IFACE_bridge_wimax"
    155            ovs-vsctl del-br $IFACE_bridge_wimax
    156       fi
    157      
    158       ## Internal
    159       if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_int)" ]
    160       then
    161            echo "OVS: ...removing $IFACE_bridge_int"
    162            ovs-vsctl del-br $IFACE_bridge_int
    163       fi
    164 
    165       ######################
    166       #ADD INTERNAL BRIDGES#
    167       ######################
    168 
    169       ...
    170 
    171       ## Wlan0
    172       echo "OVS: Adding interface bridge, $IFACE_bridge_wlan0..."
    173       ovs-vsctl add-br $IFACE_bridge_wlan0
    174       echo "OVS: ...with port $IFACE_wlan0"
    175       ovs-vsctl add-port $IFACE_bridge_wlan0 $IFACE_wlan0 -- set Interface $IFACE_wlan0 ofport=$port_eth1
    176       echo "OVS: ...with port $IFACE_patch_wlan0_to_tap"
    177       ovs-vsctl add-port $IFACE_bridge_wlan0 $IFACE_patch_wlan0_to_tap -- set Interface $IFACE_patch_wlan0_to_tap ofport=$port_wlan0_to_tap
    178 
    179       ## WiMAX
    180       echo "OVS: Adding interface bridge, $IFACE_bridge_wimax..."
    181       ovs-vsctl add-br $IFACE_bridge_wimax
    182       echo "OVS: ...with port $IFACE_wimax"
    183       ovs-vsctl add-port $IFACE_bridge_wimax $IFACE_wimax -- set Interface $IFACE_wimax ofport=$port_eth2
    184       echo "OVS: ...with port $IFACE_patch_wimax_to_tap"
    185       ovs-vsctl add-port $IFACE_bridge_wimax $IFACE_patch_wimax_to_tap -- set Interface $IFACE_patch_wimax_to_tap ofport=$port_wimax_to_tap
    186 
    187       ## Internal
    188       echo "OVS: Adding interface bridge, $IFACE_bridge_int..."
    189       ovs-vsctl add-br $IFACE_bridge_int
    190       echo "OVS: ...with port $IFACE_tap"
    191       ovs-vsctl add-port $IFACE_bridge_int $IFACE_tap -- set Interface $IFACE_tap ofport=$port_tap0
    192       #echo "OVS: ...with port $IFACE_patch_tap_to_eth"
    193       #ovs-vsctl add-port $IFACE_bridge_int $IFACE_patch_tap_to_eth -- set Interface $IFACE_patch_tap_to_eth ofport=$port_tap_to_eth
    194       echo "OVS: ...with port $IFACE_patch_tap_to_wlan0"
    195       ovs-vsctl add-port $IFACE_bridge_int $IFACE_patch_tap_to_wlan0 -- set Interface $IFACE_patch_tap_to_wlan0 ofport=$port_tap_to_wlan0
    196       echo "OVS: ...with port $IFACE_patch_tap_to_wimax"
    197       ovs-vsctl add-port $IFACE_bridge_int $IFACE_patch_tap_to_wimax -- set Interface $IFACE_patch_tap_to_wimax ofport=$port_tap_to_wimax
     226      ...
     227      }}}
     228     
     229      h.  Now, we need to take down any pre-existing OVS bridges and create new ones. If we later try to create bridges with the same names, OVS will produce an error. There are options called '''--if-exists''' and '''--may-exists''' that are supposed to allow the creation of an OVS bridge/port under the condition it does not exist already. I have not been able to get these options to work, so we will use Bash scripting instead:
     230      {{{
     231      echo "OVS: Removing any existing bridge, $IFACE_bridge_A $IFACE_bridge_B"
     232echo "OVS: $IFACE_bridge_C $IFACE_bridge_D ..."
     233
     234## Ethernet
     235#if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_A)" ]
     236#then
     237#       echo "OVS: ...removing $IFACE_bridge_A"
     238#       ovs-vsctl del-br $IFACE_bridge_A
     239#fi
     240
     241## Wlan0
     242echo "OVS: Removing any existing bridge, $IFACE_bridge_B..."
     243if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_B)" ]
     244then
     245        echo "OVS: ...removing $IFACE_bridge_B"
     246        ovs-vsctl del-br $IFACE_bridge_B
     247fi
     248
     249## Wlan1
     250#if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_C)" ]
     251#then
     252#       echo "OVS: ...removing $IFACE_bridge_C"
     253#       ovs-vsctl del-br $IFACE_bridge_C
     254#fi
     255
     256## WiMAX
     257if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_D)" ]
     258then
     259        echo "OVS: ...removing $IFACE_bridge_D"
     260        ovs-vsctl del-br $IFACE_bridge_D
     261fi
     262
     263## Tap
     264if [ -n "$(ovs-vsctl show | grep $IFACE_bridge_E)" ]
     265then
     266        echo "OVS: ...removing $IFACE_bridge_E"
     267        ovs-vsctl del-br $IFACE_bridge_E
     268fi
     269
     270## Wlan0
     271echo "OVS: Adding interface bridge, $IFACE_bridge_B..."
     272ovs-vsctl add-br $IFACE_bridge_B
     273echo "OVS: ...with port $IFACE_B"
     274ovs-vsctl add-port $IFACE_bridge_B $IFACE_B
     275echo "OVS: ...with port $IFACE_patch_bridge_B_to_bridge_E"
     276ovs-vsctl add-port $IFACE_bridge_B $IFACE_patch_bridge_B_to_bridge_E
     277
     278## Wlan1
     279#echo "OVS: Adding interface bridge, $IFACE_bridge_C..."
     280#ovs-vsctl add-br $IFACE_bridge_C
     281#echo "OVS: ...with port $IFACE_C"
     282#ovs-vsctl add-port $IFACE_bridge_C $IFACE_C
     283#echo "OVS: ...with port $IFACE_patch_bridge_C_to_bridge_E"
     284#ovs-vsctl add-port $IFACE_bridge_C $IFACE_patch_bridge_C_to_bridge_E
     285
     286## WiMAX
     287echo "OVS: Adding interface bridge, $IFACE_bridge_D..."
     288ovs-vsctl add-br $IFACE_bridge_D
     289echo "OVS: ...with port $IFACE_D"
     290ovs-vsctl add-port $IFACE_bridge_D $IFACE_D
     291echo "OVS: ...with port $IFACE_patch_bridge_D_to_bridge_E"
     292ovs-vsctl add-port $IFACE_bridge_D $IFACE_patch_bridge_D_to_bridge_E
     293
     294## Tap
     295echo "OVS: Adding interface bridge, $IFACE_bridge_E..."
     296ovs-vsctl add-br $IFACE_bridge_E
     297echo "OVS: ...with port $IFACE_E"
     298ovs-vsctl add-port $IFACE_bridge_E $IFACE_E
     299#echo "OVS: ...with port $IFACE_patch_bridge_E_to_bridge_A"
     300#ovs-vsctl add-port $IFACE_bridge_E $IFACE_patch_bridge_E_to_bridge_A
     301echo "OVS: ...with port $IFACE_patch_bridge_E_to_bridge_B"
     302ovs-vsctl add-port $IFACE_bridge_E $IFACE_patch_bridge_E_to_bridge_B
     303#echo "OVS: ...with port $IFACE_patch_bridge_E_to_bridge_C"
     304#ovs-vsctl add-port $IFACE_bridge_E $IFACE_patch_bridge_E_to_bridge_C
     305echo "OVS: ...with port $IFACE_patch_bridge_E_to_bridge_D"
     306ovs-vsctl add-port $IFACE_bridge_E $IFACE_patch_bridge_E_to_bridge_D
     307      ...
    198308      }}}
    199309      l.  At this point, we're ready to set the patch ports between the OVS bridges. These create links between the OVS tap bridge and the OVS WiFi and WiMAX bridges in order to facilitate the flow of packets from the tap bridge to the physical interface of choice -- WiFi or WiMAX.
    200310      {{{
     311      ...
    201312      #################
    202313      #SET PATCH PORTS#
    203314      #################
    204315     
    205       ...
    206      
    207       echo "OVS: Patching ports $IFACE_patch_tap_to_wlan0, $IFACE_patch_wlan0_to_tap"
    208       ovs-vsctl set interface $IFACE_patch_tap_to_wlan0 type=patch
    209       ovs-vsctl set interface $IFACE_patch_tap_to_wlan0 options:peer=$IFACE_patch_wlan0_to_tap
    210       ovs-vsctl set interface $IFACE_patch_wlan0_to_tap type=patch
    211       ovs-vsctl set interface $IFACE_patch_wlan0_to_tap options:peer=$IFACE_patch_tap_to_wlan0
    212      
    213       echo "OVS: Patching ports $IFACE_patch_tap_to_wimax, $IFACE_patch_wimax_to_tap"
    214       ovs-vsctl set interface $IFACE_patch_tap_to_wimax type=patch
    215       ovs-vsctl set interface $IFACE_patch_tap_to_wimax options:peer=$IFACE_patch_wimax_to_tap
    216       ovs-vsctl set interface $IFACE_patch_wimax_to_tap type=patch
    217       ovs-vsctl set interface $IFACE_patch_wimax_to_tap options:peer=$IFACE_patch_tap_to_wimax
     316     ## Set patch ports
     317#echo "OVS: Patching ports $IFACE_patch_bridge_E_to_bridge_A, $IFACE_patch_bridge_A_to_bridge_E"
     318#ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_A type=patch
     319#ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_A options:peer=$IFACE_patch_bridge_A_to_bridge_E
     320#ovs-vsctl set interface $IFACE_patch_bridge_A_to_bridge_E type=patch
     321#ovs-vsctl set interface $IFACE_patch_bridge_A_to_bridge_E options:peer=$IFACE_patch_bridge_E_to_bridge_A
     322
     323echo "OVS: Patching ports $IFACE_patch_bridge_E_to_bridge_B, $IFACE_patch_bridge_B_to_bridge_E"
     324ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_B type=patch
     325ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_B options:peer=$IFACE_patch_bridge_B_to_bridge_E
     326ovs-vsctl set interface $IFACE_patch_bridge_B_to_bridge_E type=patch
     327ovs-vsctl set interface $IFACE_patch_bridge_B_to_bridge_E options:peer=$IFACE_patch_bridge_E_to_bridge_B
     328
     329#echo "OVS: Patching ports $IFACE_patch_bridge_E_to_bridge_C, $IFACE_patch_bridge_C_to_bridge_E"
     330#ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_C type=patch
     331#ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_C options:peer=$IFACE_patch_bridge_C_to_bridge_E
     332#ovs-vsctl set interface $IFACE_patch_bridge_C_to_bridge_E type=patch
     333#ovs-vsctl set interface $IFACE_patch_bridge_C_to_bridge_E options:peer=$IFACE_patch_bridge_E_to_bridge_C
     334
     335echo "OVS: Patching ports $IFACE_patch_bridge_E_to_bridge_D, $IFACE_patch_bridge_D_to_bridge_E"
     336ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_D type=patch
     337ovs-vsctl set interface $IFACE_patch_bridge_E_to_bridge_D options:peer=$IFACE_patch_bridge_D_to_bridge_E
     338ovs-vsctl set interface $IFACE_patch_bridge_D_to_bridge_E type=patch
     339ovs-vsctl set interface $IFACE_patch_bridge_D_to_bridge_E options:peer=$IFACE_patch_bridge_E_to_bridge_D
     340
    218341      }}}
    219342      m.  Now, we need to assign each OVS bridge a unique ID (DPID) and point them to the address of the Floodlight controller. Floodlight will be run on the localhost, so the loopback address is defined within a the variable '''OVS_controllerIP''' and is set as the loopback address '''127.0.0.1:6633'''. Port '''6633''' is the default OpenFlow port. As long as Floodlight and OVS are configured to use the same port number, any available port will suffice. We also need to tell the OVS bridges what to do if and when they lose connection to the Floodlight controller. The '''standalone''' mode allows them to default to a learning switch state if the link between the controller and the bridge is broken.
    220343      {{{
    221       ##########
    222       #SET DPID#
    223       ##########
    224      
    225       ...
     344      ## Set Eth DPID
     345      #echo "OVS: Setting $IFACE_bridge_A DPID to $OVS_switchDPID_A..."
     346      #ovs-vsctl set bridge $IFACE_bridge_A other-config:datapath-id=$OVS_switchDPID_A
    226347     
    227348      ## Set Wlan0 DPID
    228       echo "OVS: Setting $IFACE_bridge_wlan0 DPID to $OVS_switchDPID_wlan0..."
    229       ovs-vsctl set bridge $IFACE_bridge_wlan0 other-config:datapath-id=$OVS_switchDPID_wlan0
     349      echo "OVS: Setting $IFACE_bridge_B DPID to $OVS_switchDPID_B..."
     350      ovs-vsctl set bridge $IFACE_bridge_B other-config:datapath-id=$OVS_switchDPID_B
     351     
     352      ## Set Wlan1 DPID
     353      #echo "OVS: Setting $IFACE_bridge_C DPID to $OVS_switchDPID_C..."
     354      #ovs-vsctl set bridge $IFACE_bridge_C other-config:datapath-id=$OVS_switchDPID_C
    230355     
    231356      ## Set WiMAX DPID
    232       echo "OVS: Setting $IFACE_bridge_wimax DPID to $OVS_switchDPID_wimax..."
    233       ovs-vsctl set bridge $IFACE_bridge_wimax other-config:datapath-id=$OVS_switchDPID_wimax
    234      
     357      echo "OVS: Setting $IFACE_bridge_D DPID to $OVS_switchDPID_D..."
     358      ovs-vsctl set bridge $IFACE_bridge_D other-config:datapath-id=$OVS_switchDPID_D
     359
    235360      ## Set Tap DPID
    236       echo "OVS: Setting $IFACE_bridge_int DPID to $OVS_switchDPID_tap..."
    237       ovs-vsctl set bridge $IFACE_bridge_int other-config:datapath-id=$OVS_switchDPID_tap
    238      
    239       ...
     361      echo "OVS: Setting $IFACE_bridge_E DPID to $OVS_switchDPID_E..."
     362      ovs-vsctl set bridge $IFACE_bridge_E other-config:datapath-id=$OVS_switchDPID_E
     363     
     364      ## Ethernet
     365      #echo "OVS: Connecting $IFACE_bridge_A to controller at $OVS_controllerIP"
     366      #ovs-vsctl set-controller $IFACE_bridge_A tcp:$OVS_controllerIP
     367      #ovs-vsctl set-fail-mode $IFACE_bridge_A standalone
    240368     
    241369      ## Wlan0
    242       echo "OVS: Connecting $IFACE_bridge_wlan0 to controller at $OVS_controllerIP"
    243       ovs-vsctl set-controller $IFACE_bridge_wlan0 tcp:$OVS_controllerIP
     370      echo "OVS: Connecting $IFACE_bridge_B to controller at $OVS_controllerIP"
     371      ovs-vsctl set-controller $IFACE_bridge_B tcp:$OVS_controllerIP
     372      ovs-vsctl set-fail-mode $IFACE_bridge_B standalone
     373      echo "OVS: Setting MAC of $IFACE_bridge_B to $IFACE_D"
     374      ovs-vsctl set bridge $IFACE_bridge_B other-config:hwaddr=$IFACE_D_MAC
     375     
     376      ## Wlan1
     377      #echo "OVS: Connecting $IFACE_bridge_C to controller at $OVS_controllerIP"
     378      #ovs-vsctl set-controller $IFACE_bridge_C tcp:$OVS_controllerIP
     379      #ovs-vsctl set-fail-mode $IFACE_bridge_C standalone
    244380     
    245381      ## WiMAX
    246       echo "OVS: Connecting $IFACE_bridge_wimax to controller at $OVS_controllerIP"
    247       ovs-vsctl set-controller $IFACE_bridge_wimax tcp:$OVS_controllerIP
    248      
    249       ## Internal
    250       echo "OVS: Connecting $IFACE_bridge_int to controller at $OVS_controllerIP"
    251       ovs-vsctl set-controller $IFACE_bridge_int tcp:$OVS_controllerIP
    252       ovs-vsctl set bridge br_tap other-config:hwaddr=12:51:16:90:8f:ee
     382      echo "OVS: Connecting $IFACE_bridge_D to controller at $OVS_controllerIP"
     383      ovs-vsctl set-controller $IFACE_bridge_D tcp:$OVS_controllerIP
     384      ovs-vsctl set-fail-mode $IFACE_bridge_D standalone
     385      echo "OVS: Setting MAC of $IFACE_bridge_D to $IFACE_D"
     386      ovs-vsctl set bridge $IFACE_bridge_D other-config:hwaddr=$IFACE_D_MAC
     387     
     388      ## Tap
     389      echo "OVS: Connecting $IFACE_bridge_E to controller at $OVS_controllerIP"
     390      ovs-vsctl set-controller $IFACE_bridge_E tcp:$OVS_controllerIP
     391      ovs-vsctl set-fail-mode $IFACE_bridge_E standalone
     392      echo "OVS: Setting MAC of $IFACE_bridge_E to $IFACE_E"
     393      ovs-vsctl set bridge $IFACE_bridge_E other-config:hwaddr=$IFACE_E_MAC
    253394     
    254395      echo "OVS: Finished!"
     396      ...
    255397      }}}
    256398      n.  Now that we have OVS and Floodlight running, the next thing to do in the setup script is to configure our network connections. We first need to disable IP forwarding, so that the kernel does not try to route packets around our OVS network. We then need to establish a link on each of the interface we would like to participate in the handoff -- WiFi and WiMAX. Note that WiFi is assigned to '''IFACE_B''' and WiMAX is assigned to '''IFACE_D'''. Also note the use of the WiFi AP variables we set in the first step of configuring this script. After WiFi and WiMAX each connect to their respective networks, we need to remove any IP addresses assigned by DHCP when the interfaces were brought up. In the case of this tutorial, we should not get an IP via DHCP for WiFi, since we're managing our own AP. It is possible that we received an IP over WiMAX though, so we need to remove it, just in case. This involves killing the running '''dhclient''' process for WiMAX. At this point, we're ready to assign our single IP to the tap OVS bridge over which applications can send and receive data. This will allow us to inject data/packets into our OVS network as well as pull packets destined for an application out of our OVS network.
     
    260402      ##########################
    261403     
     404      echo "NTWK: Making sure loopback is up (it has gone down for some reason before)..."
    262405      ifconfig lo up
    263406     
    264       ## Disable IP on physical interfaces
    265       echo "NTWK: Taking down $IFACE_wimax..."
    266       ifconfig $IFACE_wimax 0.0.0.0
    267      
    268       echo "NTWK: Taking down $IFACE_wlan0..."
    269       ifconfig $IFACE_wlan0 0.0.0.0
    270      
    271       ## Assign static IP addresses for bridge interfaces
    272       echo "NTWK: Assigning $IFACE_bridge_int IP as $IFACE_tap_IP..."
    273       ifconfig $IFACE_bridge_int $IFACE_tap_IP netmask 255.255.255.0
    274      
    275       ## Get an IP for bridge interfaces using DHCP
    276       echo "NTWK: Assigning $IFACE_bridge_wimax IP via dhclient..."
    277       dhclient $IFACE_bridge_wimax
    278      
    279       echo "NTWK: Assigning $IFACE_bridge_wlan0 IP via dhclient..."
    280       dhclient $IFACE_bridge_wlan0
    281      
    282       ...
    283 
    284407      ## Turn off IP Forwarding
    285408      echo "NTWK: Disabling IP Forwarding..."
    286409      echo "0" > /proc/sys/net/ipv4/ip_forward
    287      
    288       ...     
    289 
     410      echo "0" > /proc/sys/net/ipv4/conf/all/forwarding
     411     
     412      ## Disable IPv6
     413      echo "NTWK: Disabling IPv6..."
     414      echo "0" > /proc/sys/net/ipv6/conf/all/disable_ipv6
     415     
     416      ## Disable IP on interfaces
     417      #echo "NTWK: Taking down $IFACE_A..."
     418      #ifconfig $IFACE_A down
     419      echo "NTWK: Taking down $IFACE_D..."
     420      ifconfig $IFACE_D down
     421      echo "NTWK: Taking down $IFACE_B..."
     422      ifconfig $IFACE_B down
     423      #echo "NTWK: Taking down $IFACE_C..."
     424      #ifconfig $IFACE_C down
     425      #echo "NTWK: Taking down $IFACE_bridge_A..."
     426      #ifconfig $IFACE_bridge_A down
     427      echo "NTWK: Taking down $IFACE_bridge_B..."
     428      ifconfig $IFACE_bridge_B down
     429      #echo "NTWK: Taking down $IFACE_bridge_C..."
     430      #ifconfig $IFACE_bridge_C down
     431      echo "NTWK: Taking down $IFACE_bridge_D..."
     432      ifconfig $IFACE_bridge_D down
     433      sleep 2
     434
     435      # The use of ip link over ifconfig is necessary is some cases, especially for WiFi (haven't fully debugged yet)
     436      ip link set dev $IFACE_B down
     437
     438      echo "NTWK: Bringing all non-bridge interfaces back up..."
     439      ip link set dev $IFACE_B promisc on up
     440      ip link set dev $IFACE_D promisc on up
     441      ip link set dev $IFACE_E promisc on up
     442      ifconfig $IFACE_B 0.0.0.0
     443      ifconfig $IFACE_D 0.0.0.0
     444      ifconfig $IFACE_E 0.0.0.0
     445     
     446      echo "NTWK: Setting MAC of $IFACE_B to $IFACE_D..."
     447      ifconfig $IFACE_B down
     448      ifconfig $IFACE_B hw ether $IFACE_D_MAC
     449      ifconfig $IFACE_B up promisc multicast
     450      echo "NTWK: Connecting $IFACE_B to AP via iwconfig..."
     451      iwconfig $IFACE_B essid $IFACE_B_AP_ESSID ap $IFACE_B_AP_MAC channel $IFACE_B_AP_channel mode $IFACE_B_AP_mode
     452     
     453      echo "NTWK: Connecting $IFACE_D to BS via wimaxcu..."
     454      wimaxcu roff
     455      sleep 2
     456      wimaxcu ron
     457      sleep 2
     458      wimaxcu connect network $IFACE_D_network_ID
     459     
     460      echo "NTWK: Bringing all non-IP OVS bridges up..."
     461      ifconfig $IFACE_bridge_B 0.0.0.0 up
     462      ifconfig $IFACE_bridge_D 0.0.0.0 up
     463     
     464      echo "NTWK: Setting IP of $IFACE_bridge_E_IP on $IFACE_bridge_E"
     465      ifconfig $IFACE_bridge_E $IFACE_bridge_E_IP up
     466     
     467      # We can't kill every dhclient process here, since on Orbit, we have a control interface (eth1?) over DHCP it seems
     468      echo "NTWK: Sleeping for a bit while dhclient has a chance to auto-start..."
     469      sleep 10
     470     
     471      echo "NTWK: Killing any running dhclient processes on $IFACE_D"
     472      pgrep -f dhclient.$IFACE_D
     473      pkill -9 -f dhclient.$IFACE_D
     474      ifconfig $IFACE_D 0.0.0.0
     475     
     476      echo "NTWK: Inserting static ARP entry to server as $SERVER_IP $SERVER_MAC"
     477      arp -s $SERVER_IP $SERVER_MAC
     478     
     479      echo "NTWK: Pushing initial flows..."
     480      $FL_clear_flows_script
     481      $FL_initial_flows_script
     482     
     483      exit 0
    290484      }}}
    291485      o. At this point, all components of this tutorial have been configured for the client. The last thing to do is allow the flow of packets from the tap interface to the interface of our choice using Floodlight's Static Flow Pusher API. There is the variable '''FL_initial_flows_script''' that is defined as the path to the Bash script that will insert the initial flows. Now, at this point, we will insert these flows, but we need to need check to ensure they are configured correctly. For this, we will need to take note of the WiMAX MAC address determined in an earlier step.