Can someone show me a python script that creates a simple custom topology in Mininet, that uses a tree topology with a depth and fanout of 2? It would be greatly appreciated.
Mininet - Need custom tree topology script
1.3k Views Asked by Romual Piecyk At
2
There are 2 best solutions below
0
On
If you want to use TreeNet class from mininet.topolib:
from mininet.cli import CLI
from mininet.log import setLogLevel
from mininet.node import OVSKernelSwitch
from mininet.topolib import TreeNet
from mininet.net import Mininet
from mininet.node import RemoteController
if __name__ == '__main__':
setLogLevel( 'info' )
print "Input Depth :"
_depth = int(raw_input())
print "Input fanout :"
_fanout = int(raw_input())
network = TreeNet( depth= _depth, fanout= _fanout, controller= RemoteController, autoSetMacs = True, cleanup = True, switch=OVSKernelSwitch)
print network.topo.links()
# network.startTerms()
network.run(CLI, network)
Example: