Statistics
| Branch: | Tag: | Revision:

mininet / examples / test / test_tree1024.py @ c5da46f1

History | View | Annotate | Download (774 Bytes)

1 a46fae06 Brian O'Connor
#!/usr/bin/env python
2
3 3577a698 Brian O'Connor
"""
4
Test for tree1024.py
5
"""
6 a46fae06 Brian O'Connor
7
import unittest
8
import pexpect
9 c5da46f1 Brian O'Connor
import sys
10 a46fae06 Brian O'Connor
11
class testTree1024( unittest.TestCase ):
12
13
    prompt = 'mininet>'
14
15 c5da46f1 Brian O'Connor
    @unittest.skipIf( '-quick' in sys.argv, 'long test' )
16 a46fae06 Brian O'Connor
    def testTree1024( self ):
17 3577a698 Brian O'Connor
        "Run the example and do a simple ping test from h1 to h1024"
18 a46fae06 Brian O'Connor
        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()