Assignment 2 - Exploring Software-Defined Networking Techniques
Assignment 2 - Exploring Software-Defined Networking Techniques
1 Summary
In this assignment, we will play with software-defined (SDN) networking techniques and get familiar with
the main concepts of SDN. We will use Mininet to create an emulation platform with the software-based
OpenFlow switches (i.e., Open vSwitch). On top of this emulated SDN platform, POX is used as the SDN
controller. We need to correctly deploy the emulation platform and SDN controller, be familiar with the
operations, program SDN controllers, and finish the required tasks. After these tasks, we should have a
concrete idea on how SDN controller communicates with OpenFlow switches.
s7
s5 s6
s1 s2 s3 s4
h1 h2 h3 h4 h5 h6 h7 h8
1
2.3 Task I: Define a Custom Topology
We know that data center networks typically have a tree-like topology. End-hosts connect to top-of-rack
switches, which form the leaves of the tree; one or more core switches form the root; and one or more layers
of aggregation switches form the middle of the tree. For example, a binary tree network of depth 3 looks
like in Figure 1. Task I asks you to develop a Python script that can populate such a binary tree topology
in the Mininet. After competing the Python script, you should run the following commands to verify it —
“h1” should reach “h8” with ping.
$ mn --custom binary_tree.py --topo mytopo
$ mininet> h1 ping h8
A. Download POX
$ apt-get update
$ apt-get install git
$ env GIT_SSL_NO_VERIFY=true git clone https://github.com/noxrepo/pox
• Q.1 Draw the function call graph of this controller. For example, once a packet comes to the controller,
which function is the first to be called, which one is the second, and so forth?
• Q.2 Have h1 ping h2, and h1 ping h8 for 100 times (e.g., h1 ping -c100 p2). How long does it take (on
average) to ping for each case? What is the difference, and why?
1
Notice that OpenDaylight [3] is an enterprise-level OpenFlow controller, newer than POX, which is written in Java. It is way
more sophisticated than POX, it might be more challenging to work on it. You are encouraged to explore OpenDaylight.
2
• Q.3 Run “iperf h1 h2” and “iperf h1 h8”. What is “iperf” used for? What is the throughput for each
case? What is the difference, and why?
• Q.4 Which of the switches observe traffic? Please describe your way for observing such traffic on
switches (e.g., adding some functions in the “of_tutorial” controller).
2.6 Resources
Notic that this document only provides a barebone guide to the setup. You are encouraged to look through
the following documents:
https://github.com/noxrepo/pox
http://mininet.org/walkthrough/
https://openflow.stanford.edu/display/ONL/POX+Wiki
http://therandomsecurityguy.com/openvswitch-cheat-sheet/
https://github.com/mininet/openflow-tutorial/wiki
# if the port associated with the destination MAC of the packet is known:
if packet.dst in self.mac_to_port:
# Send packet out the associated port
print str(packet.dst) + " destination known. only send message to it"
self.resend_acket(packet_in, self.mac_to_port[packet.dst])
else:
# Flood the packet out everything but the input port
# This part looks familiar, right?
print str(packet.dst) + " not known, resend to everybody"
self.resend_packet(packet_in, of.OFPP_ALL)
• Q.1 Please describe how the above code works, such as how the "MAC to Port" map is established. You
could use a ‘ping’ example to describe the establishment process (e.g., h1 ping h2).
3
• Q.2 (Please disable your output functions, i.e., print, before doing this experiment) Have h1 ping h2, and
h1 ping h8 for 100 times (e.g., h1 ping -c100 p2). How long did it take (on average) to ping for each
case? Any difference from Task II (the hub case)?
• Q.3 Run “iperf h1 h2” and “iperf h1 h8”. What is the throughput for each case? What is the difference
from Task II?
fm = of.ofp_flow_mod()
fm.match.dl_dst = dst
# Add an action to send to the specified port
action = of.ofp_action_output(port=out_port)
fm.actions.append(action)
# Send message to switch
self.connection.send(fm)
• Q.1 Have h1 ping h2, and h1 ping h8 for 100 times (e.g., h1 ping -c100 p2). How long does it take
(on average) to ping for each case? Any difference from Task III (the MAC case without inserting flow
rules)?
• Q.2 Run “iperf h1 h2” and “iperf h1 h8”. What is the throughput for each case? What is the difference
from Task III?
• Q.3 Please explain the above results — why the results become better or worse?
• Q.5 Dump the output of the flow rules using “ovs-ofctl dump-flows” (in your container, not mininet).
How many rules are there for each OpenFlow switch, and why? What does each flow entry mean (select
one flow entry and explain)?
4
6 Submission & Grading
Submit your assignment on the blackboard as one tar-gzipped file (generated using the tar command with
cvzf options). In the tar-gzipped file, include all your Pyhton code, a README file, and a PDF report with
all answers to the questions in each task. If you do not know how to do this, please contact us for help.
DO NOT submit each file individually. DO NOT include the entire POX code – include only the files you
change. Make sure your Python code can run without errors. If the code cannot run, you will get 0 points.
• Task I: Submit the Python script that generates a binary tree topology. – 5 points
• Task II: Answer all the questions (Q.1 to Q.4) in the report. – 20 points (5 points for each question).
• Task III: Submit the Python controller code, and answer the three questions in the report – 25 points (10
points for the controller code, and 5 points for each question).
• Task IV: Submit the Python controller code, and answer the five questions in the report – 40 points (15
points for the controller, and 5 points for each question).
• Task V: Submit the controller code, or describe the method to set up the IP-matching rules – 10 points.
• Bonus You can get the bonus points, if you deploy OpenDaylight controller, and integrate it with Mininet.
Please provide the proofs. – 10 points.
References
[1] An Instant Virtual Network on your Laptop (or other PC). http://mininet.org/.