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

cleaned up and commented test_emptynet.py

parent 94abeeab
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python
"""TEST"""
"""
Test for emptynet.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 testEmptyNet( unittest.TestCase ):
"Test ping with single switch topology (common code)."
prompt = 'mininet>'
def testEmptyNet( self ):
"Run simple CLI tests: pingall (verify 0% drop) and iperf (sanity)"
p = pexpect.spawn( 'python -m mininet.examples.emptynet' )
p.expect( self.prompt )
# pingall test
p.sendline( 'pingall' )
p.expect ( '(\d+)% dropped' )
percent = int( p.match.group( 1 ) ) if p.match else -1
self.assertEqual( percent, 0 ) # or this
self.assertEqual( percent, 0 )
p.expect( self.prompt )
# iperf test
p.sendline( 'iperf' )
p.expect( "Results: \['[\d.]+ .bits/sec', '[\d.]+ .bits/sec'\]" )
#TODO check the results? maybe we dont care
p.expect( self.prompt )
p.sendline( 'exit' )
p.wait()
#TODO remove this
self.assertEqual( percent, 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