4 Test for numberedports.py
8 from mininet.util import pexpect
9 from collections import defaultdict
10 from mininet.node import OVSSwitch
12 class testNumberedports( unittest.TestCase ):
14 @unittest.skipIf( OVSSwitch.setup() or OVSSwitch.isOldOVS(), "old version of OVS" )
15 def testConsistency( self ):
16 """verify consistency between mininet and ovs ports"""
17 p = pexpect.spawn( 'python -m mininet.examples.numberedports' )
18 opts = [ 'Validating that s1-eth\d is actually on port \d ... Validated.',
19 'Validating that s1-eth\d is actually on port \d ... WARNING',
24 index = p.expect( opts )
30 self.assertNotEqual( 0, count )
32 self.assertTrue( correct_ports )
34 def testNumbering( self ):
35 """verify that all of the port numbers are printed correctly and consistent with their interface"""
36 p = pexpect.spawn( 'python -m mininet.examples.numberedports' )
37 opts = [ 's1-eth(\d+) : (\d+)',
41 index = p.expect( opts )
44 intfport = p.match.group( 1 )
45 ofport = p.match.group( 2 )
46 self.assertEqual( intfport, ofport )
49 self.assertNotEqual( 0, count_intfs )
51 if __name__ == '__main__':