Install flows in OpenDaylight using Java

Although I had already done a similar post for this here, guess there are a lot of folks who are not able get everything working together without the actual source code.

So I thought it might be helpful if I provide with some ready to use project/code for installing flows using java.

1. Download the source code.

Download the source code of project “OpenDaylightFlowInstall” from my GitHub here. This will give you the following:

  1. FlowManager Class – Responsible for adding/deleting flows
  2. Tester Class – Responsible for actually passing the data & calling FlowManager class to install/delete flows.
  3. ODL Class – Responsible for OpenDaylight settings.

2. Import/Setup the code

You can import the code into eclipse as a java project or setup your command. Whatever you prefer.

To import the code in eclipse use “Import as Java Project” option and make sure that your “Project –> Build Automatically” is switched on.


Also make sure that the two jars in lib folder are in classpath else compilation will fail.

3. Network & OpenDaylight Setup

I have a mininet running with one switch and two hosts which are able to ping each other & connected to OpenDaylight.



4 Running the program

If you are using eclipse, simply right clicking on the tester class and saying “Run as Java Application” should run the code. Make sure of two things:

  1. Supply the right Src/Dest IP & Node details in the

  2. Correct values in under settings.

Once you run the program, the action DROP will be installed and ping will stop working.

3 odl2

Let me know, if you get stuck & i’ll try to help.


Skeleton OpenDaylight Application for Hydrogen

We have been writing OpenDaylight applications for quite some time & I see that there are lot of samples already available, but what I most of the times want is a skeleton project which I could just import in eclipse & its good to go with writing code. So a skeleton project with all the wiring already done is my frequent need.

So I have created a skeleton project for OpenDaylight which has everything bare minimum needed to start with a OpenDaylight application.


  • You should already have OpenDaylight Hydrogen source code downloaded & working with eclipse.


  1. Pull the code of a blank/dummy hack application from my git.
  2. Copy this project under “controller/opendaylight/” where other opendaylight modules are present.
  3. Import this project into eclipse as a Maven project.
  4. Start putting in your code & you are good to go.


Once you build the above project, it will install a jar in target folder of the project. There are two ways of testing.

  1. Copy this jar manually into plugins folder of distribution.
  2. Make a entry into the parent & opendaylight root pom for this new module & rebuild.

Let me know, if you find any issues in deploying this hack or setting it up, in comments below.

OpenDaylight REST NBI Documentation

After the Helium release of OpenDaylight, I had this common problem of “How to refer REST NBI of Hydrogen release”. Wiki doesn’t work, I work with the distribution most of the time & same is with my friends.

So I thought of hosting the REST NBI Documentation of Hydrogen Release of OpenDaylight to help myself and in turn others who want to refer it.

I have put together a basic wiki type page where you can refer the NBI’s, model’s, URL’s etc of all the Hydrogen released northbound interfaces.

Please visit:


Path of a packet with OpenDaylight managing OpenFlow devices

What I have tried to stitch together in this post is how a packet flows between a OpenFlow enabled network device to the controller which processes it (& how or using which interfaces) and return back path of the packet.

You might have seen the standard OpenDaylight architecture as below already.

ODL_ArchitectureFirst, it is important to understand the above diagram briefly, to lay the expectations:

  1. OpenFlow Enabled Devices: This is the network infrastructure that is managed via OpenDaylight. In this case OpenFlow plug-in.
  2. Protocol Plugins: OpenDaylight supports these protocols for managing your network devices. One of the plugins is OpenFlow.
  3. Service Abstraction Layer (SAL): Magic! This layer does all the plumbing between the applications and the underlying plugins.
  4. Controller Platform: These are the applications that come pre-bundled with OpenDaylight to manage the network. (You can write your’s too!)
  5. Network Applications: These are applications with leverage REST NBI of OpenDaylight to build intelligence. Here is a sample Network Statistics SDN Application that I have done!

Now, below is how packet flow from network to OpenDaylight & back to network takes place:


  1. A packet arriving at a network device will be sent to the appropriate protocol plugin of OpenDaylight which is managing the switch.
  2. IPluginOutDataPacketService: The plugin (in our case OpenFlow Plug-in) will parse the packet, generate an event for Service Abtraction Layer (SAL) for further processing.
  3. IListenDataPacket: SAL will dispatch the packet to all the modules listening for DataPacket. These could be existing OpenDaylight applications like ARP Handler of your applications.
  4. IDataPacketService: Application/Module does the processing on the packet as per the business logic built and sends a PACKET_OUT using IDataPacketService.
  5. IPluginInDataPacketService: SAL recieves the DataPacket and dispatches it to the modules listening for plug-in DataPackets. In this case OpenFlow plugin.
  6. OpenFlow plugin then sends the packet back to the switch from where the packet was originated.

This is as per my understanding & if you think I have missed something or you need more details and code samples, let me know.

Network Statistics Sample SDN Application With OpenDaylight

I have been working on SDN applications for quite some time now and wanted to create a demo/sample app that could be reference or bootstrap app for people willing to explore more.

So I took some time out to come up with a idea of doing a very basic (some might call it no-brainer) SDN app for learning.

This application helps demonstrate following:
  • Demonstrate how REST API’s of a SDN Controller (in my case OpenDaylight) can be used to build a app.
  • I did not want to use any server-side programming/code to do this. This really shows the power of REST & SDN architecture.
  • Simple app that is easy to understand and replicate for someone learning this stuff.
  • Help you understand some concepts of SDN NBI that people talk about.
What is Network Statistics SDN Application ?

Bundled into a beautiful GUI, Network Statistics SDN Application runs on-top of a OpenDaylight SDN Controller and tracks port & table statistics of devices/nodes managed via OpenDaylight SDN Controller. Pure jQuery/Bootstrap and HTML based application without any server-side code.

Complete set of UI Screens developed for the application.

Things you can do in this application:

  1. Supply the URL/Username/Password of your OpenDaylight SDN Controller. Start tracking Nodes!
  2. View all the nodes managed by OpenDaylight in Network Devices section.
  3. View Port and Table statistics of each node found.

This is kind of no-brainier, but you can come up with more use cases around it etc, what this app if for? Its just for the kick-start.

If you are interested in running it:
  1. You can get the complete code from my git or if that’s too much work and you don’t intend to change code & just want to see it in action, download the file of this application from here (do “Save Link As“, this is .png, rename it to .war).
  2. Run the application either from code or by dropping the .war into tomcat/jetty/jboss (some web server)
  3. Supply your pre-installed OpenDaylight credentials and see it in action at http://localhost:8080/NetworkStatsApplication/
  • I assume that you have a mininet and OpenDaylight setup working already as that is a per-requisite to building any application.
  • I prefer you read Brent’s blog on this which I refer whenever I’m stuck at things he has written about.

How I built this application and the code walk thru I have explained it in part-2 of this post as this blog was getting too long for everything.