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:
- FlowManager Class – Responsible for adding/deleting flows
- Tester Class – Responsible for actually passing the data & calling FlowManager class to install/delete flows.
- 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:
Supply the right Src/Dest IP & Node details in the Tester.java
Correct values in ODL.java under settings.
Once you run the program, the action DROP will be installed and ping will stop working.
Let me know, if you get stuck & i’ll try to help.
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.
- Pull the code of a blank/dummy hack application from my git.
- Copy this project under “controller/opendaylight/” where other opendaylight modules are present.
- Import this project into eclipse as a Maven project.
- 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.
- Copy this jar manually into plugins folder of distribution.
- 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.
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: http://opendaylight.nbi.sdngeeks.com
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.
First, it is important to understand the above diagram briefly, to lay the expectations:
- OpenFlow Enabled Devices: This is the network infrastructure that is managed via OpenDaylight. In this case OpenFlow plug-in.
- Protocol Plugins: OpenDaylight supports these protocols for managing your network devices. One of the plugins is OpenFlow.
- Service Abstraction Layer (SAL): Magic! This layer does all the plumbing between the applications and the underlying plugins.
- Controller Platform: These are the applications that come pre-bundled with OpenDaylight to manage the network. (You can write your’s too!)
- 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:
- A packet arriving at a network device will be sent to the appropriate protocol plugin of OpenDaylight which is managing the switch.
- IPluginOutDataPacketService: The plugin (in our case OpenFlow Plug-in) will parse the packet, generate an event for Service Abtraction Layer (SAL) for further processing.
- 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.
- IDataPacketService: Application/Module does the processing on the packet as per the business logic built and sends a PACKET_OUT using IDataPacketService.
- IPluginInDataPacketService: SAL recieves the DataPacket and dispatches it to the modules listening for plug-in DataPackets. In this case OpenFlow plugin.
- 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.
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.
Network devices fecthed from SDN Controller
Port statistics of the selected device
Table statistics of the selected device
Complete statistics of all the devices
Things you can do in this application:
- Supply the URL/Username/Password of your OpenDaylight SDN Controller. Start tracking Nodes!
- View all the nodes managed by OpenDaylight in Network Devices section.
- 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:
- 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).
- Run the application either from code or by dropping the .war into tomcat/jetty/jboss (some web server)
- 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.