cleaned up and commented test_linearbandwidth.py
This commit is contained in:
@@ -1,26 +1,21 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
"""TEST"""
|
"""
|
||||||
|
Test for linearbandwidth.py
|
||||||
|
"""
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
import pexpect
|
import pexpect
|
||||||
from mininet.log import setLogLevel
|
|
||||||
#from mininet.net import Mininet
|
|
||||||
#from mininet.node import CPULimitedHost
|
|
||||||
#from mininet.link import TCLink
|
|
||||||
|
|
||||||
#from mininet.examples.simpleperf import SingleSwitchTopo
|
|
||||||
|
|
||||||
class testLinearBandwidth( unittest.TestCase ):
|
class testLinearBandwidth( unittest.TestCase ):
|
||||||
"Test ping with single switch topology (common code)."
|
|
||||||
|
|
||||||
prompt = 'mininet>'
|
|
||||||
|
|
||||||
def testLinearBandwidth( self ):
|
def testLinearBandwidth( self ):
|
||||||
count = 0
|
"Verify that bandwidth is monotonically decreasing as # of hops increases"
|
||||||
tolerance = 0.5
|
|
||||||
opts = [ '\*\*\* Linear network results', '(\d+)\s+([\d\.]+) (.bits)', pexpect.EOF ]
|
|
||||||
p = pexpect.spawn( 'python -m mininet.examples.linearbandwidth' )
|
p = pexpect.spawn( 'python -m mininet.examples.linearbandwidth' )
|
||||||
|
count = 0
|
||||||
|
opts = [ '\*\*\* Linear network results',
|
||||||
|
'(\d+)\s+([\d\.]+) (.bits)',
|
||||||
|
pexpect.EOF ]
|
||||||
while True:
|
while True:
|
||||||
index = p.expect( opts, timeout=600 )
|
index = p.expect( opts, timeout=600 )
|
||||||
if index == 0:
|
if index == 0:
|
||||||
@@ -44,5 +39,4 @@ class testLinearBandwidth( unittest.TestCase ):
|
|||||||
self.assertTrue( count > 0 )
|
self.assertTrue( count > 0 )
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
setLogLevel( 'warning' )
|
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user