Skip to content
Snippets Groups Projects
Commit 3577a698 authored by Brian O'Connor's avatar Brian O'Connor
Browse files

cleaned up and commented test_tree1024.py and test_treeping64.py

parent 48c49c54
No related branches found
No related tags found
No related merge requests found
#!/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()
#!/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 @@ def testTreePing64( self ):
self.assertTrue( count > 0 )
if __name__ == '__main__':
setLogLevel( 'warning' )
unittest.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment