13 | | * making !FlowMods. If not building a match object from a !PacketIn, make sure to not forget to invert the wildcard bit for the field you are setting. The default match is wildcarded to all. For example, to make a match object that only inspects source MAC address of an Ethernet header: |
14 | | {{{ |
15 | | (1) OFMatch m1 = new OFMatch(); |
16 | | (2) m1.setDataLayerSource(hwaddr); |
17 | | m1.setWildcards(OFMatch.OFPFW_ALL & ~OFMatch.OFPFW_DL_SRC); |
| 15 | ==== openflowj !FlowMods. ==== #fm |
| 16 | If not building a match object from a !PacketIn, make sure to not forget to invert the wildcard bit for the field you are setting. The default match is wildcarded to all. For example, to make a match object that only inspects source MAC address of an Ethernet header: |
| 17 | {{{ |
| 18 | (1) OFMatch m1 = new OFMatch(); |
| 19 | (2) m1.setDataLayerSource(hwaddr); |
| 20 | m1.setWildcards(OFMatch.OFPFW_ALL & ~OFMatch.OFPFW_DL_SRC); |
19 | | (3) flowmod.setmatch(m1); //and other params as necessary |
20 | | }}} |
21 | | 1. Create a new match object. |
22 | | 1. Add the source MAC address to match on, and turn the wildcard bit for source MAC field (OFPFW_DL_SRC) |
23 | | 1. set the !FlowMod match to the one you just created. |
| 22 | (3) flowmod.setmatch(m1); //and other params as necessary |
| 23 | }}} |
| 24 | 1. Create a new match object. |
| 25 | 1. Add the source MAC address to match on, and turn the wildcard bit for source MAC field (OFPFW_DL_SRC) |
| 26 | 1. set the !FlowMod match to the one you just created. |
25 | | * compiling oflops (cbench Controller Benchmarker). This requires an additional package, `libconfig8-dev`, in addition to the dependencies listed, so the list becomes: |
26 | | {{{ |
27 | | autoconf automake libtool libsnmp-dev libpcap-dev libconfig8-dev |
28 | | }}} |
| 28 | ==== oflops on Ubuntu. ==== #oflops |
| 29 | Compiling `oflops` (cbench Controller Benchmarker) requires an additional package, `libconfig8-dev`, in addition to the dependencies listed, so the list becomes: |
| 30 | {{{ |
| 31 | autoconf automake libtool libsnmp-dev libpcap-dev libconfig8-dev |
| 32 | }}} |
30 | | * creating arbitrary protocol data in Floodlight Ethernet class. You need to |
31 | | 1. Have a zero-argument constructor, and |
32 | | 2. add your class and Ethertype to the etherTypeClassMap !HashMap |
| 34 | More info on this tool can be found here: http://docs.projectfloodlight.org/display/floodlightcontroller/Cbench |
| 35 | |
| 36 | ==== liboftrace - building and usage. ==== #oftrace |
| 37 | This is an analyzer for .pcap format files i.e. a widely-used format for storing network traffic data used by analyzers such as `tcpdump` and `wireshark`. `liboftrace` includes two applications, ofstats and ofdump, as taken verbatim from [https://mailman.stanford.edu/pipermail/openflow-discuss/2009-April/000133.html a mailing list entry]: |
| 38 | |
| 39 | * ofstats: a program which calculates the controller processing delay, i.e., the difference in time between a packet_in message and the corresponding packet_out or flow_mod message. |
| 40 | * ofdump: a program that simply lists openflow message types with timestamps by switch/controller pair. |
| 41 | |
| 42 | Its main page is here: http://www.openflowswitch.org/wk/index.php/Liboftrace [[BR]] |
| 43 | You can get the source from a git repo: with `git clone git://github.com/capveg/oftrace.git` [[BR]] |
| 44 | To build, you need `autoconf` and `libtool`. then it's the usual "./boot.sh;./configure;make;make install". [[BR]] |
| 45 | |
| 46 | Both `ofstats` and `ofdump` follows the syntax: |
| 47 | {{{ |
| 48 | ofstats [pcap/file/location] [controller IP] [OF port] |
| 49 | }}} |
| 50 | At least `ofstats` will spew everything to stdout, so you might want to redirect it into a file. |
| 51 | |
| 52 | |
| 53 | ==== openflowj and Ethernet payloads. ==== |
| 54 | To create arbitrary protocol data in Floodlight Ethernet class, you need to |
| 55 | |
| 56 | 1. Have a zero-argument constructor, and |
| 57 | 2. add your class and Ethertype to the etherTypeClassMap !HashMap |