Merge "[ONOS-7625] Refactor SRMulticast for complex test scenarios"
diff --git a/TestON/JenkinsFile/JenkinsTestONTests.groovy b/TestON/JenkinsFile/JenkinsTestONTests.groovy
index a101dcf..ac27a0c 100644
--- a/TestON/JenkinsFile/JenkinsTestONTests.groovy
+++ b/TestON/JenkinsFile/JenkinsTestONTests.groovy
@@ -7,7 +7,7 @@
                 "FUNCoptical" :    [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCoptical", wiki_file:"FUNCopticalWiki.txt" ],
                 "FUNCflow" :       [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCflow", wiki_file:"FUNCflowWiki.txt" ],
                 "FUNCnetCfg":      [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCnetCfg", wiki_file:"FUNCnetCfgWiki.txt" ],
-                "FUNCovsdbtest" :  [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCovsdbtestWiki", wiki_file:"FUNCovsdbtestWiki.txt" ],
+                "FUNCovsdbtest" :  [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCovsdbtest", wiki_file:"FUNCovsdbtestWiki.txt" ],
                 "FUNCnetconf" :    [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCnetconf", wiki_file:"FUNCnetconfWiki.txt" ],
                 "FUNCgroup" :      [ "basic":true, "extra_A":false, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCgroup", wiki_file:"FUNCgroupWiki.txt" ],
                 "FUNCintent" :     [ "basic":false, "extra_A":true, "extra_B":false, "new_Test":false, "day":"", wiki_link:wikiPrefix + "-" + "FUNCintent", wiki_file:"FUNCintentWiki.txt" ],
diff --git a/TestON/JenkinsFile/JenkinsfileTrigger b/TestON/JenkinsFile/JenkinsfileTrigger
index bdfc0bc..b0ea6c9 100644
--- a/TestON/JenkinsFile/JenkinsfileTrigger
+++ b/TestON/JenkinsFile/JenkinsfileTrigger
@@ -4,8 +4,9 @@
 test_lists = evaluate readTrusted( 'TestON/JenkinsFile/JenkinsTestONTests.groovy' )
 triggerFuncs = evaluate readTrusted( 'TestON/JenkinsFile/TriggerFuncs.groovy' )
 
-previous_version = "master"
-before_previous_version = "1.12"
+current_version = "1.13"
+previous_version = "1.13"
+before_previous_version = "1.13"
 funcs.initializeTrend( "VM" );
 triggerFuncs.init( funcs )
 wikiContents = ""
@@ -28,7 +29,7 @@
 ]
 
 manually_run = params.manual_run
-onos_b = "1.13"
+onos_b = current_version
 test_branch = ""
 onos_tag = params.ONOSTag
 isOldFlow = true
diff --git a/TestON/JenkinsFile/PerformanceFuncs.groovy b/TestON/JenkinsFile/PerformanceFuncs.groovy
index 37a9a73..5077bd9 100644
--- a/TestON/JenkinsFile/PerformanceFuncs.groovy
+++ b/TestON/JenkinsFile/PerformanceFuncs.groovy
@@ -12,7 +12,7 @@
         SCPFflowTp1g:                            [ flows:true, test:'SCPFflowTp1g', table:'flow_tp_tests', results:'flow_tp_results', file:'flowTP1gDB', rFile:'SCPFflowTp1g.R n', extra:neighbors, finalResult:1, graphTitle:[ 'Flow Throughput Test - neighbors=0', 'Flow Throughput Test - neighbors=4' ], dbCols:'avg', dbWhere:[ 'AND scale=5 AND neighbors=0 ','AND scale=5 AND NOT neighbors=0' ],  y_axis:'Throughput (,000 Flows/sec)' ],
         SCPFflowTp1gWithFlowObj:                 [ flows:true, test:'SCPFflowTp1g --params TEST/flowObj=True', table:'flow_tp_fobj_tests', results:'flow_tp_fobj_results', file:'flowTP1gDBFlowObj', rFile:'SCPFflowTp1g.R y', extra:neighbors, finalResult:0 ],
         SCPFscaleTopo:                           [ flows:false, test:'SCPFscaleTopo', table:'scale_topo_latency_details', results:'scale_topo_latency_results', file:'/tmp/scaleTopoResultDb', rFile:'SCPFscaleTopo.R', extra:none, finalResult:1, graphTitle:[ 'Scale Topology Test' ], dbCols:[ 'first_connection_to_last_connection, last_connection_to_last_role_request, last_role_request_to_last_topology' ], dbWhere:'AND scale=20' , y_axis:'Latency (s)' ],
-        SCPFswitchLat:                           [ flows:false, test:'SCPFswitchLat', table:'switch_latency_details', results:'switch_latency_results', file:'/tmp/switchEventResultDb', rFile:'SCPFswitchLat.R', extra:none, finalResult:1, graphTitle:[ 'Switch Latency Test - Switch Up','Switch Latency Test - Switch Down' ], dbCols:[ 'tcp_to_feature_reply_avg,feature_reply_device_avg,up_device_to_graph_avg', 'fin_ack_to_ack_avg,ack_to_device_avg,down_device_to_graph_avg' ], dbWhere:'AND scale=5', y_axis:'Latency (ms)' ],
+        SCPFswitchLat:                           [ flows:false, test:'SCPFswitchLat', table:'switch_latency_details', results:'switch_latency_results', file:'/tmp/switchEventResultDb', rFile:'SCPFswitchLat.R', extra:none, finalResult:1, graphTitle:[ 'Switch Latency Test - Switch Up','Switch Latency Test - Switch Down' ], dbCols:[ 'tcp_to_feature_reply_avg,feature_reply_to_device_avg,up_device_to_graph_avg', 'fin_ack_to_ack_avg,ack_to_device_avg,down_device_to_graph_avg' ], dbWhere:'AND scale=5', y_axis:'Latency (ms)' ],
         SCPFbatchFlowResp:                       [ flows:true, test:'SCPFbatchFlowResp', table:'batch_flow_tests', results:'batch_flow_results', file:'SCPFbatchFlowRespData', rFile:'SCPFbatchFlowResp.R', extra:none, finalResult:1, graphTitle:[ 'Batch Flow Test - Post', 'Batch Flow Test - Del' ], dbCols:[ 'elapsepost, posttoconfrm', 'elapsedel, deltoconfrm' ], dbWhere:'', y_axis:'Latency (s)' ],
         SCPFintentEventTp:                       [ flows:true, test:'SCPFintentEventTp', table:'intent_tp_tests', results:'intent_tp_results', file:'IntentEventTPDB', rFile:'SCPFintentEventTp.R n', extra:neighbors, finalResult:1, graphTitle:[ 'Intent Throughput Test - neighbors=0','Intent Throughput Test - neighbors=4' ], dbCols:'SUM( avg ) as avg', dbWhere:[ 'AND scale=5 AND neighbors=0 GROUP BY date,build','AND scale=5 AND NOT neighbors=0 GROUP BY date,build' ], y_axis:'Throughput (Ops/sec)' ],
         SCPFintentRerouteLat:                    [ flows:true, test:'SCPFintentRerouteLat', table:'intent_reroute_latency_tests', results:'intent_reroute_latency_results', file:'IntentRerouteLatDB', rFile:'SCPFIntentInstallWithdrawRerouteLat.R n', extra:batches, finalResult:1, graphTitle:[ 'Intent Reroute Test' ], dbCols:'avg', dbWhere:'AND scale=5 AND batch_size=100', y_axis:'Latency (ms)' ],
diff --git a/TestON/bin/cli.py b/TestON/bin/cli.py
index 263d4b4..74e7603 100755
--- a/TestON/bin/cli.py
+++ b/TestON/bin/cli.py
@@ -281,8 +281,7 @@
                     index += 1
         except IndexError as e:
             print ( e )
-            main.cleanup()
-            main.exit()
+            sys.exit()
 
         return options
 
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index ca86a89..08d8505 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -202,7 +202,7 @@
                 startTime = time.time()
                 while True:
                     i = self.handle.expect( [ 'mininet>',
-                                              'Exception',
+                                              'Exception|Error',
                                               '\*\*\*',
                                               pexpect.EOF,
                                               pexpect.TIMEOUT,
@@ -234,6 +234,7 @@
                         main.log.error(
                             self.name +
                             ": Something took too long... " )
+                        main.log.debug( self.handle.before + self.handle.after )
                         return main.FALSE
                     elif i == 5:
                         main.log.error( self.name + ": " + self.handle.before + self.handle.after )
diff --git a/TestON/drivers/common/cli/onosclidriver.py b/TestON/drivers/common/cli/onosclidriver.py
index 7a6c638..6342efc 100755
--- a/TestON/drivers/common/cli/onosclidriver.py
+++ b/TestON/drivers/common/cli/onosclidriver.py
@@ -3154,12 +3154,12 @@
 
     def clusters( self, jsonFormat=True ):
         """
-        Lists all clusters
+        Lists all topology clusters
         Optional argument:
             * jsonFormat - boolean indicating if you want output in json
         """
         try:
-            cmdStr = "clusters"
+            cmdStr = "topo-clusters"
             if jsonFormat:
                 cmdStr += " -j"
             handle = self.sendline( cmdStr )
diff --git a/TestON/tests/FUNC/FUNCintent/FUNCintent.py b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
index daa17cb..86b9f53 100644
--- a/TestON/tests/FUNC/FUNCintent/FUNCintent.py
+++ b/TestON/tests/FUNC/FUNCintent/FUNCintent.py
@@ -564,7 +564,7 @@
                                                       sw2="s2",
                                                       expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -620,7 +620,7 @@
                                                       sw2="s2",
                                                       expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -649,7 +649,7 @@
                                                       sw2="s2",
                                                       expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -677,7 +677,7 @@
                                                       sw2="s2",
                                                       expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -706,7 +706,7 @@
                                                       sw2="s2",
                                                       expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -735,7 +735,7 @@
                                                       sw2="s2",
                                                       expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -856,7 +856,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -890,7 +890,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -925,7 +925,7 @@
                 protected=True,
                 expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -959,7 +959,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1003,7 +1003,7 @@
                                          expectedLink=18,
                                          useTCP=True )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1068,7 +1068,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1165,7 +1165,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1199,7 +1199,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1233,7 +1233,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1353,7 +1353,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1394,7 +1394,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1434,8 +1434,7 @@
                                          sw1="s5",
                                          sw2="s2",
                                          expectedLink=18 )
-        else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1475,7 +1474,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1516,7 +1515,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1643,7 +1642,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1684,7 +1683,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1725,7 +1724,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1765,7 +1764,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1807,7 +1806,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1848,7 +1847,7 @@
                                          sw2="s2",
                                          expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -1965,7 +1964,7 @@
                                                       sw2="s2",
                                                       expectedLink=18 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -2033,7 +2032,7 @@
                                          expectedLink1=16,
                                          expectedLink2=14 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -2083,7 +2082,7 @@
                                          expectedLink2=14,
                                          partial=True )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -2130,7 +2129,7 @@
                                          expectedLink1=16,
                                          expectedLink2=14 )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
@@ -2180,7 +2179,7 @@
                                          expectedLink2=14,
                                          partial=True )
         else:
-            main.Cluster.active( 0 ).CLI.removeAllIntents( purge=True )
+            main.intents.removeAllExistIntents( main )
 
         utilities.assert_equals( expect=main.TRUE,
                                  actual=testResult,
diff --git a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
index afe4c4a..1d31f69 100644
--- a/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
+++ b/TestON/tests/FUNC/FUNCintent/dependencies/FuncIntentFunction.py
@@ -410,6 +410,17 @@
         main.assertReturnString += 'Remove Intents Failed'
         testResult = main.FALSE
 
+    # Check flows count in each node
+    if utilities.retry( f=checkFlowsState,
+                          retValue=main.FALSE,
+                          args=[ main ],
+                          sleep=main.checkFlowCountSleep,
+                          attempts=3 ):
+        main.assertReturnString += 'After removing intents Flow State Passed\n'
+    else:
+        main.assertReturnString += 'After removing intents Flow State Failed\n'
+        testResult = main.FALSE
+
     return testResult
 
 
@@ -1477,6 +1488,17 @@
         main.assertReturnString += 'Remove Intents Failed'
         testResult = main.FALSE
 
+    # Check flows count in each node
+    if utilities.retry( f=checkFlowsState,
+                          retValue=main.FALSE,
+                          args=[ main ],
+                          sleep=main.checkFlowCountSleep,
+                          attempts=3 ):
+        main.assertReturnString += 'After removing intents Flow State Passed\n'
+    else:
+        main.assertReturnString += 'After removing intents Flow State Failed\n'
+        testResult = main.FALSE
+
     return testResult
 
 
@@ -1896,6 +1918,17 @@
         main.assertReturnString += 'Remove Intents Failed'
         testResult = main.FALSE
 
+    # Check flows count in each node
+    if utilities.retry( f=checkFlowsState,
+                          retValue=main.FALSE,
+                          args=[ main ],
+                          sleep=main.checkFlowCountSleep,
+                          attempts=3 ):
+        main.assertReturnString += 'After removing intents Flow State Passed\n'
+    else:
+        main.assertReturnString += 'After removing intents Flow State Failed\n'
+        testResult = main.FALSE
+
     return testResult
 
 
@@ -2217,6 +2250,26 @@
 
         return connectionsFunctional
 
+def removeAllExistIntents( main ):
+    main.Cluster.active( 0 ).CLI.removeAllIntents()
+    main.log.debug( str( main.Cluster.active( 0 ).CLI.intents() ) )
+    main.log.info( "Sleeping {} seconds".format( main.removeIntentSleep ) )
+    time.sleep( main.removeIntentSleep )
+
+    main.Cluster.active( 0 ).CLI.purgeWithdrawnIntents()
+    main.log.debug( str( main.Cluster.active( 0 ).CLI.intents() ) )
+    main.log.info( "Sleeping {} seconds".format( main.removeIntentSleep ) )
+    time.sleep( main.removeIntentSleep )
+
+    # Check flows count in each node
+    if utilities.retry( f=checkFlowsState,
+                          retValue=main.FALSE,
+                          args=[ main ],
+                          sleep=main.checkFlowCountSleep,
+                          attempts=3 ):
+        main.assertReturnString += 'After removing intents Flow State Passed\n'
+    else:
+        main.assertReturnString += 'After removing intents Flow State Failed\n'
 
 def removeAllIntents( main, intentsId ):
     """
@@ -2226,10 +2279,20 @@
     removeIntentResult = main.TRUE
     # Remove intents
     for intent in intentsId:
-        main.Cluster.active( 0 ).CLI.removeIntent( intentId=intent, purge=True )
-
-    main.log.info( "Sleeping {} seconds".format( main.removeIntentSleep ) )
-    time.sleep( main.removeIntentSleep )
+        main.Cluster.active( 0 ).CLI.removeIntent( intentId=intent )
+        main.log.debug( str( main.Cluster.active( 0 ).CLI.intents() ) )
+        main.log.info( "Sleeping {} seconds".format( 15 ) )
+        time.sleep( 15 )
+        try:
+            intents = json.loads( main.Cluster.active( 0 ).CLI.intents() )
+            for eachIntent in intents:
+                if eachIntent.get( 'id' ) == intent and eachIntent.get( 'state' ) == 'WITHDRAWN':
+                    main.Cluster.active( 0 ).CLI.purgeWithdrawnIntents()
+                    main.log.debug( str( main.Cluster.active( 0 ).CLI.intents() ) )
+                    main.log.info( "Sleeping {} seconds".format( 15 ) )
+                    time.sleep( 15 )
+        except:
+            main.log.warn( 'Intent does not exist' )
 
     # If there is remianing intents then remove intents should fail
     for ctrl in main.Cluster.active():
@@ -2425,9 +2488,9 @@
     PushTag = tag + "_PUSH"
     main.log.info( "Host Json info :" )
     for EachHostJson in HostJson:
-        for i in range( totalflows ):
-            main.log.info( str( EachHostJson[ i ] ) )
-            checkJson = EachHostJson[ i ][ "treatment" ][ "instructions" ][ 0 ]
+        for singleHostJson in EachHostJson:
+            main.log.info( str( singleHostJson ) )
+            checkJson = singleHostJson[ "treatment" ][ "instructions" ][ 0 ]
             main.Cluster.active( 0 ).REST.pprint( checkJson )
             if 'subtype' in checkJson:
                 if checkJson[ "subtype" ] == PopTag:
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 8f3dcda..8048d4f 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -168,9 +168,9 @@
                                                "up", resultDict, True )
                 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
                                                "down", resultDict, True )
-                main.log.warn( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
+                main.log.debug( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
                 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
-                main.log.warn( "After devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
+                main.log.debug( "After devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
                 while main.Cluster.active( 0 ).CLI.devices() != "[]":
                     main.log.error( "DEVICE NOT REMOVED !!!!!")
                     main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
@@ -179,9 +179,9 @@
                                                "up", resultDict, False )
                 main.switchFunc.captureOfPack( main, main.device, main.ofPackage,
                                                 "down", resultDict, False )
-                main.log.warn( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
+                main.log.debug( "Before devices : " + str( main.Cluster.active( 0 ).CLI.devices() ) )
                 main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
-                main.log.warn("After devices : " + str(main.Cluster.active(0).CLI.devices()))
+                main.log.debug("After devices : " + str(main.Cluster.active(0).CLI.devices()))
                 while main.Cluster.active( 0 ).CLI.devices() != "[]":
                     main.log.error( "DEVICE NOT REMOVED !!!!!")
                     main.Cluster.active( 0 ).CLI.removeDevice( "of:0000000000000001" )
diff --git a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
index b097166..b9463c2 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
@@ -100,6 +100,9 @@
     for line in resultText:
         for term in keyTerm:
             if term in line:
+                # Exclude non-openflow FIN packets
+                if term == "[FIN, ACK]" and "openflow" not in line:
+                    continue
                 path = '/tmp/Tshark_' + str( keyTerm[ term ] )
                 with open( path, 'a' ) as outputfile:
                     outputfile.write( line )