-
Notifications
You must be signed in to change notification settings - Fork 22
MAC Learning Tutorial
In this tutorial we'll execute the MAC Learning application leveraging OpenState features.
You first need to configure OpenState in Mininet as explained here http://openstate-sdn.github.io/
-
Launch maclearning app in Ryu. Inside Mininet type the following command:
$ ryu-manager ryu/ryu/app/openstate/maclearning.py
As you can see from the output this app support switches with a maximum of 4 ports:
loading app ryu/ryu/app/openstate/maclearning.py
loading app ryu.controller.ofp_handler
instantiating app ryu/ryu/app/openstate/maclearning.py of OSMacLearning
OpenState MAC Learning sample app initialized
Supporting MAX 4 ports per switch
...
To edit the number of ports you can simply edit the value SWITCH_PORTS inside maclearning.py
-
Start Mininet with a single topology with 4 hosts:
$ sudo mn --topo single,4 --mac --switch user --controller remote
-
Test correct working... inside Mininet
mininet> pingall
As you can see from the output the switch is correctly working as supposed:
*** Ping: testing ping reachability
h1 -> h2 h3 h4
h2 -> h1 h3 h4
h3 -> h1 h2 h4
h4 -> h1 h2 h3
*** Results: 0% dropped (12/12 received)
-
To debug the flow table we need first to open a terminal window for switch s1, inside mininet:
mininet> xterm s1
-
Inside s1 terminal:
Note how the rules installed don't match any MAC address but just the current state of the packet.
-
To query the state table, in s1 terminal write:
Now let's compare OpenState-based MAC Learning with OpenFlow. To do this we'll use a more complex topology.
-
Launch simple_switch_13 app in RYU
$ ryu-manager ryu/ryu/app/simple_switch_13.py
-
Start Mininet with a tree topology with:
sudo mn --topo tree,4 --mac --switch user --controller remote
-
Ping from h1 to h16, inside Mininet:
mininet> h1 ping h16
Note how the time to complete the first ping is longer than the followings. This is due to the time needed for the first packet to go to the controller and back:
PING 10.0.0.16 (10.0.0.16) 56(84) bytes of data.
64 bytes from 10.0.0.16: icmp_req=1 ttl=64 time=51.7 ms
64 bytes from 10.0.0.16: icmp_req=2 ttl=64 time=1.99 ms
64 bytes from 10.0.0.16: icmp_req=3 ttl=64 time=2.60 ms
64 bytes from 10.0.0.16: icmp_req=4 ttl=64 time=2.81 ms
- Restart Mininet with same topology and RYU with OpenState maclearning app. Execute the same test, do you notice any difference?