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.0 KiB
Python
Executable File
37 lines
1.0 KiB
Python
Executable File
#!/usr/bin/python
|
|
|
|
"Monitor multiple hosts using popen()/pmonitor()"
|
|
|
|
from mininet.net import Mininet
|
|
from mininet.topo import SingleSwitchTopo
|
|
from mininet.util import pmonitor
|
|
from mininet.log import setLogLevel, info
|
|
|
|
from time import time
|
|
from signal import SIGINT
|
|
|
|
def pmonitorTest( N=3, seconds=10 ):
|
|
"Run pings and monitor multiple hosts using pmonitor"
|
|
topo = SingleSwitchTopo( N )
|
|
net = Mininet( topo, waitConnected=True )
|
|
net.start()
|
|
hosts = net.hosts
|
|
info( "Starting test...\n" )
|
|
server = hosts[ 0 ]
|
|
popens = {}
|
|
for h in hosts:
|
|
popens[ h ] = h.popen('ping', server.IP() )
|
|
info( "Monitoring output for", seconds, "seconds\n" )
|
|
endTime = time() + seconds
|
|
for h, line in pmonitor( popens, timeoutms=500 ):
|
|
if h:
|
|
info( '<%s>: %s' % ( h.name, line ) )
|
|
if time() >= endTime:
|
|
for p in popens.values():
|
|
p.send_signal( SIGINT )
|
|
net.stop()
|
|
|
|
if __name__ == '__main__':
|
|
setLogLevel( 'info' )
|
|
pmonitorTest()
|