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


Ignore:
Timestamp:
03/13/14 15:57:30 (10 years ago)
Author:
Anirudh Ramachandran
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GEC19Agenda/IntroToOFOpenDaylight/Execute

    v1 v2  
    1414</div>
    1515}}}
     16
     17== Step 1: Log into host1 and test reachability to host2 ==
     18
     19Start a ping to host2. You will see that the host is unreachable since currently no controller is running on the OVS host.
     20
     21{{{
     22[anirudhr@host1 ~]$ ping host2
     23PING host2-lan1 (10.10.1.2) 56(84) bytes of data.
     24From host1-lan0 (10.10.1.1) icmp_seq=15 Destination Host Unreachable
     25From host1-lan0 (10.10.1.1) icmp_seq=16 Destination Host Unreachable
     26From host1-lan0 (10.10.1.1) icmp_seq=17 Destination Host Unreachable
     27
     28}}}
     29
     30== Step 2: Log into OVS host and compile and run controller ==
     31
     32{{{
     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
     36
     37... lots of text ...
     38
     39[INFO] ------------------------------------------------------------------------
     40[INFO] Reactor Summary:
     41[INFO]
     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] ------------------------------------------------------------------------
     46[INFO] BUILD SUCCESS
     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] ------------------------------------------------------------------------
     52
     53}}}
     54
     55This indicates that the build went successfully.
     56
     57Open another terminal on the OVS (Note: you can use screen if you wish) and go to the built controller and run it.
     58{{{
     59anirudhr@ovs$ cd ~/SDNHub_Opendaylight_Tutorial/distribution/opendaylight/target/distribution.tutorial_L2_forwarding-1.0.0-SNAPSHOT-osgipackage/opendaylight
     60anirudhr@ovs$ ./run.sh
     61}}}
     62
     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 [[http://www.osgi.org/Specifications/HomePage 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.
     64
     65
     66== Step 3: Check reachability between hosts ==
     67
     68Once the OSGi console is fairly quiet, type:
     69
     70{{{
     71osgi> ss tut
     72"Framework is launched."
     73
     74id      State       Bundle
     75247     ACTIVE      org.sdnhub.tutorial_L2_forwarding.sdnhub.tutorial_L2_forwarding_0.5.0.SNAPSHOT
     76osgi>
     77}}}
     78
     79This indicates that the tutorial framework we just compiled has been converted into a bundle, loaded into the OSGi application, and activated.
     80
     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.
     82
     83{{{
     84[anirudhr@host1 ~]$ ping host2
     85PING host2-lan1 (10.10.1.2) 56(84) bytes of data.
     8664 bytes from host2-lan1 (10.10.1.2): icmp_req=1 ttl=64 time=12.4 ms
     8764 bytes from host2-lan1 (10.10.1.2): icmp_req=2 ttl=64 time=5.18 ms
     8864 bytes from host2-lan1 (10.10.1.2): icmp_req=3 ttl=64 time=4.80 ms
     8964 bytes from host2-lan1 (10.10.1.2): icmp_req=4 ttl=64 time=5.30 ms
     9064 bytes from host2-lan1 (10.10.1.2): icmp_req=5 ttl=64 time=4.79 ms
     9164 bytes from host2-lan1 (10.10.1.2): icmp_req=6 ttl=64 time=4.84 ms
     92}}}
     93
     94== Step 4: Convert forwarding mode from hub to a switch ==
     95
     96Open another SSH terminal to the OVS host while keeping the controller running.
     97
     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.
     99
     100{{{
     101anirudhr@ovs$ cd ~/SDNHub_Opendaylight_Tutorial/
     102}}}
     103
     104
     105Now go to the code directory
     106
     107{{{
     108anirudhr@ovs$ cd ~/SDNHub_Opendaylight_Tutorial/tutorial_L2_forwarding/src/main/java/org/opendaylight/controller/tutorial_L2_forwarding/internal/
     109anirudhr@ovs$ ls
     110Activator.java                     TutorialL2Forwarding.java                  TutorialL2Forwarding_singleswitch.solution  TutorialL2Forwarding_statelesslb.solution2
     111TutorialL2Forwarding_hub.solution  TutorialL2Forwarding_multiswitch.solution  TutorialL2Forwarding_statelesslb.solution
     112}}}
     113
     114There are only 2 Java files here - Activator.java and TutorialL2Forwarding.java. Activator.java is required for OSGi to activate the bundle. TutorialL2Forwarding.java implements the hub solution.
     115
     116Let us edit the TutorialL2Forwarding.java file to convert it to a switch mode. You can use vim, emacs, nano, etc. to edit this file.
     117
     118{{{
     119anirudhr@ovs$ vim TutorialL2Forwarding.java
     120}}}
     121
     122Navigate down to the line which says
     123
     124{{{
     125     private String function = "hub";
     126}}}
     127
     128and change that to
     129{{{
     130 private String function = "switch";
     131}}}
     132
     133Save and exit. Now we can see the power of OSGi. With the controller still running in another terminal,
     134{{{
     135$ cd ~/SDNHub_Opendaylight_Tutorial/commons/parent
     136$ mvn install -DskipTests -DskipIT
     137}}}
     138
     139Note that we're not doing a 'clean' here - we only need to update the tutorial_l2_forwarding bundle.
     140
     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
     142
     143{{{
     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
     147}}}
     148
     149Now go back to the host1 console and check your ping times
     150
     151{{{
     15264 bytes from host2-lan1 (10.10.1.2): icmp_req=29 ttl=64 time=2.44 ms
     15364 bytes from host2-lan1 (10.10.1.2): icmp_req=30 ttl=64 time=2.44 ms
     15464 bytes from host2-lan1 (10.10.1.2): icmp_req=31 ttl=64 time=2.39 ms
     15564 bytes from host2-lan1 (10.10.1.2): icmp_req=34 ttl=64 time=1984 ms
     15664 bytes from host2-lan1 (10.10.1.2): icmp_req=35 ttl=64 time=984 ms
     15764 bytes from host2-lan1 (10.10.1.2): icmp_req=36 ttl=64 time=1.07 ms
     15864 bytes from host2-lan1 (10.10.1.2): icmp_req=37 ttl=64 time=1.11 ms
     159}}}
     160
     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:
     162
     163{{{
     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
     168}}}
     169
     170
     171== Step 5: Controller GUI & Northbound Interfaces ==
     172
     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.
     174
     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 pc5.instageni.northwestern.edu:30778.
     176
     177{{{
     178yourlaptop$ ssh -L 8080:localhost:8080 anirudhr@pc5.instageni.northwestern.edu -p 30778
     179ovs $
     180}}}
     181
     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.
     183
     184=== Northbound interfaces ===
     185
     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.)
     187
     188
     189== Step 6: Code walkthrough ===
     190