Statistics
| Branch: | Tag: | Revision:

mininet / examples / test / test_tree1024.py @ c5da46f1

History | View | Annotate | Download (774 Bytes)

1
#!/usr/bin/env python
2

    
3
"""
4
Test for tree1024.py
5
"""
6

    
7
import unittest
8
import pexpect
9
import sys
10

    
11
class testTree1024( unittest.TestCase ):
12

    
13
    prompt = 'mininet>'
14

    
15
    @unittest.skipIf( '-quick' in sys.argv, 'long test' )
16
    def testTree1024( self ):
17
        "Run the example and do a simple ping test from h1 to h1024"
18
        p = pexpect.spawn( 'python -m mininet.examples.tree1024' )
19
        p.expect( self.prompt, timeout=6000 ) # it takes awhile to set up
20
        p.sendline( 'h1 ping -c 1 h1024' )
21
        p.expect ( '(\d+)% packet loss' )
22
        percent = int( p.match.group( 1 ) ) if p.match else -1
23
        p.expect( self.prompt )
24
        p.sendline( 'exit' )
25
        p.wait()
26
        self.assertEqual( percent, 0 )
27

    
28
if __name__ == '__main__':
29
    unittest.main()