Ubuntu 20.04 fixes:
- fixes sshd test
- speeds up examples/{treeping64,tree1024}.py
- debugging hacks/output for testLinkChange
- removes cfs from examples/popen.py
- improves nat in nodelib (netplan fixes?)
- makes some tests executable
- waits for switches to connect in tests to
avoid race conditions
-- adds mn -w option and wait CLI command
Changes:
- REMOVES default "-v" argument for Controller()
and adds verbose(=False) option; avoiding logging
makes it faster
- CHANGES waitConnected to wait for 5 seconds
as documented; we may wish to implement an argument
to -w to set this timeout
Issues?
- There may still be an issue with the ovs-netplan-clean
service causing the boot to hang ;-(
37 lines
1.1 KiB
Python
Executable File
37 lines
1.1 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
"""
|
|
Create a network where different switches are connected to
|
|
different controllers, by creating a custom Switch() subclass.
|
|
"""
|
|
|
|
from mininet.net import Mininet
|
|
from mininet.node import OVSSwitch, Controller, RemoteController
|
|
from mininet.topolib import TreeTopo
|
|
from mininet.log import setLogLevel
|
|
from mininet.cli import CLI
|
|
|
|
setLogLevel( 'info' )
|
|
|
|
# Two local and one "external" controller (which is actually c0)
|
|
# Ignore the warning message that the remote isn't (yet) running
|
|
c0 = Controller( 'c0', port=6633 )
|
|
c1 = Controller( 'c1', port=6634 )
|
|
c2 = RemoteController( 'c2', ip='127.0.0.1', port=6633 )
|
|
|
|
cmap = { 's1': c0, 's2': c1, 's3': c2 }
|
|
|
|
class MultiSwitch( OVSSwitch ):
|
|
"Custom Switch() subclass that connects to different controllers"
|
|
def start( self, controllers ):
|
|
return OVSSwitch.start( self, [ cmap[ self.name ] ] )
|
|
|
|
topo = TreeTopo( depth=2, fanout=2 )
|
|
net = Mininet( topo=topo, switch=MultiSwitch, build=False, waitConnected=True )
|
|
for c in [ c0, c1 ]:
|
|
net.addController(c)
|
|
net.build()
|
|
net.start()
|
|
CLI( net )
|
|
net.stop()
|