Merge "Clean up some style issues in teston.py and minor refactoring"
diff --git a/TestON/core/utilities.py b/TestON/core/utilities.py
index 8822aab..d5a5c0f 100644
--- a/TestON/core/utilities.py
+++ b/TestON/core/utilities.py
@@ -185,11 +185,14 @@
                 print e
 
         main.last_result = result
-        main.stepResults[2][-1] = result
-        try:
-            main.stepResults[3][-1] = arguments[ 'ONFAIL' ]
-        except AttributeError:
-            pass
+        if main.stepResults[2]:
+            main.stepResults[2][-1] = result
+            try:
+                main.stepResults[3][-1] = arguments[ 'ONFAIL' ]
+            except AttributeError:
+                pass
+        else:
+            main.log.warn( "Assertion called before a test step" )
         return result
 
     def parse_args(self,args, **kwargs):
diff --git a/TestON/tests/CHOtest/CHOtest.params b/TestON/tests/CHOtest/CHOtest.params
index d4199ad..1efb9bd 100644
--- a/TestON/tests/CHOtest/CHOtest.params
+++ b/TestON/tests/CHOtest/CHOtest.params
@@ -90,7 +90,7 @@
         <LinkDiscovery>15</LinkDiscovery>
         <SwitchDiscovery>10</SwitchDiscovery>
         <IntentPurgeDelay>15</IntentPurgeDelay>
-        <CheckIntentDelay>40</CheckIntentDelay>
+        <CheckIntentDelay>5</CheckIntentDelay>
     </timers>
 
 </PARAMS>
diff --git a/TestON/tests/CHOtest/CHOtest.py b/TestON/tests/CHOtest/CHOtest.py
index fbe51cd..ffc67eb 100644
--- a/TestON/tests/CHOtest/CHOtest.py
+++ b/TestON/tests/CHOtest/CHOtest.py
@@ -989,27 +989,31 @@
         time2 = time.time()
         main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
 
+        # Saving intent ids to check intents in later cases
+        main.intentIds = list(intentIdList)
+
         main.step("Verify intents are installed")
 
         # Giving onos 3 chances to install intents
         for i in range(3):
-            intentsJson = main.ONOScli1.intents()
-            getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
-                                                                intentsJson = intentsJson)
-            main.log.info("Waiting for onos to get intents...")
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
             time.sleep( main.checkIntentsDelay )
 
             intentState = main.TRUE
-            failedIntents = 0
-            for intent in getIntentStateResult:
-                state = intent.items()[0][1]
-                if state != 'INSTALLED':
-                    main.log.info("Intent State: " + state)
-                    failedIntents += 1
-                    intentState = main.FALSE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
             if intentState:
                 break
-            main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
 
         utilities.assert_equals( expect=main.TRUE, actual=intentState,
                                  onpass="INTENTS INSTALLED",
@@ -1040,6 +1044,11 @@
             onpass="Install 300 Host Intents and Ping All test PASS",
             onfail="Install 300 Host Intents and Ping All test FAIL" )
 
+        if not intentState:
+            main.log.debug( "Intents failed to install completely" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+
     def CASE61( self ):
         """
         Install 600 host intents and verify ping all for Chordal Topology
@@ -1075,28 +1084,30 @@
         time2 = time.time()
         main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
 
+        # Saving intent ids to check intents in later cases
+        main.intentIds = list(intentIdList)
+
         main.step("Verify intents are installed")
 
         # Giving onos 3 chances to install intents
         for i in range(3):
-            intentsJson = main.ONOScli1.intents()
-            getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
-                                                                intentsJson = intentsJson)
-            main.log.info("Waiting for onos to get intents...")
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
             time.sleep( main.checkIntentsDelay )
 
             intentState = main.TRUE
-            failedIntents = 0
-            for intent in getIntentStateResult:
-                state = intent.items()[0][1]
-                if state != 'INSTALLED':
-                    main.log.info("Intent State: " + state)
-                    failedIntents += 1
-                    intentState = main.FALSE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
             if intentState:
                 break
-            main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
-
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
 
         utilities.assert_equals( expect=main.TRUE, actual=intentState,
                                  onpass="INTENTS INSTALLED",
@@ -1128,6 +1139,11 @@
             onpass="Install 300 Host Intents and Ping All test PASS",
             onfail="Install 300 Host Intents and Ping All test FAIL" )
 
+        if not intentState:
+            main.log.debug( "Intents failed to install completely" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+
     def CASE62( self ):
         """
         Install 2278 host intents and verify ping all for Spine Topology
@@ -1162,27 +1178,30 @@
         time2 = time.time()
         main.log.info("Time for adding host intents: %2f seconds" %(time2-time1))
 
+        # Saving intent ids to check intents in later cases
+        main.intentIds = list(intentIdList)
+
         main.step("Verify intents are installed")
 
-        # Giving onos 5 chances to install intents
-        for i in range(5):
-            intentsJson = main.ONOScli1.intents()
-            getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
-                                                                intentsJson = intentsJson)
-            main.log.info("Waiting for onos to get intents...")
+        # Giving onos 3 chances to install intents
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
             time.sleep( main.checkIntentsDelay )
 
             intentState = main.TRUE
-            failedIntents = 0
-            for intent in getIntentStateResult:
-                state = intent.items()[0][1]
-                if state != 'INSTALLED':
-                    main.log.info("Intent State: " + state)
-                    failedIntents += 1
-                    intentState = main.FALSE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
             if intentState:
                 break
-            main.log.error("Total # of intents not in an INSTALLED state: " + str(failedIntents))
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intents Summary ****\n" + str(main.ONOScli1.intents(jsonFormat=False, summary=True)) )
 
         utilities.assert_equals( expect=main.TRUE, actual=intentState,
                                  onpass="INTENTS INSTALLED",
@@ -1214,6 +1233,11 @@
             onpass="Install 2278 Host Intents and Ping All test PASS",
             onfail="Install 2278 Host Intents and Ping All test FAIL" )
 
+        if not intentState:
+            main.log.debug( "Intents failed to install completely" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+
     def CASE160( self ):
         """
         Verify IPv6 ping across 300 host intents (Att Topology)
@@ -1383,14 +1407,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkDown = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
-        if not pingResultLinkDown:
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1398,15 +1448,23 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult70 = linkDown and pingResultLinkDown
+        caseResult70 = linkDown and pingResult and intentState
         utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
                                  onpass="Random Link cut Test PASS",
                                  onfail="Random Link cut Test FAIL" )
 
+        # Printing what exactly failed
+        if not linkDown:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
+
     def CASE80( self, main ):
         """
         Bring the core links up that are down and verify ping all ( Host Intents-Att Topo )
@@ -1455,14 +1513,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkUp = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkUp = main.Mininet1.pingall( timeout=main.pingTimeout )
-        if not pingResultLinkUp:
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout )
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1470,14 +1554,21 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult80 = linkUp and pingResultLinkUp
+        caseResult80 = linkUp and pingResult
         utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
+        # Printing what exactly failed
+        if not linkUp:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
 
     def CASE71( self, main ):
         """
@@ -1541,14 +1632,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkDown = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout)
-        if not pingResultLinkDown:
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout )
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1556,15 +1673,24 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult71 = linkDown and pingResultLinkDown
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
+        caseResult70 = linkDown and pingResult and intentState
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
                                  onpass="Random Link cut Test PASS",
                                  onfail="Random Link cut Test FAIL" )
 
+        # Printing what exactly failed
+        if not linkDown:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
+
+
     def CASE81( self, main ):
         """
         Bring the core links up that are down and verify ping all ( Point Intents-Att Topo )
@@ -1613,14 +1739,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkUp = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkUp = main.Mininet1.pingall(timeout = main.pingTimeout )
-        if not pingResultLinkUp:
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout )
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1628,14 +1780,21 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult81 = linkUp and pingResultLinkUp
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult81,
+        caseResult80 = linkUp and pingResult
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
+        # Printing what exactly failed
+        if not linkUp:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
 
     def CASE72( self, main ):
         """
@@ -1676,15 +1835,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkDown = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkDown:
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1692,15 +1876,23 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult71 = pingResultLinkDown
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult71,
+        caseResult70 = linkDown and pingResult and intentState
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
                                  onpass="Random Link cut Test PASS",
                                  onfail="Random Link cut Test FAIL" )
 
+        # Printing what exactly failed
+        if not linkDown:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
+
     def CASE82( self, main ):
         """
         Bring the core links up that are down and verify ping all ( Host Intents Chordal Topo )
@@ -1736,15 +1928,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkUp = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkUp:
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1752,14 +1969,21 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult82 = linkUp and pingResultLinkUp
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult82,
+        caseResult80 = linkUp and pingResult
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
+        # Printing what exactly failed
+        if not linkUp:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
 
     def CASE73( self, main ):
         """
@@ -1800,14 +2024,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkDown = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkDown:
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1815,15 +2065,23 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult73 = pingResultLinkDown
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult73,
+        caseResult70 = linkDown and pingResult and intentState
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
                                  onpass="Random Link cut Test PASS",
                                  onfail="Random Link cut Test FAIL" )
 
+        # Printing what exactly failed
+        if not linkDown:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
+
     def CASE83( self, main ):
         """
         Bring the core links up that are down and verify ping all ( Point Intents Chordal Topo )
@@ -1859,14 +2117,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkUp = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkUp:
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1874,14 +2158,21 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult83 = linkUp and pingResultLinkUp
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult83,
+        caseResult80 = linkUp and pingResult
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
+        # Printing what exactly failed
+        if not linkUp:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
 
     def CASE74( self, main ):
         """
@@ -1933,14 +2224,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkDown = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkDown:
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -1948,15 +2265,23 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult74 = linkDown and pingResultLinkDown
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult74,
+        caseResult70 = linkDown and pingResult and intentState
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
                                  onpass="Random Link cut Test PASS",
                                  onfail="Random Link cut Test FAIL" )
 
+        # Printing what exactly failed
+        if not linkDown:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
+
     def CASE84( self, main ):
         """
         Bring the core links up that are down and verify ping all ( Host Intents-Spine Topo )
@@ -1993,14 +2318,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkUp = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkUp:
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -2008,14 +2359,21 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult84 = linkUp and pingResultLinkUp
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult84,
+        caseResult80 = linkUp and pingResult
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
+        # Printing what exactly failed
+        if not linkUp:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
 
     def CASE75( self, main ):
         """
@@ -2067,14 +2425,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkDown = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkDown:
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkDown = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -2082,15 +2466,23 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkDown,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult75 = linkDown and pingResultLinkDown
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult75,
+        caseResult70 = linkDown and pingResult and intentState
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult70,
                                  onpass="Random Link cut Test PASS",
                                  onfail="Random Link cut Test FAIL" )
 
+        # Printing what exactly failed
+        if not linkDown:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
+
     def CASE85( self, main ):
         """
         Bring the core links up that are down and verify ping all ( Point Intents-Spine Topo )
@@ -2127,14 +2519,40 @@
             str( link_sleep ) +
             " seconds" )
 
+        main.step("Verify intents are installed")
+        # Checking a maximum of 3
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Giving onos some time...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = main.intentIds ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "**** Intent Summary ****\n" + str(main.ONOScli1.intents( jsonFormat=False, summary=True)) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
-        pingResultLinkUp = main.FALSE
+        pingResult = main.FALSE
         time1 = time.time()
-        pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
-        if not pingResultLinkUp:
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
             main.log.warn("First pingall failed. Retrying...")
             time1 = time.time()
-            pingResultLinkUp = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout )
 
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
@@ -2142,14 +2560,21 @@
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        utilities.assert_equals( expect=main.TRUE, actual=pingResultLinkUp,
+        utilities.assert_equals( expect=main.TRUE, actual=pingResult,
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        caseResult85 = linkUp and pingResultLinkUp
-        utilities.assert_equals( expect=main.TRUE, actual=caseResult85,
+        caseResult80 = linkUp and pingResult
+        utilities.assert_equals( expect=main.TRUE, actual=caseResult80,
                                  onpass="Link Up Test PASS",
                                  onfail="Link Up Test FAIL" )
+        # Printing what exactly failed
+        if not linkUp:
+            main.log.debug( "Link down was not discovered correctly" )
+        if not pingResult:
+            main.log.debug( "Pingall failed" )
+        if not intentState:
+            main.log.debug( "Intents are not all installed" )
 
     def CASE170( self ):
         """
@@ -2614,33 +3039,36 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
-        intentResult = main.TRUE
-        intentsJson = main.ONOScli1.intents()
-        getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
-                intentsJson = intentsJson)
-        # Takes awhile for all the onos to get the intents
-        time.sleep(60)
+
+        # Saving intent ids to check intents in later case
+        main.intentIds = list(intentIdList)
 
         main.step("Verify intents are installed")
+
+        # Giving onos 3 chances to install intents
         for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
             intentState = main.TRUE
-            failedIntents = 0
-            for intent in getIntentStateResult:
-                state = intent.items()[0][1]
-                if state != 'INSTALLED':
-                    main.log.info("Intent State: " + state)
-                    failedIntents += 1
-                    intentState = main.FALSE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
             if intentState:
                 break
-            main.log.error("Total: " + str(failedIntents))
-            time.sleep(5)
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
 
         utilities.assert_equals( expect=main.TRUE, actual=intentState,
                                  onpass="INTENTS INSTALLED",
                                  onfail="SOME INTENTS NOT INSTALLED" )
 
-
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
@@ -2655,7 +3083,7 @@
                                  onpass="PING tALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        case90Result = ( intentResult and pingResult )
+        case90Result = ( intentState and pingResult )
 
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2697,33 +3125,36 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info( "Time for adding point intents: %2f seconds" %(time2-time1) )
-        intentResult = main.TRUE
-        intentsJson = main.ONOScli1.intents()
-        getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
-                intentsJson = intentsJson)
-        # Takes awhile for all the onos to get the intents
-        time.sleep(30)
+
+        # Saving intent ids to check intents in later case
+        main.intentIds = list(intentIdList)
 
         main.step("Verify intents are installed")
+
+        # Giving onos 3 chances to install intents
         for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
             intentState = main.TRUE
-            failedIntents = 0
-            for intent in getIntentStateResult:
-                state = intent.items()[0][1]
-                if state != 'INSTALLED':
-                    main.log.info("Intent State: " + state)
-                    failedIntents += 1
-                    intentState = main.FALSE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
             if intentState:
                 break
-            main.log.error("Total: " + str(failedIntents))
-            time.sleep(5)
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
 
         utilities.assert_equals( expect=main.TRUE, actual=intentState,
                                  onpass="INTENTS INSTALLED",
                                  onfail="SOME INTENTS NOT INSTALLED" )
 
-
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
@@ -2738,7 +3169,7 @@
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        case91Result = ( intentResult and pingResult )
+        case91Result = ( intentState and pingResult )
 
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2783,34 +3214,36 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
-        intentResult = main.TRUE
-        intentsJson = main.ONOScli1.intents()
-        getIntentStateResult = main.ONOScli1.getIntentState(intentsId = intentIdList,
-                intentsJson = intentsJson)
-        #print getIntentStateResult
-        # Takes awhile for all the onos to get the intents
-        time.sleep(60)
+
+        # Saving intent ids to check intents in later case
+        main.intentIds = list(intentIdList)
 
         main.step("Verify intents are installed")
+
+        # Giving onos 3 chances to install intents
         for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
             intentState = main.TRUE
-            failedIntents = 0
-            for intent in getIntentStateResult:
-                state = intent.items()[0][1]
-                if state != 'INSTALLED':
-                    main.log.info("Intent State: " + state)
-                    failedIntents += 1
-                    intentState = main.FALSE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
             if intentState:
                 break
-            main.log.error("Total: " + str(failedIntents))
-            time.sleep(5)
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
 
         utilities.assert_equals( expect=main.TRUE, actual=intentState,
                                  onpass="INTENTS INSTALLED",
                                  onfail="SOME INTENTS NOT INSTALLED" )
 
-
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
@@ -2825,7 +3258,7 @@
                                  onpass="PING ALL PASS",
                                  onfail="PING ALL FAIL" )
 
-        case92Result = ( intentResult and pingResult )
+        case92Result = ( intentState and pingResult )
 
         utilities.assert_equals(
             expect=main.TRUE,
@@ -2840,13 +3273,14 @@
         """
         import copy
         import time
+        from collections import Counter
         main.log.report( "Install multi-single point intents and verify Ping all" )
         main.log.report( "___________________________________________" )
         main.case( "Install multi-single point intents and Ping all" )
         deviceDPIDsCopy = copy.copy(main.deviceDPIDs)
         portIngressList = ['1']*(len(deviceDPIDsCopy) - 1)
         intentIdList = []
-        print "MACsDict", main.MACsDict
+        main.log.info( "MACsDict" + str(main.MACsDict) )
         time1 = time.time()
         for i in xrange(0,len(deviceDPIDsCopy),int(main.numCtrls)):
             pool = []
@@ -2861,7 +3295,6 @@
                         name="addMultipointToSinglepointIntent",
                         args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
                 pool.append(t)
-                #time.sleep(1)
                 t.start()
                 i = i + 1
                 main.threadID = main.threadID + 1
@@ -2870,38 +3303,55 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
-        time.sleep(30)
-        print "getting all intents ID"
-        intentIdTemp = main.ONOScli1.getAllIntentsId()
-        print intentIdTemp
-        print len(intentIdList)
-        print intentIdList
-        checkIntentStateResult = main.TRUE
-        print "Checking intents state"
-        checkIntentStateResult = main.ONOScli1.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
-        checkIntentStateResult = main.ONOScli2.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
-        checkIntentStateResult = main.ONOScli3.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
-        checkIntentStateResult = main.ONOScli4.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
-        checkIntentStateResult = main.ONOScli5.checkIntentState( intentsId = intentIdList ) and checkIntentStateResult
 
-        if checkIntentStateResult:
-            main.log.info( "All intents are installed correctly " )
+        main.step("Verify intents are installed")
 
-        print "Checking flows state "
+        # Giving onos 3 chances to install intents
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
+        main.log.info( "Checking flows state" )
         checkFlowsState = main.ONOScli1.checkFlowsState()
+        # Giving onos time to return the state of the flows
         time.sleep(50)
+
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+        pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+        if not pingResult:
+            time1 = time.time()
+            main.log.warn("First pingall failed. Retrying")
+            pingResult = main.Mininet1.pingall( timeout=main.pingTimeout )
+
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
             "Time taken for Ping All: " +
             str( timeDiff ) +
             " seconds" )
-        checkFlowsState = main.ONOScli1.checkFlowsState()
-        case93Result = pingResult
+
+        case93Result = ( checkFlowsState and pingResult and intentState )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case93Result,
@@ -2936,7 +3386,6 @@
                         name="addMultipointToSinglepointIntent",
                         args =[ingressDeviceList,egressDevice,portIngressList,'1','','',main.MACsDict.get(egressDevice)])
                 pool.append(t)
-                #time.sleep(1)
                 t.start()
                 i = i + 1
                 main.threadID = main.threadID + 1
@@ -2945,11 +3394,42 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
-        time.sleep(5)
+
+        main.step("Verify intents are installed")
+
+        # Giving onos 3 chances to install intents
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+        if not pingResult:
+            main.log.info( "First pingall failed. Retrying..." )
+            time1 = time.time()
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -2957,7 +3437,8 @@
             str( timeDiff ) +
             " seconds" )
 
-        case94Result = pingResult
+
+        case94Result = ( pingResult and intentState )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case94Result,
@@ -2993,7 +3474,6 @@
                         name="addSinglepointToMultipointIntent",
                         args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice)])
                 pool.append(t)
-                #time.sleep(1)
                 t.start()
                 i = i + 1
                 main.threadID = main.threadID + 1
@@ -3002,11 +3482,42 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
-        time.sleep(5)
+
+        main.step("Verify intents are installed")
+
+        # Giving onos 3 chances to install intents
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+        if not pingResult:
+            main.log.info( "First pingall failed. Retrying..." )
+            time1 = time.time()
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -3014,7 +3525,7 @@
             str( timeDiff ) +
             " seconds" )
 
-        case96Result = pingResult
+        case96Result = ( pingResult and intentState )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case96Result,
@@ -3048,7 +3559,6 @@
                         name="addSinglepointToMultipointIntent",
                         args =[ingressDevice,egressDeviceList,'1',portEgressList,'',main.MACsDict.get(ingressDevice),''])
                 pool.append(t)
-                #time.sleep(1)
                 t.start()
                 i = i + 1
                 main.threadID = main.threadID + 1
@@ -3057,11 +3567,42 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
-        time.sleep(5)
+
+        main.step("Verify intents are installed")
+
+        # Giving onos 3 chances to install intents
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+        if not pingResult:
+            main.log.info( "First pingall failed. Retrying..." )
+            time1 = time.time()
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -3069,7 +3610,7 @@
             str( timeDiff ) +
             " seconds" )
 
-        case97Result = pingResult
+        case97Result = ( pingResult and intentState )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case97Result,
@@ -3110,7 +3651,6 @@
                         name="addSinglepointToMultipointIntent",
                         args =[ingressDevice,egressDeviceList,'1',portEgressList,'',MACsDictCopy.get(ingressDevice),''])
                 pool.append(t)
-                #time.sleep(1)
                 t.start()
                 i = i + 1
                 main.threadID = main.threadID + 1
@@ -3119,11 +3659,42 @@
                 intentIdList.append(thread.result)
         time2 = time.time()
         main.log.info("Time for adding point intents: %2f seconds" %(time2-time1))
-        time.sleep(5)
+
+        main.step("Verify intents are installed")
+
+        # Giving onos 3 chances to install intents
+        for i in range(3):
+            if i != 0:
+                main.log.warn( "Verification failed. Retrying..." )
+            main.log.info("Waiting for onos to install intents...")
+            time.sleep( main.checkIntentsDelay )
+
+            intentState = main.TRUE
+            for e in range(int(main.numCtrls)):
+                main.log.info( "Checking intents on CLI %s" % (e+1) )
+                intentState = main.CLIs[e].checkIntentState( intentsId = intentIdList ) and\
+                        intentState
+                if not intentState:
+                    main.log.warn( "Not all intents installed" )
+            if intentState:
+                break
+        else:
+            #Dumping intent summary
+            main.log.info( "Intents:\n" + str( main.ONOScli1.intents( jsonFormat=False, summary=True ) ) )
+
+
+        utilities.assert_equals( expect=main.TRUE, actual=intentState,
+                                 onpass="INTENTS INSTALLED",
+                                 onfail="SOME INTENTS NOT INSTALLED" )
+
         main.step( "Verify Ping across all hosts" )
         pingResult = main.FALSE
         time1 = time.time()
-        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout,shortCircuit=False,acceptableFailed=5)
+        pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
+        if not pingResult:
+            main.log.info( "First pingall failed. Retrying..." )
+            time1 = time.time()
+            pingResult = main.Mininet1.pingall(timeout=main.pingTimeout)
         time2 = time.time()
         timeDiff = round( ( time2 - time1 ), 2 )
         main.log.report(
@@ -3131,7 +3702,7 @@
             str( timeDiff ) +
             " seconds" )
 
-        case98Result = pingResult
+        case98Result = ( pingResult and intentState )
         utilities.assert_equals(
             expect=main.TRUE,
             actual=case98Result,
diff --git a/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py b/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
index dcb2390..ddd8c1e 100644
--- a/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
+++ b/TestON/tests/USECASE_SdnipFunction/Dependency/Functions.py
@@ -74,9 +74,9 @@
         main.exit()
 
     if expectAllSuccess:
-        main.step( "BGP speakers ping peers, expect all tests to SUCCEED" )
+        main.step( "BGP speakers ping peers, expect all tests to succeed" )
     else:
-        main.step( "BGP speakers ping peers, expect all tests to FAIL" )
+        main.step( "BGP speakers ping peers, expect all tests to fail" )
 
     result = True
     if expectAllSuccess: