def main(): filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'UngracefullHA_DR') try: user = const.node_username pwd = const.node_password host2 = const.Node2_IP vsm_ip = const.VSM1Ip SSH = SSHConnection() time.sleep(180) out1 = SSH.cbdpctl_status(user, pwd, host2, vsm_ip) print out1 bytestransfered = out1[1] time.sleep(60) out2 = SSH.cbdpctl_status(user, pwd, host2, vsm_ip) print out2 cstatus = out2[0] cbytestransfered = out2[1] if cstatus == "Transferring" or int(cbytestransfered) > int( bytestransfered): print "Pass: DR transfer resumed successfully" log.info("Pass: DR transfer resumed successfully") elif cstatus == "Uptodate": print "Pass: DR resumed and completed successfully" log.info("Pass: DR resumed and completed successfully") else: print "Fail: DR resume failed" log.error("Fail: DR resume failed") except Exception as e: log.error("Exception:TC: Verify ungracefullDR") print str(e)
def main(): filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'ActivateDR') log.info("Test ActivateDR begins") try: GUI = WebUtils() Url = const.url password = const.password username = const.username GUI.login_EC(Url, username, password) time.sleep(5) 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_status(user, pwd, host, vsm_ip) if out[0] == "uptodate": GUI.Activate_DR(const.BackupVSMIP) time.sleep(2) GUI.close_browser() else: log.error("DR transfer is not uptodate") except Exception as e: log.error("Exception: TC: ActivateDR"), str(e)
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'UngracefullHA_DR') try: user = const.node_username pwd = const.node_password host2 = const.Node2_IP vsm_ip = const.VSM1Ip SSH = SSHConnection() time.sleep(130) out1 = SSH.cbdpctl_status(user, pwd, host2, vsm_ip) print out1 bytestransfered = out1[1] time.sleep(50) out2 = SSH.cbdpctl_status(user, pwd, host2, vsm_ip) print out2 cstatus = out2[0] cbytestransfered = out2[1] if cstatus == "transferring" and int(cbytestransfered) > int( bytestransfered): print "Pass: DR transfer resumed successfully" log.info("Pass: DR transfer resumed successfully") elif cstatus == "uptodate": print "Pass: DR resumed and completed successfully" log.info("Pass: DR resumed and completed successfully") else: print "Fail: DR resume failed" log.error("Fail: DR resume failed") time.sleep(60) GUI = WebUtils() GUI.login_EC(Url, username, password) GUI.HA_Maintenance(1, "Maintenance") if True: log.info("Moved Node to available state") else: log.warning("Move the Node to available state") except Exception as e: log.error("Exception:TC: Verify ungracefullDR"), str(e)
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'UngracefullHA_DR') try: log.info("Test UngracefullHA_DR begins") GUI = WebUtils() GUI.Enable_Flash() GUI.login_EC(Url, username, password) time.sleep(5) try: GUI.Create_DR(name=const.DRName, bkp_ip=const.BKPIP) except Exception as j: print "Error: Exception occure while creating DR", str(j) raise time.sleep(20) GUI.close_browser() print "Waiting till schedule duration for DR to begin" log.info("Waiting till schedule duration for DR 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_status(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:DR transfer did not started after schedule duration" log.error( "Fail:DR transfer did not started after schedule duration") except Exception as e: print "Exception Occured:TC: UngracefullHA_DR", str(e) log.error("Exception Occured:TC: UngracefullHA_DR")
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'Networkloss_DR') try: log.info("Testing resumability incase of networkloss") GUI = WebUtils() GUI.Enable_Flash() GUI.login_EC(Url, username, password) try: GUI.Create_DR(name=const.DRName, bkp_ip=const.BKPIP) print "DR created successfully" except Exception as j: print "Error: Exception occure while creating DR", str(j) time.sleep(20) print "Waiting till schedule duration for DR to begin" GUI.close_browser() time.sleep(80) user = const.node_username pwd = const.node_password host1 = const.Node1_IP vsm_ip = const.VSM1Ip SSH = SSHConnection() output = SSH.cbdpctl_status(user, pwd, host1, vsm_ip) print output if output[0] == "Transferring": try: interface = const.interface t1 = SSHConnection() t1.createSSHConnection(host1, user, pwd) time.sleep(5) t1.exec_cmd("ifconfig %s down" % interface) bkpip = const.BKPIP response = pyping.ping(bkpip) if response.ret_code == 0: print("reachable") log.error("Unable to bring down data network") else: print("data network is down") log.info("Data network is down") time.sleep(30) output = t1.cbdpctl_status(user, pwd, host1, vsm_ip) if output: print "Fail: DR transfer is still running after Data N/W loss" log.error( "Fail: DR transfer is still running after Data N/W loss" ) except Exception as z: print "Pass: DR transfer did not continue after Data N/W loss" log.info( "Pass: DR transfer did not continue after Data N/W loss") try: time.sleep(20) print "Making vlan interface Up" log.info("Making vlan interface up") interface = const.interface t1 = SSHConnection() t1.createSSHConnection(host1, user, pwd) time.sleep(5) t1.exec_cmd("ifconfig %s up" % interface) print "vlan network is up" time.sleep(60) output = t1.cbdpctl_status(user, pwd, host1, vsm_ip) if output: print "pass: DR transfer is continuied after making nw interface ip" log.info( "pass: DR transfer is continuied after making nw interface ip" ) time.sleep(5) try: GUI.DR_Enable_Disable("Disable") print "DR transfer disabled successfully" time.sleep(10) GUI.deleteDR() print "DR VSM deleted sucessfully" time.sleep(2) GUI.close_browser() except Exception as fi: print "Error: While deleting DR VSM " print str(fi) raise except Exception as z: print "fail: DR transfer did not continue after Data N/W UP", str( z) log.error( "fail: DR transfer did not continue after Data N/W UP") except Exception as e: print "Exception Occured: While logging into EC", str(e)
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'HA_DR') try: log.info("Testing resumability incase of gracefull HA") GUI = WebUtils() GUI.Enable_Flash() GUI.login_EC(Url, username, password) try: GUI.Create_DR(name=const.DRName, bkp_ip=const.BKPIP) print "DR created successfully" except Exception as j: print "Error: Exception occure while creating DR", str(j) time.sleep(20) print "Waiting till schedule duration for DR to begin" user = const.node_username pwd = const.node_password host1 = const.Node1_IP host2 = const.Node2_IP vsm_ip = const.VSM1Ip time.sleep(90) SSH = SSHConnection() output = SSH.cbdpctl_status(user,pwd,host1,vsm_ip) #print output if output[0] == "transferring": try: GUI.HA_Maintenance(1, "Available") time.sleep(30) 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_status(user,pwd,host2,vsm_ip) print out1 bytestransfered = out1[1] completed = out1[2] time.sleep(100) out2 = SSH.cbdpctl_status(user,pwd,host2,vsm_ip) print out2 cstatus = out2[0] cbytestransfered = out2[1] ccompleted = out2[2] if cstatus == "transferring" and int(cbytestransfered) > int(bytestransfered): print "Pass: DR transfer resumed successfully" log.info("Pass: DR transfer resumed successfully") elif cstatus == "uptodate": print "Pass: DR resumed and completed successfully" log.info("Pass: DR transfer resumed successfully") else: print "Fail: DR resume failed" log.error("Fail: DR resume failed") time.sleep(2) GUI.HA_Maintenance(1, "Maintenance") if True: print "Node moved back to Available successfully" log.info("Node moved back to Available successfully") except Exception as e: print "Exception Occured: While logging into EC", str(e)
def main(): Url = const.url password = const.password username = const.username filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'Resumability_DR') try: log.info("Test Resumability_DR begins") GUI = WebUtils() GUI.Enable_Flash() GUI.login_EC(Url, username, password) try: GUI.Create_DR(name=const.DRName, bkp_ip=const.BKPIP) except Exception as j: print "Error: Exception occure while creating DR", str(j) sys.exit(1) time.sleep(20) print "Waiting till schedule duration for DR to begin" log.info("Waiting till schedule duration for DR to begin") time.sleep(90) user = const.node_username pwd = const.node_password host1 = const.Node1_IP vsm_ip = const.VSM1Ip SSH = SSHConnection() output = SSH.cbdpctl_status(user, pwd, host1, vsm_ip) print output if output[0] == "transferring": try: GUI.DR_Enable_Disable("Disable") log.info("DR 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 DR transfer did not continued after disabling transfer" ) else: log.error("Fail: DR 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 DR transfer to verify resumability") GUI.DR_Enable_Disable("Enable") log.info("DR transfer enabled successfully") except Exception as f: log.error( "Error: Exception occured while enabling transfer"), str(f) raise time.sleep(90) out1 = SSH.cbdpctl_status(user, pwd, host1, vsm_ip) print out1 bytestransfered = out1[1] time.sleep(50) out2 = SSH.cbdpctl_status(user, pwd, host1, vsm_ip) print out2 cstatus = out2[0] cbytestransfered = out2[1] if cstatus == "transferring" and int(cbytestransfered) > int( bytestransfered): log.info("Pass: DR transfer resumed successfully") elif cstatus == "uptodate": log.info("Pass: DR resumed and completed successfully") else: log.error("Fail: DR resume failed") time.sleep(2) GUI.close_browser() elif output[1] == "uptodate": log.info("Base snapshot transfered") else: log.info("Failed to get DR status, please recheck") except Exception as e: log.error("Exception Occured: While logging into EC"), str(e) sys.exit(1)