| | 1 | = *Draft* An Intro to OpenFlow@ORBIT = |
| | 2 | This page is meant to get you up and running quickly with !OpenFlow-related experiments/development on the ORBIT testbeds. |
| | 3 | == Node Image(s) == |
| | 4 | To make things easier, we have images pre-installed with the Floodlight controller and several other potentially useful tools, including: |
| | 5 | * [http://mininet.org/ mininet] : !OpenFlow network prototyping tool/emulation |
| | 6 | * [http://docs.projectfloodlight.org/display/floodlightcontroller/Cbench+(New) cbench] : Controller benchmarking tool |
| | 7 | * [http://www.openflow.org/wk/index.php/Liboftrace liboftrace] : !OpenFlow message parser/analyzer for pcap files |
| | 8 | |
| | 9 | For people interested in installing these tools, they can visit the links above, or go to [#install Section] for a concise summary of each. |
| | 10 | |
| | 11 | == Installation == |
| | 12 | The following are the installation steps and basic usage for the software that are found on the image. For more information, refer to their respective pages; Floodlight and Mininet in particular have very thorough docs. |
| | 13 | |
| | 14 | [#floodlight Floodlight][[BR]] |
| | 15 | [#mn Mininet][[BR]] |
| | 16 | [#cbench CBench] [[BR]] |
| | 17 | [#loft liboftrace] [[BR]] |
| | 18 | |
| | 19 | === Floodlight === #floodlight |
| | 20 | docs: http://docs.projectfloodlight.org/display/floodlightcontroller/Floodlight+Documentation [[BR]] |
| | 21 | |
| | 22 | For the most part the following is a repetition of some of the things there. Truth be told, if you plan to modify/develop on Floodlight it is better to just install it on a local machine where you can use eclipse (either that, or you can try to X11 forward, but that doesn't always go well). |
| | 23 | ==== dependencies ==== |
| | 24 | {{{ |
| | 25 | sudo apt-get install git-core build-essential default-jdk ant python-dev eclipse |
| | 26 | }}} |
| | 27 | ==== installation ==== |
| | 28 | The following fetches and builds the latest stable release: |
| | 29 | {{{ |
| | 30 | git clone git://github.com/floodlight/floodlight.git |
| | 31 | cd floodlight |
| | 32 | git checkout fl-last-passed-build |
| | 33 | ant |
| | 34 | }}} |
| | 35 | To import as a project on Eclipse, run the following while in the same directory: |
| | 36 | {{{ |
| | 37 | ant eclipse |
| | 38 | }}} |
| | 39 | ==== run ==== |
| | 40 | Assuming everything worked out: |
| | 41 | {{{ |
| | 42 | java -jar target/floodlight.jar |
| | 43 | }}} |
| | 44 | from the floodlight/ directory launches Floodlight. It will output a bunch of messages while it searches for, loads, and initializes modules. You can refer to the output attached below for what it should look like - there may be warnings, but they should be harmless. |
| | 45 | |
| | 46 | This command also launches in the foreground, so you can either launch it in a terminal multiplexer like `screen` or `tmux`, or with a `1>logfile 2>&1 &` tacked to the end. The former is probably recommended. |
| | 47 | ==== development ==== |
| | 48 | Tutorials and other information can be found here: http://docs.projectfloodlight.org/display/floodlightcontroller/For+Developers |
| | 49 | |
| | 50 | === Mininet === #mn |
| | 51 | website: http://mininet.org/ [[BR]] |
| | 52 | It is highly recommended to run trough the docs, especially the following: |
| | 53 | * FAQs: https://github.com/mininet/mininet/wiki/FAQ |
| | 54 | * Getting Started: http://mininet.org/download/ Getting Started |
| | 55 | * Sample Workflow: http://mininet.org/sample-workflow/ Sample Workflow |
| | 56 | * Walkthrough: http://mininet.org/walkthrough/ |
| | 57 | |
| | 58 | If you post to the list especially before you read the FAQ's, you will likely just be asked if you have checked them. |
| | 59 | |
| | 60 | ==== installation/build ==== |
| | 61 | The [https://github.com/mininet/mininet/downloads/ VM] is the recommended way to run Mininet on your machine. [[BR]] |
| | 62 | The following is for a native install (as on the node image). |
| | 63 | |
| | 64 | The method differs for different versions of Ubuntu. The following is for 12.04. For others, refer to [http://www.projectfloodlight.org/getting-started/ this] page. |
| | 65 | The following also takes care of the dependencies. |
| | 66 | {{{ |
| | 67 | sudo apt-get install mininet/precise-backports |
| | 68 | }}} |
| | 69 | Then disable `ovs-controller`: |
| | 70 | {{{ |
| | 71 | sudo service openvswitch-controller stop |
| | 72 | sudo update-rc.d openvswitch-controller disable |
| | 73 | }}} |
| | 74 | You may also need to start open Vswitch: |
| | 75 | {{{ |
| | 76 | sudo service openvswitch-switch start |
| | 77 | }}} |
| | 78 | You can verify that it works with the following: |
| | 79 | {{{ |
| | 80 | sudo mn --test pingall |
| | 81 | }}} |
| | 82 | This sets up a 2-host, 1-switch topology and pings between the hosts. The output looks similar to this: |
| | 83 | {{{ |
| | 84 | *** Creating network |
| | 85 | *** Adding controller |
| | 86 | *** Adding hosts: |
| | 87 | h1 h2 |
| | 88 | *** Adding switches: |
| | 89 | s1 |
| | 90 | *** Adding links: |
| | 91 | (h1, s1) (h2, s1) |
| | 92 | *** Configuring hosts |
| | 93 | h1 h2 |
| | 94 | *** Starting controller |
| | 95 | *** Starting 1 switches |
| | 96 | s1 |
| | 97 | *** Ping: testing ping reachability |
| | 98 | h1 -> h2 |
| | 99 | h2 -> h1 |
| | 100 | *** Results: 0% dropped (0/2 lost) |
| | 101 | *** Stopping 2 hosts |
| | 102 | h1 h2 |
| | 103 | *** Stopping 1 switches |
| | 104 | s1 ... |
| | 105 | *** Stopping 1 controllers |
| | 106 | c0 |
| | 107 | *** Done |
| | 108 | completed in 0.460 seconds |
| | 109 | }}} |
| | 110 | ==== run ==== |
| | 111 | There are many flags and options associated with launching Mininet. `mn --help` will display them. [[BR]] |
| | 112 | For example, to start the same topology as the pingall test, but with a controller running separately from Mininet: |
| | 113 | {{{ |
| | 114 | # mn --topo=single,2 --controller=remote,ip=10.18.1.1 --mac |
| | 115 | *** Creating network |
| | 116 | *** Adding controller |
| | 117 | *** Adding hosts: |
| | 118 | h1 h2 |
| | 119 | *** Adding switches: |
| | 120 | s1 |
| | 121 | *** Adding links: |
| | 122 | (h1, s1) (h2, s1) |
| | 123 | *** Configuring hosts |
| | 124 | h1 h2 |
| | 125 | *** Starting controller |
| | 126 | *** Starting 1 switches |
| | 127 | s1 |
| | 128 | *** Starting CLI: |
| | 129 | mininet> |
| | 130 | }}} |
| | 131 | * --topo=single,2 : one switch with two hosts |
| | 132 | * --controller=remote,ip=10.18.1.1 : controller at 10.18.1.1 |
| | 133 | * --mac : non-random MAC addresses |
| | 134 | Some useful ones are: |
| | 135 | * controller external to Mininet, at IP addr and port p: |
| | 136 | {{{ |
| | 137 | --controller=remote,ip=[addr],port=[p] |
| | 138 | }}} |
| | 139 | * non-random host MAC addresses (starting at 00:00:00:00:00:01 for h1) |
| | 140 | {{{ |
| | 141 | --mac |
| | 142 | }}} |
| | 143 | ==== usage ==== |
| | 144 | You can find available commands for the command line by typing `?` at the prompt. `exit` quits Mininet. [[BR]] |
| | 145 | Some basic examples: |
| | 146 | * display topology: |
| | 147 | {{{ |
| | 148 | mininet> net |
| | 149 | c0 |
| | 150 | s1 lo: s1-eth1:h1-eth0 s1-eth2:h2-eth0 |
| | 151 | h1 h1-eth0:s1-eth1 |
| | 152 | h2 h2-eth0:s1-eth2 |
| | 153 | }}} |
| | 154 | * display host network info: |
| | 155 | {{{ |
| | 156 | mininet> h1 ifconfig |
| | 157 | h1-eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:01 |
| | 158 | inet addr:10.0.0.1 Bcast:10.255.255.255 Mask:255.0.0.0 |
| | 159 | inet6 addr: fe80::200:ff:fe00:1/64 Scope:Link |
| | 160 | UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 |
| | 161 | RX packets:135 errors:0 dropped:124 overruns:0 frame:0 |
| | 162 | TX packets:7 errors:0 dropped:0 overruns:0 carrier:0 |
| | 163 | collisions:0 txqueuelen:1000 |
| | 164 | RX bytes:8906 (8.9 KB) TX bytes:558 (558.0 B) |
| | 165 | |
| | 166 | lo Link encap:Local Loopback |
| | 167 | inet addr:127.0.0.1 Mask:255.0.0.0 |
| | 168 | inet6 addr: ::1/128 Scope:Host |
| | 169 | UP LOOPBACK RUNNING MTU:16436 Metric:1 |
| | 170 | RX packets:0 errors:0 dropped:0 overruns:0 frame:0 |
| | 171 | TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 |
| | 172 | collisions:0 txqueuelen:0 |
| | 173 | RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) |
| | 174 | }}} |
| | 175 | * ping host 1 from host 2 |
| | 176 | {{{ |
| | 177 | mininet> h2 ping h1 |
| | 178 | PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. |
| | 179 | 64 bytes from 10.0.0.1: icmp_req=1 ttl=64 time=10.0 ms |
| | 180 | ^C |
| | 181 | --- 10.0.0.1 ping statistics --- |
| | 182 | 1 packets transmitted, 1 received, 0% packet loss, time 0ms |
| | 183 | rtt min/avg/max/mdev = 10.026/10.026/10.026/0.000 ms |
| | 184 | }}} |
| | 185 | ==== scripting ==== |
| | 186 | Mininet has a Python API, whose docs can be found online: http://mininet.org/api/ [[BR]] |
| | 187 | Examples can also be found here: https://github.com/mininet/mininet/tree/master/examples |
| | 188 | |
| | 189 | Once you write a script, you can run it as a script: |
| | 190 | {{{ |
| | 191 | python mn_script.py |
| | 192 | }}} |
| | 193 | |
| | 194 | === Cbench === #cbench |
| | 195 | website: http://docs.projectfloodlight.org/display/floodlightcontroller/Cbench+(New) |
| | 196 | |
| | 197 | ==== dependencies ==== |
| | 198 | {{{ |
| | 199 | sudo apt-get install autoconf automake libtool libsnmp-dev libpcap-dev |
| | 200 | }}} |
| | 201 | ==== installation/build ==== |
| | 202 | {{{ |
| | 203 | git clone git://gitosis.stanford.edu/openflow.git |
| | 204 | cd openflow; git checkout -b mybranch origin/release/1.0.0 |
| | 205 | git clone git://gitosis.stanford.edu/oflops.git |
| | 206 | git submodule init && git submodule update |
| | 207 | wget http://hyperrealm.com/libconfig/libconfig-1.4.9.tar.gz |
| | 208 | tar -xvzf libconfig-1.4.9.tar.gz |
| | 209 | cd libconfig-1.4.9 |
| | 210 | ./configure |
| | 211 | sudo make && sudo make install |
| | 212 | #cd ../oflops/netfpga-packet-generator-c-library/ |
| | 213 | #./autogen.sh && ./configure && make |
| | 214 | sh ./boot.sh ; ./configure --with-openflow-src-dir=${OF_PATH}/openflow/ |
| | 215 | make install |
| | 216 | }}} |
| | 217 | |
| | 218 | ==== run ==== |
| | 219 | Run from the cbench directory under oflops: |
| | 220 | {{{ |
| | 221 | cd cbench |
| | 222 | cbench -c localhost -p 6633 -m 10000 -l 3 -s 16 -M 10 -t |
| | 223 | }}} |
| | 224 | * -c localhost : controller at loopback |
| | 225 | * -p 6633 : controller listaning at port 6633 |
| | 226 | * -m 10000 : 10000 ms (10 sec) per test |
| | 227 | * -l 3 : 3 loops(trials) per test |
| | 228 | * -s 16 : 16 emulated switches |
| | 229 | * -M 10 : 10 unique MAC addresses(hosts) per switch |
| | 230 | * -t : throughput testing |
| | 231 | for the complete list, use the `-h` flag. |
| | 232 | |
| | 233 | The output for the above command looks like this: |
| | 234 | {{{ |
| | 235 | cbench: controller benchmarking tool |
| | 236 | running in mode 'throughput' |
| | 237 | connecting to controller at localhost:6633 |
| | 238 | faking 16 switches offset 1 :: 3 tests each; 10000 ms per test |
| | 239 | with 10 unique source MACs per switch |
| | 240 | learning destination mac addresses before the test |
| | 241 | starting test with 0 ms delay after features_reply |
| | 242 | ignoring first 1 "warmup" and last 0 "cooldown" loops |
| | 243 | connection delay of 0ms per 1 switch(es) |
| | 244 | debugging info is off |
| | 245 | 16:53:14.384 16 switches: flows/sec: 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 18 total = 0.028796 per ms |
| | 246 | 16:53:24.485 16 switches: flows/sec: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 total = 0.031999 per ms |
| | 247 | 16:53:34.590 16 switches: flows/sec: 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 24 total = 0.038380 per ms |
| | 248 | RESULT: 16 switches 2 tests min/max/avg/stdev = 32.00/38.38/35.19/3.19 responses/s |
| | 249 | }}} |
| | 250 | |
| | 251 | === liboftrace (ofdump/ofstats) === #loft |
| | 252 | docs: [[BR]] |
| | 253 | https://github.com/capveg/oftrace/blob/master/README [[BR]] |
| | 254 | http://www.openflow.org/wk/index.php/Liboftrace |
| | 255 | ==== dependencies ==== |
| | 256 | {{{ |
| | 257 | sudo apt-get install libpcap-dev swig libssl-dev |
| | 258 | }}} |
| | 259 | ==== installation/build ==== |
| | 260 | {{{ |
| | 261 | git clone git://github.com/capveg/oftrace.git |
| | 262 | cd oftrace |
| | 263 | ./boot.sh |
| | 264 | ./configure --with-openflow-src-dir=${OF_PATH}/openflow/ |
| | 265 | make && make install |
| | 266 | }}} |
| | 267 | ==== use ==== |