Changes between Version 4 and Version 5 of Internal/OpenFlow/Controllers/BigSwitch


Ignore:
Timestamp:
May 16, 2011, 12:09:39 AM (13 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/Controllers/BigSwitch

    v4 v5  
    1515once configured, you should be able to ssh to it from the outside.
    1616
    17 == BigOS CLI ==
    18 This is the main interface to the Big Switch controller. From here, you can query for various information, such as controller state and the switches connected to it.
    19 === Logging in ===
     17== I BigOS CLI ==
     18This is the main interface to the Big Switch controller. From here, you can query for / set various !OpenFlow-related parameters such as controller state and the switches connected to it.
     19=== 1.1 Logging in ===
    2020From gw.orbit-lab.org, ssh to `kvm-big` as user `admin`, password ''native101''. You should see something like below:
    2121{{{
     
    2727172.16.0.14>
    2828}}}
    29 The caret is the prompt for the CLI, which follows syntax similar to Cisco IOS. To see available commands, just type "?". For example, to see the list of !OpenFlow switches connected to the controller, type `show switch`:
     29=== 1.2 Information Lookup ===
     30The caret is the prompt for the CLI, which follows syntax similar to Cisco IOS. To see available commands, just type "?" or hit tab. As with regular switch CLIs, the controller understands command completion. For example, to see the list of !OpenFlow switches connected to the controller, type `show switch`:
    3031{{{
    3132172.16.0.14> show switch
     
    4748}}}
    4849Here, we have switched to the context of a switch whose DPID is 00:00:00:10:10:22:32:32, in order to look up general information about it.
     50=== 1.3 Configuration ===
     51Configuration of the controller-managed !OpenFlow network is done from the configuration prompt. To enter the prompt, first enter enabled mode (via command `enable`) and then enter configuration mode via `configure`.
     52{{{
     53kvm-big> en
     54kvm-big# config
     55kvm-big(config)#
     56}}}
     57As with IOS, various contexts exist for the various configurable elements. For example, to configure a switch, you would enter a particular switch's context:
     58{{{
     59kvm-big(config)# switch 00:00:00:10:10:25:32:35
     60kvm-big(config-switch)#
     61}}}
     62Where the colon-and-hex value is the switch's DPID. Issuing a config command for a nonexistent element (e.g. switch DPID or a flow) would create a new !OpenFlow element. Also, unlike in the case of IOS, regular mode commands may be run from here unmodified ^1^. All available parameters for a certain context can, again, be found by hitting tab or with `?`.
     63== II The REST API ==
     64In addition to the CLI, a scripting-friendly REST API is available through debug mode. This is a separate process form the CLI
    4965
    50 == The REST API ==
    51 Flow manipulation is done by logging onto the controller, entering debug mode, and issuing HTTP control messages (e.g. PUT, GET, DELETE) using `curl`. Here we'll describe how to use the REST API through an example based on the REST documents (linked at the bottom of the page) and e-mail exchanges.
    52 === Some prep work ===
     66Flow manipulation from the API is done by issuing HTTP control messages (e.g. PUT, GET, DELETE) using `curl`. The API will respond with JSON format data. Here we'll describe how to use the REST API through an example based on the REST documents (linked at the bottom of the page) and e-mail exchanges.
     67=== 2.1 Logging on, some prep work ===
    5368 1. ''Enter debug mode''. In order to use the REST API, you must be at the Linux shell. Type "debug bash" to switch out of the CLI.
    5469{{{
     
    6176}}}
    6277 2. ''open port 8000''. Allow connections to port 8000 with the command `sudo ufw allow 8000`. You'll be using this port to talk to the controller using `curl`.   
     78=== 2.2 Using `curl` ===
     79`curl` is a data transfer tool supporting a menagerie of protocols including HTTP. FTP, SCP, and the likes. It allows both pushing and pulling of data to/from a server. In our case, `curl` allows us to manipulate the controller through HTTP without worrying about the details of the protocol.
     80==== 2.2.1 HTTP queries ==== 
     81Underneath, HTTP GET messages are used to query the controller. Superficially, the syntax is:
    6382 
     83 `curl [-v] http://localhost:8000/rest/parameter/`
     84
     85Where parameter is `switch`, `controller-node`, and other !OpenFlow network elements. the `-v` flag sets the session to debug mode, in which you see the HTTP chatter that goes on in the back. For example, to pull information about the current controller:
     86{{{
     87bsn@kvm-big:~$ curl http://localhost:8000/rest/controller-node/
     88[{"active": true, "last-startup": "2011-04-19 00:59:07.725000", "listen-address": "10.0.2.15", "listen-
     89port": 6633, "id": "10.0.2.15:6633"}]bsn@kvm-big:~$
     90}}}
     91The things between the square brackets is the actual data; the prompt gets concatenated to the output, which is somewhat awkward but doesn't cause any issues.
     92
     93Some query contexts may have multiple results, e.g. for `switch`, which lists all !OpenFlow switches the controller is aware of:
     94{{{
     95bsn@kvm-big:~$ curl http://localhost:8000/rest/switch/
     96[{"tables": 3, "socket-address": "/172.16.0.241:35080", "dpid": "00:00:00:00:00:00:00:01", "capabilities":
     9771, "controller": "172.16.0.14:6633", "actions": 2049, "ip-address": "172.16.0.241", "connected-since":
     98"2011-05-13 18:21:21.141000", "active": true, "buffers": 256}, {"tables": 2, "socket-address":
     99"/172.16.0.253:62310", "dpid": "00:00:00:00:08:21:56:9d", "capabilities": 199, "controller":
     100"172.16.0.14:6633", "actions": 4095, "ip-address": "172.16.0.253", "connected-since": "2011-05-15
     10101:23:13.030000", "active": false, "buffers": 256}, {"tables": 3, "socket-address": "/172.16.20.1:45364",
     102"dpid": "00:00:00:10:10:00:80:01", "capabilities": 71, "controller": "172.16.0.14:6633", "actions": 2063,
     103"ip-address": "172.16.20.1", "connected-since": "2011-05-08 17:52:31.214000", "active": false, "buffers":
     104256}, {"tables": 2, "socket-address": "/172.16.0.253:62301", "dpid": "00:00:00:10:10:22:32:32",
     105"capabilities": 199, "controller": "172.16.0.14:6633", "actions": 4095, "ip-address": "172.16.0.253",
     106"connected-since": "2011-05-15 18:10:25.891000", "active": true, "buffers": 256}, {"tables": 2, "socket-
     107address": "/172.16.0.253:62302", "dpid": "00:00:00:10:10:25:32:35", "capabilities": 199, "controller":
     108"172.16.0.14:6633", "actions": 4095, "ip-address": "172.16.0.253", "connected-since": "2011-05-15
     10918:10:25.886000", "active": true, "buffers": 256}, {"tables": 3, "socket-address": "/172.16.20.1:49217",
     110"dpid": "00:00:00:23:20:21:f8:4d", "capabilities": 71, "controller": "172.16.0.14:6633", "actions": 2063,
     111"ip-address": "172.16.20.1", "connected-since": "2011-05-08 17:33:43.433000", "active": false, "buffers":
     112256}]bsn@kvm-big:~$
     113}}}
     114For such cases, information about each element is separated by curly braces. To pull information about just one switch, for example, you can query for something "one directory down":
     115{{{
     116bsn@kvm-big:~$ curl http://localhost:8000/rest/switch/00:00:00:10:10:25:32:35/ {"tables": 2, "socket-
     117address": "/172.16.0.253:62302", "dpid": "00:00:00:10:10:25:32:35", "capabilities": 199, "controller":
     118"172.16.0.14:6633", "actions": 4095, "ip-address": "172.16.0.253", "connected-since": "2011-05-15 18:10
     119:25.886000", "active": true, "buffers": 256}
     120}}}
     121==== 2.2.2 Modifying flows (HTTP PUT) ====
     122
     123
     124
     125^1 Last time I played with IOS I remember you can do `run <full command>` in order to run out-of-context commands. But, I'm not a CCNA so I might be lying.^