OpenDaylight OpenFlow Tutorial

[fancy_header3 variation=”orange”]OpenDaylight OpenFlow Tutorial[/fancy_header3]

The OpenDaylight project was announced this week and they already have working controller code up on a repositry. Under the controller hood, looks to be the OSGI framework originally forked from David Erickson’s Beacon controller. It’s a simple tutorial to help kickstart the dependencies and getting a chance to learn how instantiating OpenFlow flow rules work. This was the first time I have looked at OpenDaylight, so I was learning as I did the screencast.

[fancy_header3 variation=”orange”]OpenDaylight Installation and Setup[/fancy_header3]

If you do not want to mess with the code and just run the controller it is super simple. Download the Mininet image now managed by the On.lab. I personally prefer Mininet for dev/test.

[fancy_link link=”http://mininet.org” variation=”orange” target=”blank”]Download Mininet[/fancy_link]

Once in Mininet you can download the daily OpenDaylight build from OpenDaylight Jenkins server.

[fancy_link link=”https://jenkins.opendaylight.org/controller/job/controller-merge/lastSuccessfulBuild/artifact/opendaylight/distribution/opendaylight/target/” variation=”orange” target=”blank”]Download the OpenDaylight Daily Build[/fancy_link]

From Mininet run the following:


For those wanting to hack on code, a good place to start is building the project into your dev environment. I did a quick screencast tutorial for downloading and installing OpenDaylight on Ubuntu. For a tutorial on getting VirtualBox and Ubuntu up and going check here. Once OpenDaylight is installed, I used Mininet as a software switch so that anyone can give it a try. Mininet can be downloaded here. Once you download Mininet just import the ISO into your hypervisor.

Install the dependencies and pull down the code using git:


[fancy_header3 variation=”orange”]OpenDaylight Maven Build Error[/fancy_header3]

[info_box]If you receive any OutOfMemory resembling the following:
If your Maven build fails with a ” OutOfMemory: PermGen Space ” Re-run 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.[/info_box]

In the meantime run the following instead of “mvn clean install” and it will skip the integration tests that seem to be the source of the GC leak.

Also adjust the memory allocation to Maven temporarily with the export command or permanently in your ~/.bashrc directory.

More install help on the OpenDaylight Wiki Troubleshooting Section


In the shell, setup your JAVA_HOME ENV. It can be viewed with ‘echo $JAVA_HOME’. It will likely be undefined so define it here. Make sure Java releases synch with the ENV. Export the JAVA_HOME ENV variable. You can write it to .bashrc (located in the user account home directory) to have it be persistent through reboots and logins.



Then start OpenDaylight in all its glory with ./run from the target/distribution.opendaylight-0.1.0-SNAPSHOT-osgipackage/opendaylight directory.



Give it a couple minutes to get all of the modules loaded and point your browser to: 127.0.0.1:8080 Or you can point to another address bound to your system, just append :8080 on the end.

[fancy_header3 variation=”orange”]Adding an OpenFlow Switch To OpenDaylight[/fancy_header3]

When you point an OpenFlow switch at the OpenDaylight controller it will pop up as a device waiting to be configured. That is pretty magical in and of itself. Give it an arbitrary name. The datapath ID (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 one at the end. OpenFlow uses LLDP for topology discovery by using packet_out instruction in which the controller tells the forwarding element to do something like send an LLDP discovery.

[image_frame style=”framed_shadow” align=”center” alt=”OpenFlow Switch in OpenDaylight” height=”405″ width=”640″]http://networkstatic.net/wp-content/uploads/2013/04/OpenDaylight-OpenFlow-Switch-650×405.png[/image_frame]


[fancy_header3 variation=”orange”]Installing OpenFlow Flow Rules to the OpenDaylight Controller[/fancy_header3]

Next specify the action for the flowmod (Flow Modification). Here we choose the output port. Remember OpenFlow only forwards what you tell it to, so either add rules to handle 0x0806 Ethertype traffic for ARP broadcast requests and unicast replies or delete the Etherype default IPv4 0x0800 value when you add a flowmod. You also need to setup 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 an output action of port 1. You can specify reserved ports like normal, controller, flood and all of the others listed in the dropdown boxes from the OpenFlow v1.0 specification. The controller is OFv1.0 but I would imagine that to transition fairly quickly to OFv1.3 compliant.


[download_link link=”http://networkstatic.net/wp-content/uploads/2013/02/openflow-spec-v1.3.0.pdf” variation=”orange” target=”blank”]Download OpenFlow v1.3[/download_link]


[image_frame style=”framed_shadow” align=”center” alt=”OpenDaylight Flow Rules” height=”521″ width=”541″]hhttp://networkstatic.net/wp-content/uploads/2013/04/OpenDaylight-Match-Add-Flow.png[/image_frame]


Choose an action that can be logical or physical. Logical tend to be named with symbolic representation while physical is numeric. Ports are learned by the switch sending configuration information and also updated if a port or link go down. Port and link are two separate data structures but most controllers so far just report PORT_DOWN for both link and port, rather then LINK_DOWN for link disconnections.


[image_frame style=”framed_shadow” align=”center” alt=”OpenDaylight Flowmod Static Flow” height=”521″ width=”541″]http://networkstatic.net/wp-content/uploads/2013/04/OpenDaylight-Output-port.png[/image_frame]


For troubleshooting you can use dpctl to see flows instantiated in the datapath in Mininet. The Wireshark OpenFlow dissector maintained by Nick Bastin of BigSwitch is great for troubleshooting ant viewing OpenFlow messages.

[fancy_header3 variation=”orange”]OpenDaylight Installation and Adding Flow Rules Video[/fancy_header3]


[youtube url=”http://www.youtube.com/watch?v=hXWhgWMoNHM” width=”630″ height=”360″]


[fancy_header3 variation=”orange”]Additional OpenDaylight and OpenFlow Resources[/fancy_header3]

Excellent work by the OpenDaylight group. Since this appears to be OSGI and the ONE GUI I am guessing the blob came from Cisco. I am looking forward to all of the other contributions from those who have been spending R&E on OpenFlow dev. Kudos to the vendors on this, very impressive.

[fancy_list style=”circle_arrow” variation=”orange”]

[/fancy_list]


Thanks for stopping by!

By Brent Salisbury

I have over 20 years of experience wearing various hats from, network engineer, architect, ops and software engineer. More at Brent's LinkedIn

16 comments


  1. The OpenDaylight wiki page is pretty thin. I can’t find any references to mailing lists or forums. Trying to determine if there is a Northbound client jar that I can use to make a client application. I see sample applications, but it doesn’t mention how to build them.


  2. Hi, when adding a flow I get a response “can not add flow” I think I may have an older version mininet running. Any thoughts? Thanks


        1. Awesome, Ive done that once or twice too 🙂 Ive noticed on my lame DSL the maven builds fail about %30 of the time. I think it must be sensitive to jitter.
          Cheers,
          -Brent


  3. Great! Thank you so much.

    And now I want to write some projects to the opendaylight controller myself to get more practice. Would you please give some guide? Or are there any tutorial available to teach me how to do it? Like what kind of project should I create in Eclipse?(Plug-in project or Maven project) How should I write a project?

    ODP controller is a great stuff. I am really eager to learn more. Hoping I can get more information.


  4. Hello Brent,

    Thanks for the great post. I have a question regarding the use of OpenFlow and the Daylight controller. In this tutorial you showed how to push down flows using the GUI. How would one go about using an API provided by the controller that would allow me to take the abstracted topology (the topology that the controller deduced via LLDP from the mininet switches) and write an algorithm against it to solve for shortest path?

    I’m new to Daylight and what I’m trying to figure out is how to get programmatic access to the controller.

    Thanks in advance,

    Pablo


    1. Hi Pablo, apologies for the delay. Take a look at Fred Hsu’s blog. He documented the API wonderfully. http://fredhsu.wordpress.com/category/opendaylight/

      I think he is at Arista now so unfortunately they are still going down the single vendor proprietary path. Im hoping Fred doesn’t get censored or too busy to not be able to blog anymore. Once Hydrogen is released I will be getting on documentation much more seriously as will quite a few others fortunately.

      Respect,
      -Brent


  5. Hi Brent, I am having issues with deleting old switches in Opendaylight topology. For example
    if first bigger topology with 7 switches was loaded and later I am importing smaller one with 3 switches I can not delete any of switches from old topo (sw4-7) they are still present in GUI. Any ideas why?

Comments are closed.