Thursday, October 23, 2014

Configuring OpenDaylight Controller with Mininet

OpenDaylight with network emulated by Mininet
Once you have built OpenDaylight controller (or just chose to use the built OpenDaylight controller bundle), you may build and test the SDN solutions, with either networks or networks of virtual machines. Network emulators such as Mininet provide an effective alternative for SDN prototyping. Mininet can easily be installed from the regular repositories in Ubuntu.
$ sudo apt-get install mininet

Run OpenDaylight Controller (often as super user, for the privileges).
$ cd ~/OpenDayLight/controller/opendaylight/distribution/opendaylight/target/opendaylight
$ ./run.sh


Starting Mininet, for example, with a three-level tree topology.
The below command creates a tree topology with 3 levels.
$ sudo mn --controller=remote,ip=127.0.0.1 --topo tree,3
 
[sudo] password for pradeeban:
*** Creating network
*** Adding controller
*** Adding hosts:
h1 h2 h3 h4 h5 h6 h7 h8
*** Adding switches:
s1 s2 s3 s4 s5 s6 s7
*** Adding links:
(h1, s3) (h2, s3) (h3, s4) (h4, s4) (h5, s6) (h6, s6) (h7, s7) (h8, s7) (s1, s2) (s1, s5) (s2, s3) (s2, s4) (s5, s6) (s5, s7)
*** Configuring hosts
h1 h2 h3 h4 h5 h6 h7 h8
*** Starting controller
*** Starting 7 switches
s1 s2 s3 s4 s5 s6 s7
*** Starting CLI:
mininet>

OpenDaylight OSGi console would produce the below logs connecting to the network topology emulated by Mininet.

osgi>
osgi> 2014-10-16 11:58:07.606 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33215 is connected to the Controller
2014-10-16 11:58:08.450 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33216 is connected to the Controller
2014-10-16 11:58:08.502 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33217 is connected to the Controller
2014-10-16 11:58:08.552 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33218 is connected to the Controller
2014-10-16 11:58:08.613 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33219 is connected to the Controller
2014-10-16 11:58:08.686 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33220 is connected to the Controller
2014-10-16 11:58:08.770 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33221 is connected to the Controller
2014-10-16 11:58:08.849 WEST [ControllerI/O Thread] INFO  o.o.c.p.o.core.internal.Controller  - Switch:127.0.0.1:33222 is connected to the Controller

osgi>

The connected networked devices can be monitored from the admin console of OpenDaylight. In the default configurations, you may access the admin console in a browser from the url, http://127.0.0.1:8080, with user name and password 'admin'.


Different Topology options
Network topologies can be visualized using Mininet and OpenDaylight. While a few topologies are available out of the box with Mininet, more custom topologies can be programmed as well.

1. Single node with 5 ports 
$ sudo mn --controller=remote,ip=127.0.0.1 --topo single,5

2. Linear topology with 5 nodes
$ sudo mn --controller=remote,ip=127.0.0.1 --topo linear,5

3. Tree topology
a. 3-ary, 2 level tree

$ sudo mn --controller=remote,ip=127.0.0.1 --topo tree,depth=2,fanout=3

b. 3-ary, 4 level tree 
(This looks a bit messy)
 $ sudo mn --controller=remote,ip=127.0.0.1 --topo tree,depth=4,fanout=3

OpenDaylight wiki page mentions that only the Mininet in a VM (option #1) is tested with the OpenDaylight controller. However, as seen in this post, Mininet works well with OpenDaylight even in the Mininet installation from the packages (option #3).

17 comments:

  1. Hi Pradeeban,

    Great info..! Can you also please include a tutorial for ODL helium + mininet ? I'm having multiple issues while compiling and the GUI in helium doesnt look like the above.

    Thanks
    Ragav

    ReplyDelete
    Replies
    1. Hi Ragav,
      If you can mention what are the multiple issues you are facing (apart from the changes in the GUI, which can be expected in a major product release), I will try to see if I already know the answers. Otherwise, I will get back to this and write a post when I have some time. :)

      Regards,
      Pradeeban.

      Delete
  2. Hi Pradeeban,

    After referring to various websites, i got the karaf binary to build. But when I start it, I get the following error:

    ~/ODL/controller/karaf/opendaylight-karaf/target/assembly/bin/

    raga@raga-Ubuntu:~/ODL/controller/karaf/opendaylight-karaf/target/assembly/bin$ ./karaf

    opendaylight-user@root>ERROR: Bundle org.apache.karaf.http.core [88] Error starting mvn:org.apache.karaf.http/org.apache.karaf.http.core/3.0.1 (org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.karaf.http.core [88]: Unable to resolve 88.0: missing requirement [88.0] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0))))
    org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.karaf.http.core [88]: Unable to resolve 88.0: missing requirement [88.0] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1291)
    at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)
    at java.lang.Thread.run(Thread.java:745)
    ERROR: Bundle org.apache.karaf.http.command [89] Error starting mvn:org.apache.karaf.http/org.apache.karaf.http.command/3.0.1 (org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.karaf.http.command [89]: Unable to resolve 89.0: missing requirement [89.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.karaf.http.core)(version>=3.0.0)(!(version>=4.0.0))) [caused by: Unable to resolve 88.0: missing requirement [88.0] osgi.wiring.package; (&(osgi.wiring.package=javax.servlet)(version>=2.6.0)(!(version>=3.0.0)))])

    Also the http://127.0.0.1:8080 doesn't open.

    Thanks
    Raga

    ReplyDelete
    Replies
    1. Hi Ragav,
      So the problem is at OSGi bundle dependencies level. Nothing to do with Mininet integration. As I see from your logs, since there are unresolved dependencies in your build, ODL does not start. Hence, as it can be expected, http://127.0.0.1:8080 did not open.

      I assume you followed https://wiki.opendaylight.org/view/GettingStarted:Pulling,_Hacking,_and_Pushing_All_the_Code_from_the_CLI I will go through this and get back to you.

      Regards,
      Pradeeban.

      Delete
    2. Hi Pradeeban,

      I don't recollect going through this website. I kind of lost track of how many website I referred :)

      But it will be great if you can try to build the ODL helium + mininet and do a write-up on the same. It will be of much help for many of the folks trying to learn SDN stuff.

      Cheers
      Raga

      Delete
    3. Hi Ragav,
      Sure, I will make an update post. Many of the wiki pages and sites also refer to Hydrogen release. You should check the version or post date to be sure. ;) Will get back to you on this.

      Regards,
      Pradeeban.

      Delete
    4. Hi Ragav,
      Please have a look at the post -
      http://kkpradeeban.blogspot.com/2015/04/configuring-opendaylight-helium-with.html

      I just used the prebuilt OpenDaylight Helium for this, as the first step. It works perfectly. I am building the Helium now, and will update along the way.

      Regards,
      Pradeeban.

      Delete
  3. Also note that the DLUX interface for ODL Helium is at port 8181. So please open http://localhost:8181/dlux/index.html#/login in your browser. Not http://127.0.0.1:8080

    I suggest trying to configure Mininet with the prebuilt ODL Helium, before building from scratch. :)

    ReplyDelete
  4. Please have a look at http://kkpradeeban.blogspot.com/2015/04/building-karaf-based-opendaylight.html to build Karaf based OpenDaylight (Helium) from source.

    Regards,
    Pradeeban.

    ReplyDelete
  5. Hi Pradeeban,
    I've installed the controller OpenDaylight on the host machine (it respond on the localhost:8080 with the GUI, seems to be working).
    I instantiate a network topology using Mininet (it's a virtual machine running in my host) with the command "sudo mn --controller=remote,ip=192.168.0.39,port=6633 --topo tree,3"
    The controller GUI doesn't change, nothing appear. Seems that it doesn't see any network.
    How should I solve the issue?

    Regards
    Marcello

    ReplyDelete
    Replies
    1. Hi Marcello,
      Are you sure that the mininet has identified the OpenDaylight controller? Can you check the mininet logs (and share here, if you could not locate anything fishy)?
      Also try to refresh the OpenDaylight UI in the browser, just to see that it is just a matter of refreshing the browser page.

      Regards,
      Pradeeban.

      Delete
  6. Hi Pradeeban,
    I have installed Opendaylight controller on my Ubuntu 14.04 host (it responds on the localhost:8080 with the GUI, seems to be up and working).
    I'm using Mininet (on a guest virtual machine through VirtualBox) to run a network topology using the command "sudo mn --controller=remote,ip=192.168.0.39,port=6633 --topo tree,3". Trying to test the connectivity (using pingall command) everything works fine.
    On the controller GUI doesn't appear anything, any new network device or host is istanciated but I'm pretty sure that the controller is up because if I change the port (on the mininet command) the network istanciated lost the connectivity (and the pingall command drops every packet).
    Any advice?

    Regards
    Marcello

    ReplyDelete
  7. Hi Pradeeban,
    I've got same problem with Marcello. I've successfully run ODL Helium and open the web interface using http://localhost:8181/dlux/index.html. But when i was trying to create topology on mininet by using this command sudo mn --controller=remote,ip=192.168.190.13,port=6633 or even sudo mn --controller=remote,ip=127.0.0.1,port=6633, nothing happen in GUI.
    I am suspecting that the ODL controller doesn't communicate with mininet, however i am not sure how to trace the prob. Please help me!

    Rgds,
    Diana

    ReplyDelete
    Replies
    1. Hi Diana,

      This post is pretty old, discussing the version 1 (Hydrogen). http://kkpradeeban.blogspot.com/2015/04/configuring-opendaylight-helium-with.html talks about the Helium release, and note that current stable version is OpenDaylight Lithium. Since Lithium configuration with Mininet is similar to Helium, you should go through the post I shared.

      Regards,
      Pradeeban.

      Delete
    2. Hi Diana,
      I received your other reply. Hope you sort everything smoothly soon. If you are in a very early stage, you may instead give a try to Floodlight as well. Many of my friends (I have not used it extensively) reported that Floodlight is easier to begin with, compared to OpenDaylight. You may have a look at http://kkpradeeban.blogspot.com/2015/09/configuring-mininet-with-floodlight.html

      Just keep your options open.

      I may not be able to reply all the questions (I am just a second year PhD student). But I will reply to the best of my knowledge, as time permits.

      Regards,
      Pradeeban.

      Delete
  8. Hi Pradeeban,
    Thanks for your idea. I'll try to look on it. I have tried almost one month in order to make the ODL controller runs. Few attempts on using Lithium (latest version), however fails to log on to web interface (http:127.0.0.1:8080). Until i download the Helium. Now, i can run Controller but got problem with the communication. I just found your blog today, and i will go through it. Thanks for sharing your knowledge.


    Rgds,
    Diana

    ReplyDelete
    Replies
    1. Hi Diana,
      Your problem was because the UI of the controller is separated as another bundle named DLUX in the Karaf based OpenDaylight Lithium (that means, you will have to separately install it through the OSGi console), if you just extract the OpenDaylight controller package. Anyway, unless required for a specific reason, you may just go with the easier and working option for your thesis.

      Good luck with your work.

      Regards,
      Pradeeban.

      Delete

You are welcome to provide your opinions in the comments. Spam comments and comments with random links will be deleted.