Revision 49fc496c

View differences:

examples/test/test_emptynet.py
1 1
#!/usr/bin/env python
2 2

  
3
"""TEST"""
3
"""
4
Test for emptynet.py
5
"""
4 6

  
5 7
import unittest
6 8
import pexpect
7
#from time import sleep
8
from mininet.log import setLogLevel
9
#from mininet.net import Mininet
10
#from mininet.node import CPULimitedHost
11
#from mininet.link import TCLink
12

  
13
#from mininet.examples.simpleperf import SingleSwitchTopo
14 9

  
15 10
class testEmptyNet( unittest.TestCase ):
16
    "Test ping with single switch topology (common code)."
17 11

  
18 12
    prompt = 'mininet>'
19 13

  
20 14
    def testEmptyNet( self ):
15
        "Run simple CLI tests: pingall (verify 0% drop) and iperf (sanity)"
21 16
        p = pexpect.spawn( 'python -m mininet.examples.emptynet' )
22 17
        p.expect( self.prompt )
18
        # pingall test
23 19
        p.sendline( 'pingall' )
24 20
        p.expect ( '(\d+)% dropped' )
25 21
        percent = int( p.match.group( 1 ) ) if p.match else -1
26
        self.assertEqual( percent, 0 ) # or this
22
        self.assertEqual( percent, 0 ) 
27 23
        p.expect( self.prompt )
24
        # iperf test
28 25
        p.sendline( 'iperf' )
29 26
        p.expect( "Results: \['[\d.]+ .bits/sec', '[\d.]+ .bits/sec'\]" )
30
        #TODO check the results? maybe we dont care
31 27
        p.expect( self.prompt )
32 28
        p.sendline( 'exit' )
33 29
        p.wait()
34
        #TODO remove this
35
        self.assertEqual( percent, 0 )
36 30

  
37 31
if __name__ == '__main__':
38
    setLogLevel( 'warning' )
39 32
    unittest.main()

Also available in: Unified diff