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(): vsmip = const.VSM1Ip clientip = const.hostIP filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'RunIO') try: log.info("Test RunIO begins") ssh = SSHConnection() ssh.createSSHConnection(clientip, username="******", password="******") time.sleep(2) ssh.exec_cmd("umount 16.10.31.200:/CBUserNFSVol1") time.sleep(2) cmd = "python IORunner.py --vsms_ip %s" % vsmip print "Running IO" print "Waiting for IO to finish....." out = ssh.exec_cmd(cmd) if "Vdbench execution completed successfully" in out: log.info("IO ran successfully") else: log.error("IO error") except Exception as e: log.error("Exception Occured:TC: RunIO"), str(e)
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, '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)