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.