SDN Bootcamp

Session 2

Fix Mininet

Run the following command in your VM:

sudo sed -e '450s/IP/MAC/' -i /usr/local/lib/python2.7/dist-packages/mininet-2.0.0-py2.7.egg/mininet/node.py

Minimum requirements to write a Floodlight Application

Floodlight creating new application Tutorial

Hub Application

Overview of the Hub Application

Hub code for Floodlight

Learning Switch Application

Learning Switch skeleton

We provide you a floodlight skeleton and a pox skeleton on top of which to implement your Learning Switch applications.

Here are the solutions. Please run the applications by your own if you did not manage to do it in class. If you have any questions please come to us for help before end of Friday: rooms 7384/7376 or e-mail to rgrandl@cs, junaid@cs, sstjohn@cs, agember@cs.

Application Design

We will develop a simple learning switch application which will handle the unicast traffic. The controller application will examine the packets and will learn the "source mac address" and "input port". If the destination of the packet is already associated with some port, a flow entry will be installed in the switch and the packet will be sent to the given output port, otherwise the packet will be flooded on all the ports.

We recommend you to start by implementing the main functionality of the learning switch as described on the blackboard. Next, you will need to add rules in order to leverage the benefits of SDN.

Write Learning Switch Application

The learning switch learns the source mac address and the port of hosts from the packets it receive. Following is a naive algorithm for simple learning switch application:
if (source mac address is new)
    record the source mac and input port mapping
if (destination mac address is known)
    install a flow table rule
    forward the packet to the destination
else
    FLOOD the packet

Test Learning Switch Application

We assume that all of you have mininet and your favorite controller (you can have any controller as long as it's Floodlight or POX) on your machines. Launch Mininet with following command:
sudo mn --topo single,10 --mac --arp --switch ovsk --controller remote,ip=<host_ip> 
To test the performance of your switch applications, run a ping test and measure the average rtt latency.
mininet> h1 ping -c 10 h10
Next, run a throughput performance test as following:
mininet> h10 iperf -s &
mininet> h1 iperf -c h10
You should compare the performance of the hub and learning switch implementations in terms of rtt latency and throughput. What do you observe ? Why do you see such discrepancy among them ? Remember that you can use 'dpctl' command with 'dump-flows' option to see whether packets are hitting the rules, when is the case.
dpctl dump-flows tcp:127.0.0.1:6634 

Extensions

Firewall

Extend your learning switch application to drop TCP traffic on port 23 (telnet) and drop all UDP traffic.

NAT

Extend your application to also translate any flows on port 80 to use port 443. Remember to do the translation in both directions.