b7c412073a
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 ;-(
53 lines
1.5 KiB
Python
Executable File
53 lines
1.5 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
"""
|
|
Test for linuxrouter.py
|
|
"""
|
|
|
|
import unittest
|
|
from mininet.util import pexpect
|
|
from mininet.util import quietRun
|
|
|
|
class testLinuxRouter( unittest.TestCase ):
|
|
|
|
prompt = 'mininet>'
|
|
|
|
def testPingall( self ):
|
|
"Test connectivity between hosts"
|
|
p = pexpect.spawn( 'python -m mininet.examples.linuxrouter' )
|
|
p.expect( self.prompt )
|
|
p.sendline( 'pingall' )
|
|
p.expect ( '(\d+)% dropped' )
|
|
percent = int( p.match.group( 1 ) ) if p.match else -1
|
|
p.expect( self.prompt )
|
|
p.sendline( 'exit' )
|
|
p.wait()
|
|
self.assertEqual( percent, 0 )
|
|
|
|
def testRouterPing( self ):
|
|
"Test connectivity from h1 to router"
|
|
p = pexpect.spawn( 'python -m mininet.examples.linuxrouter' )
|
|
p.expect( self.prompt )
|
|
p.sendline( 'h1 ping -c 1 r0' )
|
|
p.expect ( '(\d+)% packet loss' )
|
|
percent = int( p.match.group( 1 ) ) if p.match else -1
|
|
p.expect( self.prompt )
|
|
p.sendline( 'exit' )
|
|
p.wait()
|
|
self.assertEqual( percent, 0 )
|
|
|
|
def testTTL( self ):
|
|
"Verify that the TTL is decremented"
|
|
p = pexpect.spawn( 'python -m mininet.examples.linuxrouter' )
|
|
p.expect( self.prompt )
|
|
p.sendline( 'h1 ping -c 1 h2' )
|
|
p.expect ( 'ttl=(\d+)' )
|
|
ttl = int( p.match.group( 1 ) ) if p.match else -1
|
|
p.expect( self.prompt )
|
|
p.sendline( 'exit' )
|
|
p.wait()
|
|
self.assertEqual( ttl, 63 ) # 64 - 1
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|