From c75ff7ecd901354548eaa2ed724da6c21b8d979d Mon Sep 17 00:00:00 2001
From: cody burkard <cody@onlab.us>
Date: Tue, 26 Aug 2014 22:34:34 -0700
Subject: [PATCH] fixes for LinkDelay test in test_hifi

---
 mininet/node.py           | 4 +++-
 mininet/test/test_hifi.py | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/mininet/node.py b/mininet/node.py
index 19f26d7f..475d82b6 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 d5a09f93..1edfadf4 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
-- 
GitLab