| 1 | = [http://groups.geni.net/geni/wiki/GENIExperimenter/Tutorials/GREESC13/OpenFlowWiMAX Vertical Handoff with OpenFlow] = |
| 2 | {{{ |
| 3 | #!html |
| 4 | |
| 5 | <div style="text-align:center; width:495px; margin-left:auto; margin-right:auto;"> |
| 6 | <img id="Image-Maps_5201305222028436" |
| 7 | |
| 8 | src="http://groups.geni.net/geni/attachment/wiki/GENIExperimenter/Tutorials/Graphics/Execute.jpg?format=raw" |
| 9 | |
| 10 | usemap="#Image-Maps_5201305222028436" border="0" width="495" height="138" alt="" /> |
| 11 | <map id="_Image-Maps_5201305222028436" name="Image-Maps_5201305222028436"> |
| 12 | <area shape="rect" coords="18,18,135,110" |
| 13 | |
| 14 | href="http://groups.geni.net/geni/wiki/GENIExperimenter/Tutorials/OnlineTemplate/DesignSetup" alt="" title="" /> |
| 15 | <area shape="rect" coords="180,18,297,111" |
| 16 | |
| 17 | href="http://groups.geni.net/geni/wiki/GENIExperimenter/Tutorials/OnlineTemplate/Execute" alt="" title="" /> |
| 18 | <area shape="rect" coords="344,17,460,110" |
| 19 | |
| 20 | href="http://groups.geni.net/geni/wiki/GENIExperimenter/Tutorials/OnlineTemplate/Finish" alt="" title="" /> |
| 21 | <area shape="rect" coords="493,136,495,138" href="http://www.image-maps.com/index.php?aff=mapped_users_5201305222028436" |
| 22 | |
| 23 | alt="Image Map" title="Image Map" /> |
| 24 | </map> |
| 25 | <!-- Image map text links - End - --> |
| 26 | |
| 27 | </div> |
| 28 | }}} |
| 29 | |
| 30 | == 4. Configure and Initialize == |
| 31 | 1. In the Root Terminal, execute the '''system_setup.sh''' script: |
| 32 | {{{ |
| 33 | $ cd /root/06-03-13 |
| 34 | $ ./system_setup.sh |
| 35 | }}} |
| 36 | Please be patient; the script can take a minute to complete. It is bringing up the tap interface, starting OVS and |
| 37 | |
| 38 | creating the topology coded in the script, and configuring network access on each OVS bridge. |
| 39 | 2. In the Root Terminal, execute the '''delete_route.sh''' script: |
| 40 | {{{ |
| 41 | $ cd eth_control |
| 42 | $ ./delete_route.sh |
| 43 | Verify the new routing table has a default route via the br_tap interface no routes via the br_wimax and br_wifi |
| 44 | |
| 45 | interfaces. |
| 46 | 3. In Eclipse, run Floodlight by browsing to '''Run-->Run'''. Note the console output shown toward the bottom of the |
| 47 | |
| 48 | Eclipse window. Since OVS is running, and the '''system_setup.sh''' script pointed each OVS bridge to the Floodlight |
| 49 | |
| 50 | controller, you should see where each switch DPID connects to Floodlight. |
| 51 | 4. In the Root Terminal, open an new tab (File-->Open Tab) or switch to an unused tab. Browse to the '''/root/06-03- |
| 52 | |
| 53 | 13/eth_control''' directory. |
| 54 | 5. In this directory are some Python scripts to manually add and remove flows in the OVS bridges. These scripts |
| 55 | |
| 56 | leverage the Static Flow Pusher REST API present in the Floodlight controller. Since we have previously disabled |
| 57 | |
| 58 | Forwarding, flows added by the Static Flow Pusher will be the only flows present on the switches, and thus only traffic |
| 59 | |
| 60 | permitted by these flows will traverse the OVS network. These flows essentially take packets from a particular ingress |
| 61 | |
| 62 | port and send them out a destination port. To do this, we need to determine the port numbers Floodlight has associated |
| 63 | |
| 64 | with the ports of our OVS bridges. The Floodlight REST API is a means of obtaining data from the Floodlight controller. We |
| 65 | |
| 66 | need to send a query to Floodlight asking for what it knows about any connected switches. |
| 67 | {{{ |
| 68 | $ curl http://localhost:8080/wm/core/controller/switches/json | python -mjson.tool |
| 69 | |
| 70 | % Total % Received % Xferd Average Speed Time Time Time Current |
| 71 | Dload Upload Total Spent Left Speed |
| 72 | 100 3397 0 3397 0 0 5900 0 --:--:-- --:--:-- --:--:-- 6055 |
| 73 | [ |
| 74 | { |
| 75 | "actions": 4095, |
| 76 | "attributes": { |
| 77 | "DescriptionData": { |
| 78 | "datapathDescription": "None", |
| 79 | "hardwareDescription": "Open vSwitch", |
| 80 | "length": 1056, |
| 81 | "manufacturerDescription": "Nicira, Inc.", |
| 82 | "serialNumber": "None", |
| 83 | "softwareDescription": "1.7.1" |
| 84 | }, |
| 85 | "FastWildcards": 4194303, |
| 86 | "supportsOfppFlood": true, |
| 87 | "supportsOfppTable": true |
| 88 | }, |
| 89 | "buffers": 256, |
| 90 | "capabilities": 199, |
| 91 | "connectedSince": 1372098663566, |
| 92 | "dpid": "00:00:00:00:00:00:00:05", |
| 93 | "featuresReplyFromSwitch": { |
| 94 | "cancelled": false, |
| 95 | "done": true, |
| 96 | "transactionId": 2 |
| 97 | }, |
| 98 | "inetAddress": "/127.0.0.1:34846", |
| 99 | "ports": [ |
| 100 | { |
| 101 | "advertisedFeatures": 0, |
| 102 | "config": 0, |
| 103 | "currentFeatures": 0, |
| 104 | "hardwareAddress": "12:51:16:90:8f:ee", |
| 105 | "name": "br_tap", |
| 106 | "peerFeatures": 0, |
| 107 | "portNumber": 65534, |
| 108 | "state": 0, |
| 109 | "supportedFeatures": 0 |
| 110 | }, |
| 111 | { |
| 112 | "advertisedFeatures": 0, |
| 113 | "config": 0, |
| 114 | "currentFeatures": 0, |
| 115 | "hardwareAddress": "00:00:00:00:00:05", |
| 116 | "name": "tap-wlan0", |
| 117 | "peerFeatures": 0, |
| 118 | "portNumber": 7, |
| 119 | "state": 0, |
| 120 | "supportedFeatures": 0 |
| 121 | }, |
| 122 | { |
| 123 | "advertisedFeatures": 0, |
| 124 | "config": 0, |
| 125 | "currentFeatures": 0, |
| 126 | "hardwareAddress": "00:00:00:00:00:05", |
| 127 | "name": "tap-wimax", |
| 128 | "peerFeatures": 0, |
| 129 | "portNumber": 10, |
| 130 | "state": 0, |
| 131 | "supportedFeatures": 0 |
| 132 | }, |
| 133 | { |
| 134 | "advertisedFeatures": 0, |
| 135 | "config": 1, |
| 136 | "currentFeatures": 130, |
| 137 | "hardwareAddress": "12:51:16:90:8f:ee", |
| 138 | "name": "tap0", |
| 139 | "peerFeatures": 0, |
| 140 | "portNumber": 1, |
| 141 | "state": 1, |
| 142 | "supportedFeatures": 0 |
| 143 | } |
| 144 | ], |
| 145 | "role": null, |
| 146 | "tables": -1 |
| 147 | }, |
| 148 | { |
| 149 | "actions": 4095, |
| 150 | "attributes": { |
| 151 | "DescriptionData": { |
| 152 | "datapathDescription": "None", |
| 153 | "hardwareDescription": "Open vSwitch", |
| 154 | "length": 1056, |
| 155 | "manufacturerDescription": "Nicira, Inc.", |
| 156 | "serialNumber": "None", |
| 157 | "softwareDescription": "1.7.1" |
| 158 | }, |
| 159 | "FastWildcards": 4194303, |
| 160 | "supportsOfppFlood": true, |
| 161 | "supportsOfppTable": true |
| 162 | }, |
| 163 | "buffers": 256, |
| 164 | "capabilities": 199, |
| 165 | "connectedSince": 1372098663511, |
| 166 | "dpid": "00:00:00:00:00:00:00:02", |
| 167 | "featuresReplyFromSwitch": { |
| 168 | "cancelled": false, |
| 169 | "done": true, |
| 170 | "transactionId": 2 |
| 171 | }, |
| 172 | "inetAddress": "/127.0.0.1:34844", |
| 173 | "ports": [ |
| 174 | { |
| 175 | "advertisedFeatures": 0, |
| 176 | "config": 0, |
| 177 | "currentFeatures": 0, |
| 178 | "hardwareAddress": "00:00:00:00:00:02", |
| 179 | "name": "wlan0-tap", |
| 180 | "peerFeatures": 0, |
| 181 | "portNumber": 12, |
| 182 | "state": 0, |
| 183 | "supportedFeatures": 0 |
| 184 | }, |
| 185 | { |
| 186 | "advertisedFeatures": 0, |
| 187 | "config": 0, |
| 188 | "currentFeatures": 0, |
| 189 | "hardwareAddress": "00:0c:29:04:5c:4b", |
| 190 | "name": "br_wifi0", |
| 191 | "peerFeatures": 0, |
| 192 | "portNumber": 65534, |
| 193 | "state": 0, |
| 194 | "supportedFeatures": 0 |
| 195 | }, |
| 196 | { |
| 197 | "advertisedFeatures": 128, |
| 198 | "config": 0, |
| 199 | "currentFeatures": 160, |
| 200 | "hardwareAddress": "00:00:00:00:00:02", |
| 201 | "name": "eth1", |
| 202 | "peerFeatures": 0, |
| 203 | "portNumber": 1, |
| 204 | "state": 0, |
| 205 | "supportedFeatures": 160 |
| 206 | } |
| 207 | ], |
| 208 | "role": null, |
| 209 | "tables": -1 |
| 210 | }, |
| 211 | { |
| 212 | "actions": 4095, |
| 213 | "attributes": { |
| 214 | "DescriptionData": { |
| 215 | "datapathDescription": "None", |
| 216 | "hardwareDescription": "Open vSwitch", |
| 217 | "length": 1056, |
| 218 | "manufacturerDescription": "Nicira, Inc.", |
| 219 | "serialNumber": "None", |
| 220 | "softwareDescription": "1.7.1" |
| 221 | }, |
| 222 | "FastWildcards": 4194303, |
| 223 | "supportsOfppFlood": true, |
| 224 | "supportsOfppTable": true |
| 225 | }, |
| 226 | "buffers": 256, |
| 227 | "capabilities": 199, |
| 228 | "connectedSince": 1372098663540, |
| 229 | "dpid": "00:00:00:00:00:00:00:04", |
| 230 | "featuresReplyFromSwitch": { |
| 231 | "cancelled": false, |
| 232 | "done": true, |
| 233 | "transactionId": 2 |
| 234 | }, |
| 235 | "inetAddress": "/127.0.0.1:34845", |
| 236 | "ports": [ |
| 237 | { |
| 238 | "advertisedFeatures": 0, |
| 239 | "config": 0, |
| 240 | "currentFeatures": 0, |
| 241 | "hardwareAddress": "00:00:00:00:00:04", |
| 242 | "name": "wimax-tap", |
| 243 | "peerFeatures": 0, |
| 244 | "portNumber": 13, |
| 245 | "state": 0, |
| 246 | "supportedFeatures": 0 |
| 247 | }, |
| 248 | { |
| 249 | "advertisedFeatures": 0, |
| 250 | "config": 0, |
| 251 | "currentFeatures": 0, |
| 252 | "hardwareAddress": "00:0c:29:04:5c:55", |
| 253 | "name": "br_wimax", |
| 254 | "peerFeatures": 0, |
| 255 | "portNumber": 65534, |
| 256 | "state": 0, |
| 257 | "supportedFeatures": 0 |
| 258 | }, |
| 259 | { |
| 260 | "advertisedFeatures": 128, |
| 261 | "config": 0, |
| 262 | "currentFeatures": 160, |
| 263 | "hardwareAddress": "00:00:00:00:00:04", |
| 264 | "name": "eth2", |
| 265 | "peerFeatures": 0, |
| 266 | "portNumber": 1, |
| 267 | "state": 0, |
| 268 | "supportedFeatures": 160 |
| 269 | } |
| 270 | ], |
| 271 | "role": null, |
| 272 | "tables": -1 |
| 273 | } |
| 274 | ] |
| 275 | }}} |
| 276 | Above is sample output from the query issued. The output is organized by switch -- there should be three -- br_tap, |
| 277 | |
| 278 | br_wifi, and br_wimax. On each of these switches, you can see the ports and the names of the ports as they were given in |
| 279 | |
| 280 | '''system_setup.sh'''. Take note of the port numbers for the patch ports on each switch, as well as the port numbers for |
| 281 | |
| 282 | the interface port on each switch. |
| 283 | 6. Armed with this information, we can now create the flows we want to insert on each switch. Namely, we can specify |
| 284 | |
| 285 | and ingress and output port on br_tap, br_wifi, and br_wimax for packets traveling in each direction. In the Root |
| 286 | |
| 287 | Terminal, open the Python script '''gree13_switchWiFi.py''' with your favorite text editor. This script is designed to |
| 288 | |
| 289 | switch to the WiFi interface. |
| 290 | {{{ |
| 291 | $ gedit gree13_switchWiFi.py |
| 292 | |
| 293 | import httplib |
| 294 | import json |
| 295 | |
| 296 | class StaticFlowPusher(object): |
| 297 | |
| 298 | def __init__(self, server): |
| 299 | self.server = server |
| 300 | |
| 301 | def get(self, data): |
| 302 | ret = self.rest_call({}, 'GET') |
| 303 | return json.loads(ret[2]) |
| 304 | |
| 305 | def set(self, data): |
| 306 | ret = self.rest_call(data, 'POST') |
| 307 | return ret[0] == 200 |
| 308 | |
| 309 | def remove(self, objtype, data): |
| 310 | ret = self.rest_call(data, 'DELETE') |
| 311 | return ret[0] == 200 |
| 312 | |
| 313 | def rest_call(self, data, action): |
| 314 | path = '/wm/staticflowentrypusher/json' |
| 315 | headers = { |
| 316 | 'Content-type': 'application/json', |
| 317 | 'Accept': 'application/json', |
| 318 | } |
| 319 | body = json.dumps(data) |
| 320 | conn = httplib.HTTPConnection(self.server, 8080) |
| 321 | conn.request(action, path, body, headers) |
| 322 | response = conn.getresponse() |
| 323 | ret = (response.status, response.reason, response.read()) |
| 324 | print ret |
| 325 | conn.close() |
| 326 | return ret |
| 327 | |
| 328 | pusher = StaticFlowPusher('127.0.0.1') |
| 329 | |
| 330 | flow1 = { |
| 331 | 'switch':"00:00:00:00:00:00:00:05", |
| 332 | "name":"src-dst-ether-tap", |
| 333 | "priority":"32768", |
| 334 | "active":"true", |
| 335 | "ether-type":"0x800", |
| 336 | "ingress-port":"65534", |
| 337 | "actions":"output=10" |
| 338 | } |
| 339 | |
| 340 | flow2 = { |
| 341 | 'switch':"00:00:00:00:00:00:00:05", |
| 342 | "name":"dst-src-ether-tap", |
| 343 | "priority":"32768", |
| 344 | "active":"true", |
| 345 | "ether-type":"0x800", |
| 346 | "ingress-port":"10", |
| 347 | "actions":"output=65534" |
| 348 | } |
| 349 | |
| 350 | flow3 = { |
| 351 | 'switch':"00:00:00:00:00:00:00:05", |
| 352 | "name":"src-dst-arp-tap", |
| 353 | "priority":"32768", |
| 354 | "active":"true", |
| 355 | "ether-type":"0x806", |
| 356 | "ingress-port":"65534", |
| 357 | "actions":"output=10" |
| 358 | } |
| 359 | |
| 360 | flow4 = { |
| 361 | 'switch':"00:00:00:00:00:00:00:05", |
| 362 | "name":"dst-src-arp-tap", |
| 363 | "priority":"32768", |
| 364 | "active":"true", |
| 365 | "ether-type":"0x806", |
| 366 | "ingress-port":"10", |
| 367 | "actions":"output=65534" |
| 368 | } |
| 369 | |
| 370 | flow5 = { |
| 371 | 'switch':"00:00:00:00:00:00:00:04", |
| 372 | "name":"src-dst-ether-eth", |
| 373 | "priority":"32768", |
| 374 | "active":"true", |
| 375 | "ether-type":"0x800", |
| 376 | "ingress-port":"13", |
| 377 | "actions":"output=1" |
| 378 | } |
| 379 | |
| 380 | flow6 = { |
| 381 | 'switch':"00:00:00:00:00:00:00:04", |
| 382 | "name":"dst-src-ether-eth", |
| 383 | "priority":"32768", |
| 384 | "active":"true", |
| 385 | "ether-type":"0x800", |
| 386 | "ingress-port":"1", |
| 387 | "actions":"output=13" |
| 388 | } |
| 389 | |
| 390 | flow7 = { |
| 391 | 'switch':"00:00:00:00:00:00:00:04", |
| 392 | "name":"src-dst-arp-eth", |
| 393 | "priority":"32768", |
| 394 | "active":"true", |
| 395 | "ether-type":"0x806", |
| 396 | "ingress-port":"13", |
| 397 | "actions":"output=1" |
| 398 | } |
| 399 | |
| 400 | flow8 = { |
| 401 | 'switch':"00:00:00:00:00:00:00:04", |
| 402 | "name":"dst-src-arp-eth", |
| 403 | "priority":"32768", |
| 404 | "active":"true", |
| 405 | "ether-type":"0x806", |
| 406 | "ingress-port":"1", |
| 407 | "actions":"output=13" |
| 408 | } |
| 409 | |
| 410 | pusher.set(flow1) |
| 411 | pusher.set(flow2) |
| 412 | pusher.set(flow3) |
| 413 | pusher.set(flow4) |
| 414 | pusher.set(flow5) |
| 415 | pusher.set(flow6) |
| 416 | pusher.set(flow7) |
| 417 | pusher.set(flow8) |
| 418 | }}} |
| 419 | In this script, there are four flows for each OVS bridge -- two for outgoing packets and two for incoming packets. Why |
| 420 | |
| 421 | two? OpenFlow filters packets by not only data like MAC and IP addresses, but also by the type of packet (its |
| 422 | |
| 423 | '''ethertype'''). We need to forward all IP (ethertype=0x800) and all ARP (ethertype=0x806) packets in each direction in |
| 424 | |
| 425 | order to achieve IP connectivity between the tap interface and the outside world. What we want to do is look for packets |
| 426 | |
| 427 | from the port br_tap is assigned to, then send them out the tap-wifi port number (the patch port connected to the br_wifi |
| 428 | |
| 429 | OVS bridge), then when they arrive at br_wifi, look for them on the wifi-tap port number and send them out the br_wifi |
| 430 | |
| 431 | port number. Then we want to implement the same for the opposite direction. Examine the script and modify it as necessary |
| 432 | |
| 433 | to allow packets to travel from the br_tap interface, to the br_wifi interface, and out to the host-only network. |
| 434 | 7. Save the '''gree13_switchWiFi.py''' script. |
| 435 | 8. Repeat and save for '''gree13_switchWiMAX.py'''. Use the port numbers noted in the json output to complete the |
| 436 | |
| 437 | flows needed to send packets from the br_tap interface out the br_wimax interface. |
| 438 | |
| 439 | |
| 440 | == 5. Execute Experiment == |
| 441 | 1. Run the WiFi switching script: |
| 442 | {{{ |
| 443 | $ python gree13_switchWiFi.py |
| 444 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 445 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 446 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 447 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 448 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 449 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 450 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 451 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 452 | }}} |
| 453 | 2. In another unused tab in the Root Terminal, run ping to the gateway IP. The default route is set to br_tap and IP |
| 454 | |
| 455 | forwarding is disabled -- this forces all packets into the OVS network, where the interface switching is handled by |
| 456 | |
| 457 | Floodlight and the Static Flow Pusher. |
| 458 | {{{ |
| 459 | $ ping 192.168.193.1 |
| 460 | }}} |
| 461 | 3. Leave ping running and run the WiMAX switching script in another Root Terminal tab: |
| 462 | {{{ |
| 463 | $ python gree13_switchWiMAX.py |
| 464 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 465 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 466 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 467 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 468 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 469 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 470 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 471 | (200, 'OK', '{"status" : "Entry pushed"}') |
| 472 | }}} |
| 473 | |
| 474 | == 6. Analyze Experiment == |
| 475 | |
| 476 | 1. Notice the delay introduced in the ping responses. When we configured and ran the '''system_setup.sh''' script, we |
| 477 | |
| 478 | introduced a simulated delay to the "WiMAX" interface. This confirms the switch is occuring. Before and after the switch, |
| 479 | |
| 480 | the source IP remains the br_tap IP, and the destination IP remains the gateway IP. |
| 481 | 2. Congratuations! You have just completed a simulated vertical Layer-2 handoff! This project is being developed and |
| 482 | |
| 483 | tested using actual GENI WiFi and WiMAX testbed at Clemson University. You can give it a try yourself outside the VM using |
| 484 | |
| 485 | whatever physical interfaces you have available. |
| 486 | |
| 487 | |
| 488 | ---- |
| 489 | |
| 490 | = [wiki:GENIExperimenter/Tutorials/GREESC13/OpenFlowWiMAX Introduction] = |
| 491 | = [wiki:GENIExperimenter/Tutorials/GREESC13/OpenFlowWiMAX/Finish Next: Finish] = |