Update and rename MantenerFIFO to MantenerFIFO.md
[vsorcdistro/.git] / mininet / examples / test / test_multitest.py
1 #!/usr/bin/env python
2
3 """
4 Test for multitest.py
5 """
6
7 import unittest
8 from mininet.util import pexpect
9
10 class testMultiTest( unittest.TestCase ):
11
12     prompt = 'mininet>'
13
14     def testMultiTest( self ):
15         "Verify pingall (0% dropped) and hX-eth0 interface for each host (ifconfig)"
16         p = pexpect.spawn( 'python -m mininet.examples.multitest' )
17         p.expect( '(\d+)% dropped' )
18         dropped = int( p.match.group( 1 ) )
19         self.assertEqual( dropped, 0 )
20         ifCount = 0
21         while True:
22             index = p.expect( [ 'h\d-eth0', self.prompt ] )
23             if index == 0:
24                 ifCount += 1
25             elif index == 1:
26                 p.sendline( 'exit' )
27                 break
28         p.wait()
29         self.assertEqual( ifCount, 4 )
30
31 if __name__ == '__main__':
32     unittest.main()