Changes between Version 7 and Version 8 of Internal/OpenFlow/miscOF


Ignore:
Timestamp:
Jun 6, 2013, 7:10:19 AM (11 years ago)
Author:
akoshibe
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Internal/OpenFlow/miscOF

    v7 v8  
    33This page documents various odds-and-ends regarding !OpenFlow and related platforms, tools, and whatnot.
    44
    5  * Using xterm with mininet hosts. You can background then by doing:
    6    {{{
    7    mininet> h1 xterm &
    8    }}}
    9    this allows you to spawn a terminal for a switch, from which you can, say, sniff packets using wireshark.
     5==== mininet + xterm. ==== #mnxterm
     6You can spawn and background terminals by doing:
     7{{{
     8mininet> h1 xterm &
     9}}}
     10this allows you to spawn a terminal for a switch, from which you can, say, sniff packets using `wireshark`.
    1011
    11  * A good way to track packets and transactions between datapath and controller is via buffer Id for switch-initiated conversations, and by XID for controller-initiated transactions. A caveat is that the buffer ID is only applicable to a subset of messages e.g. !PacketIns and !PacketOuts. A -1 buffer ID indicates a controller-generated packet (e.g. by a flow pushing tool or via a REST API for static flows). 
     12==== Tracking OF packets. ==== #trackof
     13A good way to track packets and transactions between datapath and controller is via buffer Id for switch-initiated conversations, and by XID for controller-initiated transactions. A caveat is that the buffer ID is only applicable to a subset of messages e.g. !PacketIns and !PacketOuts. A -1 buffer ID indicates a controller-generated packet (e.g. by a flow pushing tool or via a REST API for static flows). 
    1214
    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
     16If 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);
    1821
    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}}}
     241. Create a new match object.
     251. Add the source MAC address to match on, and turn the wildcard bit for source MAC field (OFPFW_DL_SRC)
     261. set the !FlowMod match to the one you just created. 
    2427   
    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
     29Compiling `oflops` (cbench Controller Benchmarker) requires an additional package, `libconfig8-dev`, in addition to the dependencies listed, so the list becomes:
     30{{{
     31autoconf automake libtool libsnmp-dev libpcap-dev libconfig8-dev
     32}}}
    2933
    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
     34More info on this tool can be found here: http://docs.projectfloodlight.org/display/floodlightcontroller/Cbench
     35
     36==== liboftrace - building and usage. ==== #oftrace
     37This 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 
     42Its main page is here: http://www.openflowswitch.org/wk/index.php/Liboftrace [[BR]]
     43You can get the source from a git repo: with `git clone git://github.com/capveg/oftrace.git` [[BR]]
     44To build, you need `autoconf` and `libtool`. then it's the usual "./boot.sh;./configure;make;make install". [[BR]]
     45   
     46Both `ofstats` and `ofdump` follows the syntax:
     47{{{
     48ofstats [pcap/file/location] [controller IP] [OF port]
     49}}}
     50At least `ofstats` will spew everything to stdout, so you might want to redirect it into a file.
     51
     52
     53==== openflowj and Ethernet payloads. ====   
     54To 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
    3358   
    34  the former is needed for the payload to be de-serialized properly, as class Ethernet calls getInstance() on the class being used as payload. The latter, or else it won't be parsed and casted properly. In addition point 2. implies that your class needs to implement IPacket. The best way to do this is by extending the provided abstract !BasePacket class. 
     59The former is needed for the payload to be de-serialized properly, as class Ethernet calls getInstance() on the class being used as payload. The latter, or else it won't be parsed and casted properly. In addition point 2. implies that your class needs to implement IPacket. The best way to do this is by extending the provided abstract !BasePacket class.