Changes between Version 1 and Version 2 of GEC19Agenda/IntroToOFOpenDaylight/Execute

03/13/14 15:57:30 (9 years ago)
Anirudh Ramachandran



  • GEC19Agenda/IntroToOFOpenDaylight/Execute

    v1 v2  
     17== Step 1: Log into host1 and test reachability to host2 ==
     19Start a ping to host2. You will see that the host is unreachable since currently no controller is running on the OVS host.
     22[anirudhr@host1 ~]$ ping host2
     23PING host2-lan1 ( 56(84) bytes of data.
     24From host1-lan0 ( icmp_seq=15 Destination Host Unreachable
     25From host1-lan0 ( icmp_seq=16 Destination Host Unreachable
     26From host1-lan0 ( icmp_seq=17 Destination Host Unreachable
     30== Step 2: Log into OVS host and compile and run controller ==
     33anirudhr@ovs:~$ cd SDNHub_Opendaylight_Tutorial/commons/parent/
     34anirudhr@ovs$ git pull origin master # update the codebase
     35anirudhr@ovs:~/SDNHub_Opendaylight_Tutorial/commons/parent$ mvn clean install -DskipTests -DskipIT
     37... lots of text ...
     39[INFO] ------------------------------------------------------------------------
     40[INFO] Reactor Summary:
     42[INFO] commons.tutorial_L2_forwarding .................... SUCCESS [  2.431 s]
     43[INFO] sdnhub.tutorial_L2_forwarding ..................... SUCCESS [  6.497 s]
     44[INFO] L2 forwarding tutorial Distribution ............... SUCCESS [ 15.481 s]
     45[INFO] ------------------------------------------------------------------------
     47[INFO] ------------------------------------------------------------------------
     48[INFO] Total time: 26.172 s
     49[INFO] Finished at: 2014-03-13T12:24:54-07:00
     50[INFO] Final Memory: 46M/111M
     51[INFO] ------------------------------------------------------------------------
     55This indicates that the build went successfully.
     57Open another terminal on the OVS (Note: you can use screen if you wish) and go to the built controller and run it.
     59anirudhr@ovs$ cd ~/SDNHub_Opendaylight_Tutorial/distribution/opendaylight/target/distribution.tutorial_L2_forwarding-1.0.0-SNAPSHOT-osgipackage/opendaylight
     60anirudhr@ovs$ ./
     63Now you will see a huge bunch of text/logs. You may see some Exceptions but you can ignore it for the moment. Once the diagnostics die down, press Enter a few times and you will see an [[ OSGi]] console. OSGi is a modular way of developing enterprise-grade applications that allows built-in plugin architecture, module versioning, dependency management, etc. Opendaylight is built as a collection of 200+ OSGi bundle, each of which can be stopped, started, uninstalled, or upgraded without affecting the rest of the controller.
     66== Step 3: Check reachability between hosts ==
     68Once the OSGi console is fairly quiet, type:
     71osgi> ss tut
     72"Framework is launched."
     74id      State       Bundle
     75247     ACTIVE      org.sdnhub.tutorial_L2_forwarding.sdnhub.tutorial_L2_forwarding_0.5.0.SNAPSHOT
     79This indicates that the tutorial framework we just compiled has been converted into a bundle, loaded into the OSGi application, and activated.
     81Now go back to the host1 console. The pings should be succeeding now. Note that the pings are taking over 3 ms, which is quite high for a one-hop topology. This is because the OVS is currently forwarding in hub mode.
     84[anirudhr@host1 ~]$ ping host2
     85PING host2-lan1 ( 56(84) bytes of data.
     8664 bytes from host2-lan1 ( icmp_req=1 ttl=64 time=12.4 ms
     8764 bytes from host2-lan1 ( icmp_req=2 ttl=64 time=5.18 ms
     8864 bytes from host2-lan1 ( icmp_req=3 ttl=64 time=4.80 ms
     8964 bytes from host2-lan1 ( icmp_req=4 ttl=64 time=5.30 ms
     9064 bytes from host2-lan1 ( icmp_req=5 ttl=64 time=4.79 ms
     9164 bytes from host2-lan1 ( icmp_req=6 ttl=64 time=4.84 ms
     94== Step 4: Convert forwarding mode from hub to a switch ==
     96Open another SSH terminal to the OVS host while keeping the controller running.
     98Currently, the tutorial code does a simple Hub mode of operation: whenever a packet is received at a switchport, it is sent to the controller. The controller tells the switch to flood the packet to every port but the incoming port. We want to convert that to a Learning switch by editing the tutorial code.
     101anirudhr@ovs$ cd ~/SDNHub_Opendaylight_Tutorial/
     105Now go to the code directory
     108anirudhr@ovs$ cd ~/SDNHub_Opendaylight_Tutorial/tutorial_L2_forwarding/src/main/java/org/opendaylight/controller/tutorial_L2_forwarding/internal/
     109anirudhr@ovs$ ls                             TutorialL2Forwarding_singleswitch.solution  TutorialL2Forwarding_statelesslb.solution2
     111TutorialL2Forwarding_hub.solution  TutorialL2Forwarding_multiswitch.solution  TutorialL2Forwarding_statelesslb.solution
     114There are only 2 Java files here - and is required for OSGi to activate the bundle. implements the hub solution.
     116Let us edit the file to convert it to a switch mode. You can use vim, emacs, nano, etc. to edit this file.
     119anirudhr@ovs$ vim
     122Navigate down to the line which says
     125     private String function = "hub";
     128and change that to
     130 private String function = "switch";
     133Save and exit. Now we can see the power of OSGi. With the controller still running in another terminal,
     135$ cd ~/SDNHub_Opendaylight_Tutorial/commons/parent
     136$ mvn install -DskipTests -DskipIT
     139Note that we're not doing a 'clean' here - we only need to update the tutorial_l2_forwarding bundle.
     141After this bundle is rebuilt, it is copied to the running controller's plugins directory, and will be ''automatically reloaded'' (how cool is that)? If you look a the OSGi console, you will see
     1442014-03-13 13:35:23.001 MDT [fileinstall-./plugins] INFO  o.o.c.t.i.TutorialL2Forwarding - Stopped
     1452014-03-13 13:35:23.086 MDT [fileinstall-./plugins] INFO  o.o.c.t.i.TutorialL2Forwarding - Initialized
     1462014-03-13 13:35:23.097 MDT [fileinstall-./plugins] INFO  o.o.c.t.i.TutorialL2Forwarding - Started
     149Now go back to the host1 console and check your ping times
     15264 bytes from host2-lan1 ( icmp_req=29 ttl=64 time=2.44 ms
     15364 bytes from host2-lan1 ( icmp_req=30 ttl=64 time=2.44 ms
     15464 bytes from host2-lan1 ( icmp_req=31 ttl=64 time=2.39 ms
     15564 bytes from host2-lan1 ( icmp_req=34 ttl=64 time=1984 ms
     15664 bytes from host2-lan1 ( icmp_req=35 ttl=64 time=984 ms
     15764 bytes from host2-lan1 ( icmp_req=36 ttl=64 time=1.07 ms
     15864 bytes from host2-lan1 ( icmp_req=37 ttl=64 time=1.11 ms
     161We can see that the code has been automatically reloaded into the controller, resulting in the steadystate ping times for hub mode (~2.5ms) dropping to ~1ms for a learning switch.  Check that the rules have been installed on the OVS switch by doing the following:
     164root@ovs:~# ovs-ofctl dump-flows br0
     165NXST_FLOW reply (xid=0x4):
     166 cookie=0x0, duration=3.965s, table=0, n_packets=3, n_bytes=294, idle_timeout=5, idle_age=0, priority=0,in_port=1,dl_dst=02:f5:07:4e:3d:99 actions=output:3
     167 cookie=0x0, duration=2.965s, table=0, n_packets=2, n_bytes=196, idle_timeout=5, idle_age=0, priority=0,in_port=3,dl_dst=02:2b:3a:2a:97:d4 actions=output:1
     171== Step 5: Controller GUI & Northbound Interfaces ==
     173The Opendaylight controller has a GUI that can also be extended for user applications. To access the GUI, we need to do SSH port forwarding.
     175Go to Flack and find out the username and the  hostname at the top of the screen when you click the 'i' button for the OVS VM. In my case, Username is anirudhr and hostname is
     178yourlaptop$ ssh -L 8080:localhost:8080 -p 30778
     179ovs $
     182Now point your browser at http://localhost:8080 and you should be able to see the ODL Web UI. Login with admin:admin and play around with the UI.
     184=== Northbound interfaces ===
     186In ODL, you are free to implement your own Northbound interfaces for your modules. Everything you see in the Web UI is read and written using the NBI implemented by various modules (TopologyManager, Hosttracker, and so on.)
     189== Step 6: Code walkthrough ===