Merge "Removed duplicated and incorrectly placed error message"
diff --git a/TestON/drivers/common/cli/emulator/mininetclidriver.py b/TestON/drivers/common/cli/emulator/mininetclidriver.py
index b65b887..c198c4f 100644
--- a/TestON/drivers/common/cli/emulator/mininetclidriver.py
+++ b/TestON/drivers/common/cli/emulator/mininetclidriver.py
@@ -1961,6 +1961,7 @@
                 elif i == 1:
                     main.log.info( " Mininet trying to exit while not " +
                                    "in the mininet prompt" )
+                    response = main.TRUE
                 elif i == 2:
                     main.log.error( "Something went wrong exiting mininet" )
                 elif i == 3:  # timeout
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
index 84af370..b44a3c0 100755
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.params
@@ -52,7 +52,7 @@
 
     <TOPOLOGY>
         <topology>torus</topology>
-        <scale>15,20,25</scale>
+        <scale>10,15,20</scale>
     </TOPOLOGY>
 
 </PARAMS>
diff --git a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
index 25565dc..96ac405 100644
--- a/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
+++ b/TestON/tests/SCPF/SCPFscaleTopo/SCPFscaleTopo.py
@@ -296,7 +296,6 @@
         while compareRetry <3:
             #While loop for retry
             devices = main.topo.getAllDevices( main )
-            hosts = main.topo.getAllHosts( main )
             ports = main.topo.getAllPorts( main )
             links = main.topo.getAllLinks( main)
             clusters = main.topo.getAllClusters( main )
@@ -324,14 +323,7 @@
                 else:
                     currentLinksResult = main.FALSE
 
-                if hosts[ controller ] or "Error" not in hosts[ controller ]:
-                    currentHostsResult = main.Mininet1.compareHosts(
-                            mnHosts,
-                            json.loads( hosts[ controller ] ) )
-                else:
-                    currentHostsResult = main.FALSE
-
-                stepResult = currentDevicesResult and currentLinksResult and currentHostsResult
+                stepResult = currentDevicesResult and currentLinksResult
             if stepResult:
                 break
             compareRetry += 1
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
index 58fce87..ac41fda 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction/USECASE_SdnipFunction.py
@@ -11,7 +11,7 @@
         """
         import os
         import imp
-        main.log.case( "Setup the Mininet testbed" )
+        main.case( "Setup the Mininet testbed" )
         main.dependencyPath = main.testDir + \
                               main.params[ 'DEPENDENCY' ][ 'path' ]
         main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
@@ -81,6 +81,15 @@
         ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
         ipList = [ ONOS1Ip ]
 
+        main.step( "Copying config files" )
+        src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+        dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+        status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=status,
+                                 onpass="Copy config file succeeded",
+                                 onfail="Copy config file failed" )
+
         main.step( "Create cell file" )
         cellAppString = main.params[ 'ENV' ][ 'appString' ]
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -94,6 +103,7 @@
                                  onpass="Set cell succeeded",
                                  onfail="Set cell failed" )
 
+        main.step( "Verify cell connectivity" )
         verifyResult = main.ONOSbench.verifyCell()
         utilities.assert_equals( expect=main.TRUE,
                                  actual=verifyResult,
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
index 7593368..5742092 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster/USECASE_SdnipFunctionCluster.py
@@ -76,6 +76,15 @@
         peer64515 = main.params['config']['peer64515']
         peer64516 = main.params['config']['peer64516']
 
+        main.step( "Copying config files" )
+        src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+        dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+        status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=status,
+                                 onpass="Copy config file succeeded",
+                                 onfail="Copy config file failed" )
+
         main.step( "Create cell file" )
         cellAppString = main.params[ 'ENV' ][ 'appString' ]
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -89,6 +98,7 @@
                                  onpass="Set cell succeeded",
                                  onfail="Set cell failed" )
 
+        main.step( "Verify cell connectivity" )
         verifyResult = main.ONOSbench.verifyCell()
         utilities.assert_equals( expect=main.TRUE,
                                  actual=verifyResult,
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
index 98c28bb..3e27a10 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunctionCluster_fsfw/USECASE_SdnipFunctionCluster_fsfw.py
@@ -10,7 +10,7 @@
             Start mininet
         """
         import imp
-        main.log.case( "Setup the Mininet testbed" )
+        main.case( "Setup the Mininet testbed" )
         main.dependencyPath = main.testDir + \
                               main.params[ 'DEPENDENCY' ][ 'path' ]
         main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
@@ -81,6 +81,15 @@
         fsfwIp = main.params[ 'CTRL' ][ 'fsfwIp' ]
         fsfwPort = main.params[ 'CTRL' ][ 'fsfwPort' ]
 
+        main.step( "Copying config files" )
+        src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+        dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+        status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=status,
+                                 onpass="Copy config file succeeded",
+                                 onfail="Copy config file failed" )
+
         main.step( "Create cell file" )
         cellAppString = main.params[ 'ENV' ][ 'appString' ]
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -94,6 +103,7 @@
                                  onpass="Set cell succeeded",
                                  onfail="Set cell failed" )
 
+        main.step( "Verify cell connectivity" )
         verifyResult = main.ONOSbench.verifyCell()
         utilities.assert_equals( expect=main.TRUE,
                                  actual=verifyResult,
diff --git a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
index 938b6e0..e931a0b 100644
--- a/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
+++ b/TestON/tests/USECASE/USECASE_SdnipFunction_fsfw/USECASE_SdnipFunction_fsfw.py
@@ -11,7 +11,7 @@
         """
         import os
         import imp
-        main.log.case( "Setup the Mininet testbed" )
+        main.case( "Setup the Mininet testbed" )
         main.dependencyPath = main.testDir + \
                               main.params[ 'DEPENDENCY' ][ 'path' ]
         main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
@@ -83,13 +83,22 @@
         import os
         from operator import eq
 
-        main.case( "Setting up test environment" )
+        main.case( "Setting up ONOS environment" )
 
         cellName = main.params[ 'ENV' ][ 'cellName' ]
         global ONOS1Ip
         ONOS1Ip = os.getenv( main.params[ 'CTRL' ][ 'ip1' ] )
         ipList = [ ONOS1Ip ]
 
+        main.step( "Copying config files" )
+        src = os.path.dirname( main.testFile ) + "/network-cfg.json"
+        dst = main.ONOSbench.home + "/tools/package/config/network-cfg.json"
+        status = main.ONOSbench.scp( main.ONOSbench, src, dst, direction="to" )
+        utilities.assert_equals( expect=main.TRUE,
+                                 actual=status,
+                                 onpass="Copy config file succeeded",
+                                 onfail="Copy config file failed" )
+
         main.step( "Create cell file" )
         cellAppString = main.params[ 'ENV' ][ 'appString' ]
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address, cellName,
@@ -103,6 +112,7 @@
                                  onpass="Set cell succeeded",
                                  onfail="Set cell failed" )
 
+        main.step( "Verify cell connectivity" )
         verifyResult = main.ONOSbench.verifyCell()
         utilities.assert_equals( expect=main.TRUE,
                                  actual=verifyResult,
diff --git a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
index 31678fe..c95e232 100644
--- a/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
+++ b/TestON/tests/USECASE/USECASE_SegmentRouting/USECASE_SegmentRouting.py
@@ -31,7 +31,8 @@
         main.apps = main.params[ 'ENV' ][ 'cellApps' ]
         main.diff = ( main.params[ 'ENV' ][ 'diffApps' ] ).split(";")
         gitBranch = main.params[ 'GIT' ][ 'branch' ]
-        main.dependencyPath = os.path.dirname( main.testFile ) + "/dependencies/"
+        main.path = os.path.dirname( main.testFile )
+        main.dependencyPath = main.path + "/dependencies/"
         main.topology = main.params[ 'DEPENDENCY' ][ 'topology' ]
         #main.json = ["4x4"]
         main.json = ["2x2", "2x2"]
@@ -105,8 +106,11 @@
 
         # main.scale[ 0 ] determines the current number of ONOS controller
         main.numCtrls = int( main.scale[ 0 ] )
-
-        main.case( "Package and start ONOS")
+        apps=main.apps
+        if main.diff:
+            apps = main.apps+","+main.diff.pop(0)
+        else: main.log.error( "App list is empty" )
+        main.case( "Package and start ONOS using apps:" + apps)
 
         #kill off all onos processes
         main.log.info( "Safety check, killing all ONOS processes" +
@@ -120,16 +124,14 @@
         tempOnosIp = []
         for i in range( main.numCtrls ):
             tempOnosIp.append( main.ONOSip[i] )
-        apps=main.apps
-        if main.diff:
-            apps = main.apps+","+main.diff.pop(0)
-        else: main.log.error( "App list is empty" )
         onosUser = main.params[ 'ENV' ][ 'cellUser' ]
+        main.step("Creating cell file")
         main.ONOSbench.createCellFile( main.ONOSbench.ip_address,
                                        "temp",
                                        main.Mininet1.ip_address,
                                        apps,
-                                       tempOnosIp )
+                                       tempOnosIp,
+                                       onosUser )
 
         main.step( "Apply cell to environment" )
         cellResult = main.ONOSbench.setCell( "temp" )
@@ -142,7 +144,8 @@
                                  onfail="Failed to apply cell to environment " )
 
         main.step( "Creating ONOS package" )
-        main.ONOSbench.handle.sendline( "cp ~/OnosSystemTest/TestON/tests/USECASE_SegmentRouting/"+main.json.pop(0)+".json ~/onos/tools/package/config/network-cfg.json")
+        main.jsonFile=main.json.pop(0)
+        main.ONOSbench.handle.sendline( "cp "+main.path+"/"+main.jsonFile+".json ~/onos/tools/package/config/network-cfg.json")
         packageResult = main.ONOSbench.onosPackage()
         stepResult = packageResult
         utilities.assert_equals( expect=main.TRUE,
@@ -192,7 +195,10 @@
         '''
             Report errors/warnings/exceptions
         '''
-        main.log.case( "Logging test" )
+        main.case( "Logging test for " + main.jsonFile )
+        if len(main.json) > 0 :
+            main.ONOSbench.cpLogsToDir("/opt/onos/log/karaf.log",main.logdir, 
+                           copyFileName="karaf.log."+main.jsonFile+str(len(main.json)))
         #main.ONOSbench.logReport( main.ONOSip[ 0 ],
         #                          [ "INFO" ],
         #                          "a" )
@@ -210,7 +216,7 @@
         """
             Start mininet
         """
-        main.log.case( "Start Leaf-Spine 2x2 Mininet Topology" )
+        main.case( "Start Leaf-Spine "+main.jsonFile+" Mininet Topology" )
         main.log.report( "Start Mininet topology" )
 
         main.step( "Starting Mininet Topology" )