Reputation: 2115
Why can't mininet handle circular topologies? The following code works fine. However, if I uncomment the #net.addLink( s3, s1 )
then I get 100% CPU usage and 100% drop in the net.pingAll()
test.
from mininet.net import Mininet
from mininet.node import OVSController
from mininet.log import setLogLevel, info
def test():
net = Mininet( controller = OVSController)
net.addController( 'c0' )
s1 = net.addSwitch( 's1' )
s2 = net.addSwitch( 's2' )
s3 = net.addSwitch( 's3' )
net.addLink( s1, s2 )
net.addLink( s2, s3 )
#net.addLink( s3, s1 )
h1 = net.addHost( 'h1' )
h2 = net.addHost( 'h2' )
h3 = net.addHost( 'h3' )
net.addLink( s1, h1 )
net.addLink( s2, h2 )
net.addLink( s3, h3 )
net.start()
net.pingAll()
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
test()
Upvotes: 1
Views: 2117
Reputation: 31
For three days, I had trouble with implementing the circular topology in Mininet. The network was set up, but unfortunately all the network packets were dropped out when i was calling pingall method. Finally I realized that it was just enough to set the host IP address manually. for example:
host1 = net.addHost('h1' , ip = "127.0.0.2")
host2 = net.addHost('h2' , ip = "127.0.0.3")
host3 = net.addHost('h3' , ip = "127.0.0.4")
Upvotes: 3
Reputation: 427
this is old but i came across it with the same problem and eventually learned that you can handle loops by using the Spanning Tree Protocol
in your switches.
From the code above that would look like
net.addSwitch('s1', stp=True, failMode='standalone')
You can see the parameters in the constructor section OVS Switch API Docs
Upvotes: 1
Reputation: 440
If you have circular topologies, then packets can circulate in the network without arriving at their destination, eventually flooding the network. This occurs if the network devices are not aware that there is a cycle in the topology.
Your packets sending logic should take into account that there is a cycle in the topology and send packets with awareness of this. For example, the controller can use shortest path algorithm in order to set up the correct routing rules for the switches, so that packets will arrive at their destination.
You can also set up your own routing algorithms for that, or install the forwarding rules at the switches so matching packets will be sent to a specific destination and not circulate in the network.
Upvotes: 2