Version 8 (modified by 11 years ago) ( diff ) | ,
---|
OpenFlow Miscellany
This page documents various odds-and-ends regarding OpenFlow and related platforms, tools, and whatnot.
mininet + xterm.
You can spawn and background terminals by doing:
mininet> h1 xterm &
this allows you to spawn a terminal for a switch, from which you can, say, sniff packets using wireshark
.
Tracking OF packets.
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).
openflowj 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:
(1) OFMatch m1 = new OFMatch(); (2) m1.setDataLayerSource(hwaddr); m1.setWildcards(OFMatch.OFPFW_ALL & ~OFMatch.OFPFW_DL_SRC); (3) flowmod.setmatch(m1); //and other params as necessary
- Create a new match object.
- Add the source MAC address to match on, and turn the wildcard bit for source MAC field (OFPFW_DL_SRC)
- set the FlowMod match to the one you just created.
oflops on Ubuntu.
Compiling oflops
(cbench Controller Benchmarker) requires an additional package, libconfig8-dev
, in addition to the dependencies listed, so the list becomes:
autoconf automake libtool libsnmp-dev libpcap-dev libconfig8-dev
More info on this tool can be found here: http://docs.projectfloodlight.org/display/floodlightcontroller/Cbench
liboftrace - building and usage.
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 a mailing list entry:
- 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.
- ofdump: a program that simply lists openflow message types with timestamps by switch/controller pair.
Its main page is here: http://www.openflowswitch.org/wk/index.php/Liboftrace
You can get the source from a git repo: with git clone git://github.com/capveg/oftrace.git
To build, you need autoconf
and libtool
. then it's the usual "./boot.sh;./configure;make;make install".
Both ofstats
and ofdump
follows the syntax:
ofstats [pcap/file/location] [controller IP] [OF port]
At least ofstats
will spew everything to stdout, so you might want to redirect it into a file.
openflowj and Ethernet payloads.
To create arbitrary protocol data in Floodlight Ethernet class, you need to
- Have a zero-argument constructor, and
- add your class and Ethertype to the etherTypeClassMap HashMap
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.