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.


What is Mininet? Simple explaination

Starting on to experiment or learn SDN concepts? So where do you start?

Baseline requirement to do/experiment anything in SDN is the need of network devices with OpenFlow. So, how do you go about it and how do you get it?

First way to go about it is buy real hardware from vendors who have OpenFlow enabled switches in market, which can be extremely expensive, time exhausting and bad way to experiment.

Second, you could get Mininet.

Mininet is a software emulator for prototyping a network on a single machine.

Simply put, this is all it takes:

  1. Run just one command (sudo mn) on Mininet, and you get,
  2. Network topology with hosts & devices, which is connected to
  3. A bundled SDN Controller


So, Mininet can be used to quickly create a realistic virtual network running actual kernel, switch and software application code on a personal computer.

Now, with Mininet in your hands, you can experiment with OpenFlow, play with the topology you want, learn concepts and also, build SDN applications easily.

Mininet proved to be a great kickstarter for me & opened up the space for me. There is already so much help available on Mininet but I’ll write as I find new or different things in it.