Merge "[ONOS-6883] Invstigating and Fixing FUNCintent test"
diff --git a/TestON/drivers/common/cli/onosclusterdriver.py b/TestON/drivers/common/cli/onosclusterdriver.py
index f531a3c..4be6191 100755
--- a/TestON/drivers/common/cli/onosclusterdriver.py
+++ b/TestON/drivers/common/cli/onosclusterdriver.py
@@ -397,15 +397,4 @@
             cli = self.createCliComponent( cliName, ip )
             rest = self.createRestComponent( restName, ip )
             bench = self.createBenchComponent( benchName )
-            self.nodes.append( Controller( prefix + str( i ), ip, cli, rest, bench, i - 1, self.user_name ) )
-
-        ## DEBUG ########################################################################
-        print "Prininting NODES::"
-        try:
-            print self.nodes
-            for node in self.nodes:
-                main.log.error( repr(node ))
-                main.log.warn( node )
-        except Exception as e:
-            print repr(e)
-        ## END debug ########################################################################
+            self.nodes.append( Controller( prefix + str( i ), ip, cli, rest, bench, i - 1, self.user_name ) )
\ No newline at end of file
diff --git a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
index eb7cf8a..da20e97 100644
--- a/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
+++ b/TestON/tests/HA/HAclusterRestart/HAclusterRestart.py
@@ -158,7 +158,7 @@
         for ctrl in main.Cluster.active():
             main.log.debug( "Checking logs for errors on " + ctrl.name + ":" )
             main.log.warn( main.ONOSbench.checkLogs( ctrl.ipAddress ) )
-
+        killTime = time.time()
         main.testSetUp.killingAllOnos( main.Cluster, True, False )
 
         main.testSetUp.checkOnosService( main.Cluster )
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params
index 99d17ba..a76ff19 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.params
@@ -1,6 +1,6 @@
 <PARAMS>
 
-    <testcases>1,2,1,2,1,2,1,2,1,2,1,2,1,2</testcases>
+    <testcases>0,1,2,1,2,1,2,1,2,1,2,1,2,1,2</testcases>
 
     <SCALE>1,3,3,5,5,7,7</SCALE>
     <max>7</max>
diff --git a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
index f6325ad..c34adea 100644
--- a/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
+++ b/TestON/tests/SCPF/SCPFflowTp1g/SCPFflowTp1g.py
@@ -34,46 +34,34 @@
     def __init__( self ):
         self.default = ''
 
-    def CASE1( self, main ):
+    def CASE0( self, main ):
 
         import time
-        global init
         try:
-            if type( init ) is not bool:
-                init = False
-        except NameError:
-            init = False
+            from tests.dependencies.ONOSSetup import ONOSSetup
+            main.testSetUp = ONOSSetup()
+        except ImportError:
+            main.log.error("ONOSSetup not found. exiting the test")
+            main.exit()
+        main.testSetUp.envSetupDescription()
+        try:
+            #Load values from params file
+            cellName = main.params[ 'ENV' ][ 'cellName' ]
+            main.apps = main.params[ 'ENV' ][ 'cellApps' ]
+            BENCHUser = main.params[ 'BENCH' ][ 'user' ]
+            BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
+            main.scale = ( main.params[ 'SCALE' ]  ).split( "," )
+            main.flowRuleCfg = main.params[ 'CFG' ][ 'flowRule' ]
+            main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ]
+            stepResult = main.testSetUp.envSetup()
+            resultsDB = open( "/tmp/flowTP1gDB", "w+" )
+            resultsDB.close()
+        except Exception as e:
+            main.testSetUp.envSetupException( e )
+        main.testSetUp.evnSetupConclusion( stepResult )
+        main.commit = ( main.commit.split( " " ) )[ 1 ]
 
-        main.log.info( "==========DEBUG VERSION 3===========" )
-
-        # -- INIT SECTION, ONLY RUNS ONCE -- #
-        if init == False:
-            try:
-                init = True
-                try:
-                    from tests.dependencies.ONOSSetup import ONOSSetup
-                    main.testSetUp = ONOSSetup()
-                except ImportError:
-                    main.log.error( "ONOSSetup not found. exiting the test" )
-                    main.exit()
-                main.testSetUp.envSetupDescription()
-                #Load values from params file
-                cellName = main.params[ 'ENV' ][ 'cellName' ]
-                main.apps = main.params[ 'ENV' ][ 'cellApps' ]
-                BENCHUser = main.params[ 'BENCH' ][ 'user' ]
-                BENCHIp = main.params[ 'BENCH' ][ 'ip1' ]
-                main.scale = ( main.params[ 'SCALE' ]  ).split( "," )
-                main.flowRuleCfg = main.params[ 'CFG' ][ 'flowRule' ]
-                main.nullProviderCfg = main.params[ 'CFG' ][ 'nullProvider' ]
-                stepResult = main.testSetUp.envSetup()
-                resultsDB = open( "/tmp/flowTP1gDB", "w+" )
-                resultsDB.close()
-            except Exception as e:
-                main.testSetUp.envSetupException( e )
-            main.testSetUp.evnSetupConclusion( stepResult )
-            main.commit = ( main.commit.split( " " ) )[ 1 ]
-        # -- END OF INIT SECTION --#
-
+    def CASE1( self, main ):
         main.testSetUp.ONOSSetUp( "localhost", main.Cluster, True, cellName=cellName )
 
         main.log.info( "Startup sequence complete" )
diff --git a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
index 3599806..70fcfb0 100644
--- a/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
+++ b/TestON/tests/SCPF/SCPFintentEventTp/SCPFintentEventTp.py
@@ -113,9 +113,9 @@
         main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "topoShape linear" )
         main.Cluster.active( 0 ).CLI.setCfg( main.nullProviderCfg, "enabled true" )
         if main.flowObj:
-            main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg(),
+            main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg,
                                                  "useFlowObjectives", value="true" )
-            main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg(),
+            main.Cluster.active( 0 ).CLI.setCfg( main.intentConfigRegiCfg,
                                                  "defaultFlowObjectiveCompiler",
                                                  value=main.linkCollectionIntentCfg )
         time.sleep( main.startUpSleep )
diff --git a/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py b/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
index f650521..f773da3 100644
--- a/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
+++ b/TestON/tests/SCPF/SCPFportLat/dependencies/portFunc.py
@@ -34,7 +34,7 @@
         interface: port number
         portStatus: up or down
         resultDict: put result to dictionary
-        warmup: if warmpu, ignore results
+        warmup: if warmup, ignore results
 
     '''
     main.log.info( "Clean up tshark" )
@@ -97,4 +97,4 @@
                         resultDict[ portStatus ][ 'node' + str(i) ]['DtoL'].append( DtoL )
                         resultDict[ portStatus ][ 'node' + str(i) ]['LtoG'].append( LtoG )
         else:
-            main.log.error( "Tshark output file for packet_in returned unexpected results" )
+            main.log.error( "Unexpected tshark output file" )
diff --git a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
index 9c75ef5..d3138f7 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/SCPFswitchLat.py
@@ -97,6 +97,7 @@
             main.testSetUp.envSetupException( e )
         main.testSetUp.evnSetupConclusion( stepResult )
         main.commit = main.commit.split( " " )[ 1 ]
+
     def CASE1( self, main ):
         # Clean up test environment and set up
         import time
diff --git a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
index 829c846..b81a674 100644
--- a/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
+++ b/TestON/tests/SCPF/SCPFswitchLat/dependencies/switchFunc.py
@@ -142,7 +142,6 @@
         main.cleanup()
         main.exit()
 
-
 def captureOfPack( main, deviceName, ofPack, switchStatus, resultDict, warmup ):
     '''
 
@@ -196,6 +195,12 @@
             with open( main.tsharkResultPath[ switchStatus ][ d ], "r" ) as resultFile:
                 # grep tshark result timestamp
                 resultText = resultFile.readlines()
+                if not resultText:
+                    main.log.warn( "Empty tshark result!" )
+                    main.wrong[ 'TsharkValueIncorrect' ] += 1
+                    main.wrong[ 'totalWrong' ] += 1
+                    checkTotalWrongNum()
+                    return
                 if d == "TCP":
                     # if TCP package, we should use the latest one package
                     resultText = resultText[ len( resultText ) - 1 ]
@@ -385,7 +390,7 @@
                     check = checkResult( A_Dtemp, D_Gtemp, E_Etemp )
                     if check == 1:
                         main.log.info( "ACK to device: {}".format( A_Dtemp ) )
-                        main.log.info( "Device ot Graph: {}".format( D_Gtemp )  )
+                        main.log.info( "Device to Graph: {}".format( D_Gtemp )  )
                         main.log.info( "End to End: {}".format( E_Etemp ) )
                         main.log.info( "================================================" )
                 except KeyError:
diff --git a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
index 38dbaf6..9c73c0c 100755
--- a/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
+++ b/TestON/tests/USECASE/SegmentRouting/dependencies/Testcaselib.py
@@ -101,7 +101,7 @@
         main.dynamicHosts = [ 'in1', 'out1' ]
         main.testSetUp.createApplyCell( main.Cluster, newCell=True, cellName=main.cellName,
                                         Mininet=main.Mininet1, useSSH=Testcaselib.useSSH,
-                                        ip=main.Cluster.getIps() )
+                                        ips=main.Cluster.getIps() )
         # kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
                        " before initiating environment setup" )
diff --git a/TestON/tests/USECASE/VPLS/dependencies/vpls.py b/TestON/tests/USECASE/VPLS/dependencies/vpls.py
index 34fffbb..47ffe78 100644
--- a/TestON/tests/USECASE/VPLS/dependencies/vpls.py
+++ b/TestON/tests/USECASE/VPLS/dependencies/vpls.py
@@ -69,14 +69,14 @@
 
     # Variables
     app = main.params[ 'vpls' ][ 'name' ]
-    pprint = main.ONOSrest1.pprint
+    pprint = main.Cluster.active( 0 ).REST.pprint
     SLEEP = int( main.params[ 'SLEEP' ][ 'netcfg' ] )
 
     main.step( "Check network configurations for vpls application" )
     clusterResult = True
-    for node in main.RESTs:
+    for ctrl in main.Cluster.active():
         result = False
-        getVPLS = utilities.retry( f=node.getNetCfg,
+        getVPLS = utilities.retry( f=ctrl.REST.getNetCfg,
                                    retValue=False,
                                    kwargs={"subjectClass":"apps", "subjectKey":app},
                                    sleep=SLEEP )
@@ -98,10 +98,10 @@
 
     main.step( "Check vpls app configurations" )
     clusterResult = True
-    for node in main.CLIs:
+    for ctrl in main.Cluster.active():
         result = False
         #TODO Read from vpls show and match to pushed json
-        vpls = node.parseVplsShow()
+        vpls = ctrl.CLI.parseVplsShow()
         parsedVpls = pprint( sanitizeConfig( vpls ) )
         sentVpls = pprint( sanitizeConfig( main.vplsConfig ) )
         result = parsedVpls == sentVpls
@@ -155,7 +155,7 @@
 
 def checkIntentState( main , bl=[] ):
     # Print the intent states
-    intents = main.CLIs[ 0 ].intents()
+    intents = main.Cluster.active( 0 ).CLI.intents()
     count = 0
     while count <= 5:
         installedCheck = True
@@ -227,8 +227,8 @@
 def compareApps( main ):
     result = True
     first = None
-    for cli in main.CLIs:
-        currentApps = cli.apps( summary=True, active=True )
+    for ctrl in main.Cluster.active():
+        currentApps = ctrl.CLI.apps( summary=True, active=True )
         if not result:
             first = currentApps
         else: