Tools used with Opendaylight

To test Opendaylight and the applications written on Opendaylight, we need to use a bunch of tools. This blog covers some of the tools that I have used. The tools covered are Mininet, dpctl, Wireshark, Packeth, Postman.

Mininet:

Mininet creates a realistic virtual network that can be programmed using controller. Data flows can be programmed using Openflow. Mininet internally contains a vswitch which can be programmed with OVSDB. Opendaylight Hydrogen release introduces ovsdb plugin through which Opendaylight can control any vswitch. Mininet can either be run in a separate VM or can be installed in the same VM as Controller. I have tried both options and they work fine. Image for both options can be downloaded from Mininet website (http://mininet.org/download/) Installing Mininet: I followed steps below to install Mininet in my Ubuntu 12.04:

sudo apt-get install -y mininet/precise-backports
 
sudo service openvswitch-controller stop
sudo update-rc.d openvswitch-controller disable

sudo apt-get install -y linux-headers-`uname -r`
sudo dpkg-reconfigure openvswitch-datapath-dkms
sudo service openflow-switch restart

By default, Mininet installed Openvswitch version 1.4.0. I upgraded Openvswitch using the procedure described here. Following were the exact steps I followed to upgrade Openvswitch to 2.1.0. Download specific version of Openvswitch from here.

cd 
./configure --prefix=/usr --with-linux=/lib/modules/`uname -r`/build
make
sudo make install
sudo make modules_install
sudo rmmod openvswitch
sudo depmod -a
sudo /etc/init.d/openvswitch-controller stop
sudo update-rc.d openvswitch-controller disable
sudo /etc/init.d/openvswitch-switch start

Creating different topologies: Mininet comes with some standard topologies like linear, tree and can be specified from command line. Simple pre-built topology creation: Example below creates a tree topology with 2 levels sudo mn --controller=remote,ip=192.168.56.101 --topo tree,2 tree_2level Creating custom topologies: Custom topologies can be specified using a python script and using custom option with mininet. Following example creates a 3 switch triangle topology with 1 host to each switch: sudo mn --custom ~/mininet/custom/triangle_top.py --topo=mytopo --controller=remote,ip=192.168.56.101,port=6633 triangle_top.py:

class MyTopo( Topo ):
    "Simple topology example."

    def __init__( self ):
        "Create custom topo."

        # Initialize topology
        Topo.__init__( self )

        # Add hosts and switches
        h1 = self.addHost( 'h1' )
        h2 = self.addHost( 'h2' )
        h3 = self.addHost( 'h3' )
        s1 = self.addSwitch( 's1' )
        s2 = self.addSwitch( 's2' )
        s3 = self.addSwitch( 's3' )

        # Add links
        self.addLink( s1, s2)
        self.addLink( s1, s3)
        self.addLink( s1, h1)
        self.addLink( s2, h2)
        self.addLink( s3, h3)

topos = { 'mytopo': ( lambda: MyTopo() ) }

In the above example, 3 hosts and 3 switches are created initially. Then links are created between the switches and hosts. When this topology is discovered by Opendaylight, following topology is displayed in the Controller view. custom_top1 Complex Mininet example: Following example creates a custom topology with custom link characteristics(bandwidth, delay), custom mac address for switches and custom ip address for the hosts. sudo mn --custom ~/Downloads/mininet/custom/multi_path1.py --topo=mytopo --pre ~/Downloads/mininet/pre/host3_diff_subnet.py --host=rt --link=tc --mac --controller=remote,ip=192.168.56.101,port=6633 –pre: script to run before tests, can be used to specify parameters like custom ip address for the hosts in the –pre option, we can set ip like: h1 ifconfig h1-eth0 10.0.1.1/24 –post: CLI script to run after tests can be used for cleanup –mac: Custom mac address starting with 00:00:00:00:00:01 for switches use –host and –link option and specify link parameters in addlink in the custom topology python script. self.addLink( s1, s2, bw=10, delay='5ms', max_queue_size=1000) Specifying link parameters becomes useful when we need to create applications which use the link parameters and makes dynamic decisions. Other Mininet options: From mininet prompt, there are bunch of commands available which can be seen with “mininet -h” ======================================== EOF exit intfs link noecho pingpair py source xterm dpctl gterm iperf net pingall pingpairfull quit time dump help iperfudp nodes pingallfull px sh x ======================================== Useful ones being: link, nodes – to see nodes and switches pingall – ping test between hosts iperf, iperfudp – performance test between hosts

dpctl:

dpctl is a command-line tool for monitoring and administering openflow data paths. Examples: Display properties of a switch: dpctl show tcp:127.0.0.1:6634 For switch 2, use port number 6635 and so on. Dumping and deleting flows: dpctl dump-flows tcp:127.0.0.1:6634 dpctl del-flows tcp:127.0.0.1:6634

Wireshark:

To monitor packets. Packets can be monitored on each of the virtual interfaces created in Mininet. To monitor openflow packets, openflow plugin needs to be installed for Wireshark.

Packeth:

Useful for custom packet generation. Packets can be generated on each of the virtual interfaces created in Mininet. Can be downloaded from http://packeth.sourceforge.net.

Postman:

Postman is a powerful web-based REST api client. Its very useful to try out the northbound REST apis exposed by Opendaylight. Postman can be installed in Chrome browser. References:

3 thoughts on “Tools used with Opendaylight

Leave a comment