OpenDaylight OpenFlow Tutorial

OpenDaylight OpenFlow Tutorial

OpenDaylight Logo Sm

OpenDaylight OpenFlow Tutorial

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.

OpenDaylight Installation and Setup

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.

Download Mininet →

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

Download the OpenDaylight Daily Build →

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:

OpenDaylight Maven Build Error
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.

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: Or you can point to another address bound to your system, just append :8080 on the end.

Adding an OpenFlow Switch To OpenDaylight

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.

OpenFlow Switch in OpenDaylight

Installing OpenFlow Flow Rules to the OpenDaylight Controller

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 OpenFlow v1.3

OpenDaylight Flow Rules

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.

OpenDaylight Flowmod Static Flow

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.

OpenDaylight Installation and Adding Flow Rules Video

Additional OpenDaylight and OpenFlow Resources

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.

Thanks for stopping by!

About the Author

Brent SalisburyI have over 15 years of experience wearing various hats from, network engineer, architect, devops and software engineer. I currently have the pleasure of working at the company that develops my favorite software I have ever used, Docker. My comments here are my personal thoughts and opinions. More at Brent's BioView all posts by Brent Salisbury →

1 year 6 months ago

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?

Pablo Lucena
1 year 9 months ago

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,


1 year 10 months ago

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.

2 years 1 month ago

This is the best resource for people who are interested in SDN!! Thank you!

2 years 2 months ago

Thanks Brent :-)

2 years 5 months ago


Great Job as usual. Just to build off of what you have done. Here is a link to my blog post with building OpenDaylight on windows. Since I reference this post.