ODL-based SDN laboratory

In this section, we set up our SDN laboratory (with built-in OpenFlow support) using our ODL controller. Our procedure assumes that you are installing the ODL controller on your local Linux machine and you will use the Mininet VM (as detailed in the previous sections) to create a virtual network. Our host operating system is Windows 7 Enterprise and therefore, throughout this section, we will use VMware Player to host another VM (Ubuntu 12.04) for the ODL controller. The settings of our VM are as follows:

  • Two CPUs, 2 GB RAM, and 20 GB disk space.
  • Bridged NIC, which puts the VM on the same network as your NIC. You can bind to wireless or wired. So if your physical host, such as your laptop, is on 192.168.0.10/24, a VM in bridged mode would get 192.168.0.11/24 or whatever your DHCP server assigns to it. The point is to have the VM remain on the same subnet as your host computer.

After logging in to your VM, you have to download the following prerequisite software:

  • JVM 1.7 or higher, for example, OpenJDK 1.7 (JAVA_HOME should be set to the environment variable)
  • Git to pull the ODL controller from the Git repository
  • Maven

Install the dependencies and pull down the code using Git:

      $ sudo apt-get update
      $ sudo apt-get install maven git openjdk-7-jre openjdk-7-jdk 
      $ git clone http://git.opendaylight.org/gerrit/p/controller.git
      $ cd controller/opendaylight/distribution/opendaylight/
      $ mvn clean install
      $ cd target/distribution.opendaylight-0.1.0-SNAPSHOT-
osgipackage/opendaylight

This will install the required tools and get the ODL controller from the Git repository. Then Maven will build and install the ODL controller. Apache Maven is a build automation tool used primarily for Java projects. Note that building the ODL controller takes a few minutes.

If your Maven build fails with an Out Of Memory error: PermGen Space error, rerun Maven using the -X switch to enable full debug logging. This is due to a memory leak somewhere in the Maven build and is being tracked as a bug. Instead of mvn clean install you can run maven clean install -DskipTests and it will skip the integration tests that seem to be the source of the garbage collector's leak. You can also address this error by setting maven options using $ export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m command.

The summary at the end of Maven build will report the successful build of the ODL controller along with the elapsed time and allocated/available memory. Before running the ODL controller, you have to set up the JAVA_HOME environment variable. The current value of JAVA_HOME can be viewed with the echo $JAVA_HOME command. It will likely be undefined. Export the JAVA_HOME environment variable. You can write it to .bashrc (located in the user home directory) to have it be persistent through reboots and logins. Place JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64 at the bottom of your ~/.bashrc file, or for one-time use, set it with the following:

      $ export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386 
(or -amda64)

You can start the ODL controller by changing the current directory to the location where the ODL binary is available and start it with run.sh:

      $ cd ~/controller/opendaylight/distribution/opendaylight
/target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage
/opendaylight
$ ./run.sh

The ODL controller needs a couple of minutes to get all of its modules loaded. You can point your browser to 127.0.0.1:8080 to open the ODL controller web interface (see the following screenshot). The default username and password is admin (username: admin, password: admin):

The web-based GUI of the ODL controller

Now that we have the ODL controller up and running, we can point the OpenFlow switch of our OpenFlow laboratory to this controller. The ODL controller has been tested against the Mininet VM, which is part of our OpenFlow laboratory. Launch the Mininet VM with VMware player, VirtualBox, or another virtualization application. Log in to the Mininet VM (username: mininet, password: mininet). Determine the IP address of the server hosting the ODL controller (for example, $ ifconfig -a), and use it to start a virtual network:

      mininet@mininet-vm:~$ sudo mn --controller=remote,
ip=controller-ip --topo single,3

Mininet will connect to the ODL controller and set up a switch and three hosts connected to it, as shown in the following screenshot:

The GUI of the ODL controller after setting up the network in Mininet

When you point an OpenFlow switch at the ODL controller, it will pop up as a device waiting to be configured. The datapath ID is the unique key identifier made up of the switch MAC and an ID assigned by the controller. Mininet will use all zeroes with a 1 at the end. OpenFlow uses LLDP for topology discovery by using the packet_out instruction, in which the controller tells the forwarding element to do something like sending an LLDP discovery. Next, specify the action for the Flow Modification (FlowMod).

The following screenshot shows part of a web-based form that collects the parameter for a flow entry, which can be installed in the flow table of OpenFlow switches. Here, we choose the output port. Remember that OpenFlow only forwards what you instruct it to, so either add rules to handle 0×0806 Ethernet-type traffic for ARP broadcast requests and unicast replies or delete the Ethernet-type default IPv4 0×0800 value when you add a FlowMod.

You also need to set up a match on traffic from port 1 with an action to forward to port 2 along with the return traffic of matching port 2 with the output action of port 1. You can specify reserved ports such as normal, controller, flood, and all of the others listed in the drop-down boxes from the OpenFlow v1.0 specification. Choose an action that can be logical or physical. Logical ones tend to be named with a symbolic representation while physical is numeric. Ports are learned by the switch sending configuration information and also updated if a port or link goes down. By adding the proper flows in the flow table of S1, you can establish a path between hosts and check it by pinging those hosts in Mininet. For troubleshooting, you can use dpctl or Wireshark, which was covered earlier in this chapter and also in Chapter 3, Implementing the OpenFlow Switch:

Adding new flow entry dialog box
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset