[ONOS-7756] Start/stop Atomix cluster as part of ONOS cluster setup
Change-Id: Ic2c842b4b2731284dc834da265f8fac2e862cba9
diff --git a/TestON/tests/dependencies/Cluster.py b/TestON/tests/dependencies/Cluster.py
index a67bad5..6bfbb3f 100644
--- a/TestON/tests/dependencies/Cluster.py
+++ b/TestON/tests/dependencies/Cluster.py
@@ -176,7 +176,27 @@
specificDriver=1,
getFrom=0 if installMax else 1 )
- def uninstall( self, uninstallMax ):
+ def uninstallAtomix( self, uninstallMax ):
+ """
+ Description:
+ uninstalling atomix
+ Required:
+ * uninstallMax - True for uninstalling max number of nodes
+ False for uninstalling the current running nodes.
+ Returns:
+ Returns main.TRUE if it successfully uninstalled.
+ """
+ result = main.TRUE
+ uninstallResult = self.command( "atomixUninstall",
+ kwargs={ "nodeIp": "ipAddress" },
+ specificDriver=1,
+ getFrom=0 if uninstallMax else 1,
+ funcFromCtrl=True )
+ for uninstallR in uninstallResult:
+ result = result and uninstallR
+ return result
+
+ def uninstallOnos( self, uninstallMax ):
"""
Description:
uninstalling onos
@@ -244,7 +264,31 @@
main.log.warn( ctrl.name + " may not be up." )
return onosIsUp
- def kill( self, killMax, stopOnos ):
+ def killAtomix( self, killMax, stopAtomix ):
+ """
+ Description:
+ killing atomix. It will either kill the current runningnodes or
+ max number of the nodes.
+ Required:
+ * killRemoveMax - The boolean that will decide either to kill
+ only running nodes ( False ) or max number of nodes ( True ).
+ * stopAtomix - If wish to atomix onos before killing it. True for
+ enable stop, False for disable stop.
+ Returns:
+ Returns main.TRUE if successfully killing it.
+ """
+ result = main.TRUE
+ killResult = self.command( "atomixKill",
+ args=[ "ipAddress" ],
+ specificDriver=1,
+ getFrom=0 if killMax else 1,
+ funcFromCtrl=True )
+ for i in range( len( killResult ) ):
+ result = result and killResult[ i ]
+ self.controllers[ i ].active = False
+ return result
+
+ def killOnos( self, killMax, stopOnos ):
"""
Description:
killing the onos. It will either kill the current runningnodes or
@@ -287,7 +331,42 @@
result = result and sshR
return result
- def install( self, installMax=True, installParallel=True ):
+ def installAtomix( self, installMax=True, installParallel=True ):
+ """
+ Description:
+ Installing onos.
+ Required:
+ * installMax - True for installing max number of nodes
+ False for installing current running nodes only.
+ Returns:
+ Returns main.TRUE if it successfully installed
+ """
+ result = main.TRUE
+ threads = []
+ i = 0
+ for ctrl in self.controllers if installMax else self.runningNodes:
+ options = ""
+ if installMax and i >= self.numCtrls:
+ # TODO: is installMax supported here?
+ pass
+ if installParallel:
+ t = main.Thread( target=ctrl.Bench.atomixInstall,
+ name="atomix-install-" + ctrl.name,
+ kwargs={ "node" : ctrl.ipAddress,
+ "options" : options } )
+ threads.append( t )
+ t.start()
+ else:
+ result = result and \
+ main.ONOSbench.atomixInstall( node=ctrl.ipAddress, options=options )
+ i += 1
+ if installParallel:
+ for t in threads:
+ t.join()
+ result = result and t.result
+ return result
+
+ def installOnos( self, installMax=True, installParallel=True ):
"""
Description:
Installing onos.
@@ -306,7 +385,7 @@
options = "-nf"
if installParallel:
t = main.Thread( target=ctrl.Bench.onosInstall,
- name="install-" + ctrl.name,
+ name="onos-install-" + ctrl.name,
kwargs={ "node" : ctrl.ipAddress,
"options" : options } )
threads.append( t )