def main(): filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'Ungracefull_VSM_Migration') try: user = const.node_username pwd = const.node_password host2 = const.Node2_IP vsm_ip = const.VSM1Ip SSH = SSHConnection() time.sleep(10) out1 = SSH.cbdpctl_Migration(user, pwd, host2, vsm_ip) print out1 bytestransfered = out1[1] time.sleep(60) out2 = SSH.cbdpctl_Migration(user, pwd, host2, vsm_ip) print out2 cstatus = out2[0] cbytestransfered = out2[1] if cstatus == "transferring" or int(cbytestransfered) > int( bytestransfered): print "Pass: VSM Migration transfer resumed successfully" log.info("Pass: VSM Migration transfer resumed successfully") elif cstatus == "uptodate": print "Pass: VSM migration transfer resumed and completed successfully" log.info( "Pass: VSM migration transfer resumed and completed successfully" ) else: print "Fail: VSM Migration resume failed" log.error("Fail: VSM Migration resume failed") except Exception as e: log.error("Exception:TC: Verify ungracefull_VSM_MIgration", str(e))
def main(): filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'ActivateDR') log.info("Test ActivateDR begins") try: #GUI.HA_Maintenance(1, "maintenance") time.sleep(20) t = SSHConnection() user = const.node_username pwd = const.node_password host = const.Node1_IP vsm_ip = const.VSM1Ip out = t.cbdpctl_Migration(user, pwd, host, vsm_ip) print out[1], "Sud" if out[0] == "uptodate": GUI = WebUtils() Url = const.url password = const.password username = const.username GUI.login_EC(Url, username, password) time.sleep(5) GUI.Activate_MigrantVSM(const.BackupVSMIP) time.sleep(2) else: log.error("Migrant transfer is not uptodate") except Exception as e: log.error("Exception: TC: Activate migrant"), str(e)
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'Ungracefull_VSM_Migration') try: log.info("Test UngracefullHA_VSM_Migration begins") GUI = WebUtils() #GUI.Enable_Flash() GUI.login_EC(Url, username, password) time.sleep(5) try: GUI.Create_MigrantVSM(bkp_ip=const.BKPIP) except Exception as j: print "Error: Exception occure while creating VSM Migration", str( j) raise time.sleep(20) GUI.close_browser() print "Waiting till schedule duration for migrant transfer to begin" log.info("Waiting till schedule duration formigrant transfer to begin") user = const.node_username pwd = const.node_password host1 = const.Node1_IP vsm_ip = const.VSM1Ip time.sleep(80) SSH = SSHConnection() output = SSH.cbdpctl_Migration(user, pwd, host1, vsm_ip) print output if output[0] == "transferring": try: SSH.createSSHConnection(host1, user, pwd) time.sleep(2) SSH.exec_cmd("reboot > /dev/null &") if True: print "Rebooting Node1" log.info("Rebooting Node for ungracefull HA") else: print "Failed to Reboot Node1" log.error("Failed to Reboot Node") except Exception as f: print "Error: SSH Connection ", str(f) raise else: print "Fail:Migrant transfer did not started after schedule duration" log.error( "Fail:Migrant transfer did not started after schedule duration" ) except Exception as e: print "Exception Occured:TC: UngracefullHA_VSM_Migration", str(e) log.error("Exception Occured:TC: UngracefullHA_VSM_Migration")
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'HA_Migration') try: log.info("Testing resumability incase of gracefull HA") GUI = WebUtils() GUI.Enable_Flash() GUI.login_EC(Url, username, password) try: GUI.Create_MigrantVSM(bkp_ip=const.BKPIP) print "Migrant VSM created successfully" except Exception as j: print "Error: Exception occure while creating Migrant VSM", str(j) time.sleep(10) print "Waiting till schedule duration for MIgration to begin" user = const.node_username pwd = const.node_password host1 = const.Node1_IP host2 = const.Node2_IP vsm_ip = const.VSM1Ip time.sleep(10) SSH = SSHConnection() output = SSH.cbdpctl_Migration(user, pwd, host1, vsm_ip) if output[0] == "transferring": try: GUI.HA_Maintenance(1, "available") time.sleep(100) output = GUI.Maintenance_table_info() if not "...Error" in output[1]: print "Moved Node to maintenance Successfully" log.info("Moved Node to maintenance Successfully") else: print "Error in moving to maintenance" except Exception as f: print "Error: While moving node to maintenance ", str(f) log.error("Error: While moving node to maintenance") raise time.sleep(30) out1 = SSH.cbdpctl_Migration(user, pwd, host2, vsm_ip) print out1 bytestransfered = out1[1] time.sleep(100) out2 = SSH.cbdpctl_Migration(user, pwd, host2, vsm_ip) print out2 cstatus = out2[0] cbytestransfered = out2[1] if cstatus == "transferring" or int(cbytestransfered) > int( bytestransfered): print "Pass: Migration transfer resumed successfully" log.info("Pass: Migration transfer resumed successfully") elif cstatus == "uptodate": print "Pass: Migration resumed and completed successfully" log.info("Pass: Migration transfer resumed successfully") else: print "Fail: Migration resume failed" log.error("Fail: Migration resume failed") time.sleep(2) GUI.HA_Maintenance(1, "maintenance") time.sleep(100) if True: print "Node moved back to Available successfully" log.info("Node moved back to Available successfully") time.sleep(30) try: GUI.Migration_Enable_Disable("Disable") print "Migrant transfer disabled successfully" time.sleep(10) GUI.deleteMigrantVSM() print "Migrant VSM deleted sucessfully" time.sleep(2) GUI.close_browser() except Exception as fi: print "Error: While deleting Migrant VSM ", str(fi) raise except Exception as e: print "Exception Occured: While logging into EC" print str(e)
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'Migration_enable_disable') try: log.info("Test Resumability_Migration begins") GUI = WebUtils() #GUI.Enable_Flash() GUI.login_EC(Url, username, password) try: GUI.Create_MigrantVSM(bkp_ip=const.BKPIP) except Exception as j: print "Error: Exception occure while creating Migration", str(j) sys.exit(1) time.sleep(60) print "Waiting till schedule duration for Migration to begin" log.info("Waiting till schedule duration for Migration to begin") time.sleep(10) user = const.node_username pwd = const.node_password host1 = const.Node1_IP vsm_ip = const.VSM1Ip SSH = SSHConnection() output = SSH.cbdpctl_Migration(user,pwd,host1,vsm_ip) print output if output[0] == "transferring": try: GUI.Migration_Enable_Disable("Disable") log.info("Migration transfer disabled successfully") time.sleep(30) t = SSHConnection() t.createSSHConnection(host=host1, username=user, password=pwd) time.sleep(5) out = t.exec_cmd("jls") out1 = out.split() if vsm_ip in out1: jls = out1.index(vsm_ip) jls_id = int(out1[jls - 1]) time.sleep(20) output = t.exec_cmd("jexec %s cbdpctl -c list" % jls_id) if not output: log.info("Pass: Verified that Migration transfer did not continued after disabling transfer") else: log.error("Fail: Migration transfer is still in-progress") t.close() except Exception as z: log.error("Error: Exception occured while disabling transfer"), str(z) raise try: time.sleep(10) log.info("Enabling Migration transfer to verify resumability") GUI.Migration_Enable_Disable("Enable") log.info("Migration transfer enabled successfully") except Exception as f: log.error("Error: Exception occured while enabling transfer"), str(f) raise time.sleep(50) out1 = SSH.cbdpctl_Migration(user,pwd,host1,vsm_ip) bytestransfered = out1[1] time.sleep(30) out2 = SSH.cbdpctl_Migration(user,pwd,host1,vsm_ip) cstatus = out2[0] cbytestransfered = out2[1] if cstatus == "transferring" and int(cbytestransfered) > int(bytestransfered): log.info("Pass: Migration transfer resumed successfully") elif cstatus == "uptodate": log.info("Pass: Migration resumed and completed successfully") else: log.error("Fail: Migration resume failed") time.sleep(2) elif output[0] == "uptodate": log.info("Base snapshot transfered") else: log.info("Failed to get DR status, please recheck") time.sleep(5) try: GUI.Migration_Enable_Disable("Disable") print "Migrant transfer disabled successfully" time.sleep(10) GUI.deleteMigrantVSM() print "Migrant VSM deleted sucessfully" time.sleep(2) GUI.close_browser() except Exception as fi: print "Error: While deleting Migrant VSM ", str(fi) raise except Exception as e: log.error("Exception Occured: While logging into EC") print str(e) sys.exit(1)