diff --git a/mininet/node.py b/mininet/node.py index 19f26d7f5ce36b453d347c89198eb402dcb8a62c..475d82b6451207ee56aa66e6b45a0c78074dfe66 100644 --- a/mininet/node.py +++ b/mininet/node.py @@ -888,7 +888,9 @@ def dpctl( self, *args ): def connected( self ): "Is the switch connected to a controller?" - return 'remote.is-connected=true' in self.dpctl( 'status' ) + status = self.dpctl( 'status' ) + return ( 'remote.is-connected=true' in status and + 'local.is-connected=true' in status ) @staticmethod def TCReapply( intf ): diff --git a/mininet/test/test_hifi.py b/mininet/test/test_hifi.py index d5a09f93476c6f51f9346007a59102df34189078..1edfadf451e1101babbe092710bf47ed05dcb730 100755 --- a/mininet/test/test_hifi.py +++ b/mininet/test/test_hifi.py @@ -97,11 +97,15 @@ def testLinkDelay( self ): "Verify that link delays are accurate within a bound." DELAY_MS = 15 DELAY_TOLERANCE = 0.8 # Delay fraction below which test should fail + REPS = 3 lopts = { 'delay': '%sms' % DELAY_MS, 'use_htb': True } mn = Mininet( SingleSwitchOptionsTopo( n=N, lopts=lopts ), link=TCLink, switch=self.switchClass, autoStaticArp=True, waitConnected=True ) - ping_delays = mn.run( mn.pingFull ) + mn.start() + for _ in range( REPS ): + ping_delays = mn.pingFull() + mn.stop() test_outputs = ping_delays[0] # Ignore unused variables below # pylint: disable-msg=W0612