88f14e946a
Including changes to mnexec -c to reduce the number of close() system calls, which may help with performance in containers on Ubuntu 22.04. Note that systemd-udevd also seems to be a cause of performance issues and should probably be disabled while running Mininet. Adding dbeug logging to test_simpleperf because it is failing intermittently. (Note with packet loss it can fail, but this is not how we should be testing it.)
38 lines
1.1 KiB
Python
Executable File
38 lines
1.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
"""
|
|
Test for simpleperf.py
|
|
"""
|
|
|
|
import unittest
|
|
from mininet.util import pexpect
|
|
import sys
|
|
from mininet.log import setLogLevel
|
|
|
|
from mininet.examples.simpleperf import SingleSwitchTopo
|
|
|
|
class testSimplePerf( unittest.TestCase ):
|
|
|
|
@unittest.skipIf( '-quick' in sys.argv, 'long test' )
|
|
def testE2E( self ):
|
|
"Run the example and verify iperf results"
|
|
# 10 Mb/s, plus or minus 20% tolerance
|
|
BW = 10
|
|
TOLERANCE = .2
|
|
p = pexpect.spawn(
|
|
'python -m mininet.examples.simpleperf testmode' )
|
|
# Log since this seems to be failing intermittently
|
|
p.logfile = sys.stdout
|
|
# check iperf results
|
|
p.expect( "Results: \['10M', '([\d\.]+) .bits/sec", timeout=90 )
|
|
measuredBw = float( p.match.group( 1 ) )
|
|
lowerBound = BW * ( 1 - TOLERANCE )
|
|
upperBound = BW + ( 1 + TOLERANCE )
|
|
self.assertGreaterEqual( measuredBw, lowerBound )
|
|
self.assertLessEqual( measuredBw, upperBound )
|
|
p.wait()
|
|
|
|
if __name__ == '__main__':
|
|
setLogLevel( 'debug' )
|
|
unittest.main()
|