Add HA test for restoring from and offline backup
- Add driver function for backing up onos data
- Add driver function for restoring from onos backup
- Add HA test HAbackupRecover
Change-Id: I127e2781044122ce12c6f25ecd8451316b204428
diff --git a/TestON/tests/HA/dependencies/HA.py b/TestON/tests/HA/dependencies/HA.py
index c61cd4f..262dbaf 100644
--- a/TestON/tests/HA/dependencies/HA.py
+++ b/TestON/tests/HA/dependencies/HA.py
@@ -3795,3 +3795,30 @@
utilities.assert_equals( expect=True, actual=nodeResults,
onpass="Nodes check successful",
onfail="Nodes check NOT successful" )
+
+ def backupData( self, main, location ):
+ """
+ Backs up ONOS data and logs to a given location on each active node in a cluster
+ """
+ result = True
+ for ctrl in main.Cluster.active():
+ try:
+ ctrl.server.handle.sendline( "rm " + location )
+ ctrl.server.handle.expect( ctrl.server.prompt )
+ main.log.debug( ctrl.server.handle.before + ctrl.server.handle.after )
+ except pexpect.ExceptionPexpect as e:
+ main.log.error( e )
+ main.cleanAndExit()
+ ctrl.CLI.log( "'Starting backup of onos data'", level="INFO" )
+ result = result and ( ctrl.server.backupData( location ) is main.TRUE )
+ ctrl.CLI.log( "'End of backup of onos data'", level="INFO" )
+ return result
+
+ def restoreData( self, main, location ):
+ """
+ Restores ONOS data and logs from a given location on each node in a cluster
+ """
+ result = True
+ for ctrl in main.Cluster.controllers:
+ result = result and ( ctrl.server.restoreData( location ) is main.TRUE )
+ return result