cleaned up and commented test_tree1024.py and test_treeping64.py
This commit is contained in:
@@ -1,37 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""TEST"""
|
||||
"""
|
||||
Test for tree1024.py
|
||||
"""
|
||||
|
||||
import unittest
|
||||
import pexpect
|
||||
#from time import sleep
|
||||
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 testTree1024( unittest.TestCase ):
|
||||
"Test ping with single switch topology (common code)."
|
||||
|
||||
prompt = 'mininet>'
|
||||
|
||||
def testTree1024( self ):
|
||||
"Run the example and do a simple ping test from h1 to h1024"
|
||||
p = pexpect.spawn( 'python -m mininet.examples.tree1024' )
|
||||
p.expect( self.prompt, timeout=6000 ) # it takes awhile to set up
|
||||
p.sendline( 'h1 ping -c 1 h1024' )
|
||||
p.expect ( '(\d+)% packet loss' )
|
||||
percent = int( p.match.group( 1 ) ) if p.match else -1
|
||||
#self.assertEqual( percent, 0 )
|
||||
#p.expect( self.prompt )
|
||||
#p.sendline( 'iperf' )
|
||||
#p.expect( "Results: \['\d+ .bits/sec', '\d+ .bits/sec'\]" )
|
||||
p.expect( self.prompt )
|
||||
p.sendline( 'exit' )
|
||||
p.wait()
|
||||
self.assertEqual( percent, 0 )
|
||||
|
||||
if __name__ == '__main__':
|
||||
setLogLevel( 'warning' )
|
||||
unittest.main()
|
||||
|
||||
@@ -1,23 +1,18 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
"""TEST"""
|
||||
"""
|
||||
Test for treeping64.py
|
||||
"""
|
||||
|
||||
import unittest
|
||||
import pexpect
|
||||
#from time import sleep
|
||||
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 testTreePing64( unittest.TestCase ):
|
||||
"Test ping with single switch topology (common code)."
|
||||
|
||||
prompt = 'mininet>'
|
||||
|
||||
def testTreePing64( self ):
|
||||
"Run the example and verify ping results"
|
||||
p = pexpect.spawn( 'python -m mininet.examples.treeping64' )
|
||||
p.expect( 'Tree network ping results:', timeout=6000 )
|
||||
count = 0
|
||||
@@ -32,5 +27,4 @@ class testTreePing64( unittest.TestCase ):
|
||||
self.assertTrue( count > 0 )
|
||||
|
||||
if __name__ == '__main__':
|
||||
setLogLevel( 'warning' )
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user