Allow skipping onos/atomix cluster restart in TestON startup

Change-Id: Ib0cb59cb1c2d2f11d792e839b3c91bb236842c56
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
index b5b769a..17a37c2 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.params
@@ -47,6 +47,7 @@
     </CASE1>
 
     <CASE10>
+        <restartCluster>True</restartCluster>
         <numNodes>1</numNodes>
         <Apps>
             org.onosproject.openflow
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
index 4fb94c9..cda6ff7 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_1node/SAMPstartTemplate_1node.py
@@ -81,7 +81,8 @@
         import time
         main.case( "Start up " + str( main.Cluster.numCtrls ) + "-node onos cluster." )
         main.step( "Start ONOS cluster with basic (drivers) app." )
-        stepResult = main.testSetUp.ONOSSetUp( main.Cluster )
+        main.restartCluster = True if main.params[ 'CASE10' ][ 'restartCluster' ] == 'True' else False
+        stepResult = main.testSetUp.ONOSSetUp( main.Cluster, restartCluster=main.restartCluster )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully started basic ONOS cluster ",
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
index d7f8c7d..4d50882 100755
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.params
@@ -36,6 +36,7 @@
     </CASE1>
 
     <CASE10>
+        <restartCluster>True</restartCluster>
         <Apps>
             org.onosproject.openflow
         </Apps>
diff --git a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
index a8634ae..745fbfb 100644
--- a/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
+++ b/TestON/tests/SAMP/SAMPstartTemplate_3node/SAMPstartTemplate_3node.py
@@ -84,7 +84,8 @@
         main.case( "Start up " + str( main.Cluster.numCtrls ) + "-node onos cluster." )
 
         main.step( "Start ONOS cluster with basic (drivers) app." )
-        stepResult = main.testSetUp.ONOSSetUp( main.Cluster )
+        main.restartCluster = True if main.params[ 'CASE10' ][ 'restartCluster' ] == 'True' else False
+        stepResult = main.testSetUp.ONOSSetUp( main.Cluster, restartCluster=main.restartCluster )
         utilities.assert_equals( expect=main.TRUE,
                                  actual=stepResult,
                                  onpass="Successfully started basic ONOS cluster ",
diff --git a/TestON/tests/dependencies/ONOSSetup.py b/TestON/tests/dependencies/ONOSSetup.py
index 38ba838..547222b 100644
--- a/TestON/tests/dependencies/ONOSSetup.py
+++ b/TestON/tests/dependencies/ONOSSetup.py
@@ -483,7 +483,7 @@
                    extraClean=None, cleanArgs=None, skipPack=False, installMax=False,
                    atomixClusterSize=None, useSSH=True, killRemoveMax=True, stopAtomix=False,
                    stopOnos=False, installParallel=True, cellApply=True,
-                   includeCaseDesc=True ):
+                   includeCaseDesc=True, restartCluster=True ):
         """
         Description:
             Initial ONOS setting up of the tests. It will also verify the result of each steps.
@@ -523,6 +523,7 @@
                 removing/killing running nodes only.
             * stopAtomix - True if wish to stop atomix before killing it.
             * stopOnos - True if wish to stop onos before killing it.
+            * restartCluster - True if wish to kill and restart atomix and onos clusters
         Returns:
             Returns main.TRUE if it everything successfully proceeded.
         """
@@ -556,25 +557,34 @@
                                                tempOnosIp, installMax,
                                                atomixClusterSize )
 
-        atomixKillResult = self.killingAllAtomix( cluster, killRemoveMax, stopAtomix )
-        onosKillResult = self.killingAllOnos( cluster, killRemoveMax, stopOnos )
-        killResult = atomixKillResult and onosKillResult
+        if restartCluster:
+            atomixKillResult = self.killingAllAtomix( cluster, killRemoveMax, stopAtomix )
+            onosKillResult = self.killingAllOnos( cluster, killRemoveMax, stopOnos )
+            killResult = atomixKillResult and onosKillResult
+        else:
+            killResult = main.TRUE
 
-        atomixUninstallResult = self.uninstallAtomix( cluster, killRemoveMax )
-        onosUninstallResult = self.uninstallOnos( cluster, killRemoveMax )
-        uninstallResult = atomixUninstallResult and onosUninstallResult
-        self.processList( extraApply, applyArgs )
+        if restartCluster:
+            atomixUninstallResult = self.uninstallAtomix( cluster, killRemoveMax )
+            onosUninstallResult = self.uninstallOnos( cluster, killRemoveMax )
+            uninstallResult = atomixUninstallResult and onosUninstallResult
+            self.processList( extraApply, applyArgs )
 
-        packageResult = main.TRUE
-        if not skipPack:
-            packageResult = self.buildOnos(cluster)
+            packageResult = main.TRUE
+            if not skipPack:
+                packageResult = self.buildOnos(cluster)
 
-        atomixInstallResult = self.installAtomix( cluster, installParallel )
-        onosInstallResult = self.installOnos( cluster, installMax, installParallel )
-        installResult = atomixInstallResult and onosInstallResult
+            atomixInstallResult = self.installAtomix( cluster, installParallel )
+            onosInstallResult = self.installOnos( cluster, installMax, installParallel )
+            installResult = atomixInstallResult and onosInstallResult
 
-        self.processList( extraClean, cleanArgs )
-        secureSshResult = self.setupSsh( cluster )
+            self.processList( extraClean, cleanArgs )
+            secureSshResult = self.setupSsh( cluster )
+        else:
+            packageResult = main.TRUE
+            uninstallResult = main.TRUE
+            installResult = main.TRUE
+            secureSshResult = main.TRUE
 
         onosServiceResult = self.checkOnosService( cluster )