In-band Controller with Mininet – Part 2
October 5, 2013 9 Comments
Update: Some people are finding some interesting results when they have more than one switch in their topology. I haven’t been able to confirm, but it seems that the controller will talk to the adjacent switch over the link, but when the controller needs to communicate with another switch, the management traffic might be going to the other switches via the root network namespace instead of going through another link. One possible workaround would be to run an OVS instance for each switch in its own network namespace. I haven’t been able to try this out yet, but if anyone has more details, we would be glad to hear about it.
Update 2 : I have been successful now running OVS in it’s own network namespace with the controller in-band. You can see my progress here and conclusion here.
————-
In my previous post of setting up an In-band controller, I didn’t like the idea that you had to modify mininet classes to get it to work. So I found a way to do it by introducing my own controller class called InbandController so that you can run an in-band controller without modifying the mininet code itself. Below is the new version of the test script that will run without modifying mininet classes.
#!/usr/bin/python from mininet.net import Mininet from mininet.node import RemoteController, OVSSwitch from mininet.cli import CLI from mininet.log import setLogLevel, info class InbandController( RemoteController ): def checkListening( self ): "Overridden to do nothing." return def emptyNet(): "Create an empty network and add nodes to it." net = Mininet( topo=None, build=False) net.addController( 'c0', controller=InbandController, ip='10.0.0.1' ) h1 = net.addHost( 'h1', ip='10.0.0.1' ) h2 = net.addHost( 'h2', ip='10.0.0.2' ) h3 = net.addHost( 'h3', ip='10.0.0.3' ) s1 = net.addSwitch( 's1', cls=OVSSwitch ) net.addLink( h1, s1 ) net.addLink( h2, s1 ) net.addLink( h3, s1 ) net.start() s1.cmd('ifconfig s1 10.0.0.10') CLI( net ) net.stop() if __name__ == '__main__': setLogLevel( 'info' ) emptyNet()
This post ‘In-band Controller with Mininet – Part 2’ first appeared on https://gregorygee.wordpress.com/.
Pingback: In-band Controller with Mininet | Tech and Trains
Are you sure this works? Because neither h1 can ping s1, nor s1 can ping h1. In this case, how will s1 be able to connect to a TCP app running on h1?
How does this line work?
s1.cmd(‘ifconfig s1 10.0.0.10’)
I am trying with Mininet 2.1.0+ and the switch doesn’t have an interface named s1. Only s1-eth1/2/3
If you run ifconfig, you will see an interface for each switch that has the name of the switch. As an example, if I just run the basic Mininet topology `sudo mn`, I would see the following when I run ìfconfig on the system or VM that is running Mininet. These interfaces only exist while the switch and Mininet are running.
Apparently something is wrong with the copy of openvswitch I had built myself. I replaced that with one from a prebuilt package for Debian and it worked fine.
I will dig further into my build to see why it’s broken. Thanks for your response.
I wrote a good post here on how to upgrade the OVS that comes with Mininet installation. I`ve used these instructions to upgrade to several different version including OVS 2.0.
hi..i made a floodlight controller cluster…
how can i start floodlight in xterm??
Hi, I have tried to run this code but apparently it didn’t work well for me, I was hoping if you could help me determine the problem. Currently running on Mininet 2.2.2 and using POX.
This error log was given when starting mininet with the code above:
s1 Traceback (most recent call last):
File “sample4.py”, line 40, in
emptyNet()
File “sample4.py”, line 32, in emptyNet
net.start()
File “build/bdist.linux-i686/egg/mininet/net.py”, line 491, in start
File “build/bdist.linux-i686/egg/mininet/node.py”, line 1170, in start
TypeError: %d format: a number is required, not NoneType
Thank you for your time.
Hi sir,
When I am running this code on mininet 2.3.0d4 have an error look like this
*** Configuring hosts
h1 h2 h3
*** Starting controller
c0
*** Starting 1 switches
s1 Traceback (most recent call last):
File “node4.py”, line 43, in
emptyNet()
File “node4.py”, line 35, in emptyNet
net.start()
File “build/bdist.linux-x86_64/egg/mininet/net.py”, line 549, in start
File “build/bdist.linux-x86_64/egg/mininet/node.py”, line 1199, in start
TypeError: %d format: a number is required, not NoneType
what is the problem with ovs? How can solve this problem? Please help me
thank you