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, '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, 'StorageConfig') try: log.info("Test StorageConfig begins") GUI = WebUtils() GUI.login_EC(Url, username, password) if True: try: time.sleep(10) GUI.Add_Pools(1, const.NodeName + str(1), const.Pool1, const.R5, 3) time.sleep(5) GUI.Add_Pools(1, const.NodeName + str(2), const.Pool2, const.R6, 4) if True: GUI.Add_VSMS(const.VSM1Name, 1, capacity=1, ip=const.VSM1Ip) time.sleep(5) GUI.Add_VSMS(const.VSM2Name, 2, capacity=1, ip=const.VSM2Ip) if True: GUI.Add_NCFS_Volume(1, "NFSVol1", 100, "NFS", const.NFSClientIP) time.sleep(2) GUI.Add_NCFS_Volume(2, "NFSVol2", 100, "NFS", const.NFSClientIP) time.sleep(2) GUI.close_browser() else: log.error("Failed to add Volumes") else: log.error("Failed to create VSMs") except Exception as f: log.error("Exception Occured: adding pools"), str(f) except Exception as e: log.error("Exception Occured:TC: StorageConfig"), str(e) raise
def main(): Url = const.url password = const.password username = const.username try: filename = os.path.abspath(__file__) log = Logging.getLogger(filename, 'ConfigDC') log.info("Test ConfigDC begins") GUI = WebUtils() GUI.login_EC(Url, username, password) if True: GUI.Addsite(n=1, sitename=const.SiteName, location=const.Location) if True: GUI.Add_HA_Group(n=1, haname=const.HaGroupName, ip1=const.HaG_IP1, ip2=const.HaG_IP2) if True: GUI.Add_Node(2, const.NodeName) time.sleep(5) if True: GUI.Add_Account(const.AccountName, const.mailid, const.userpwd) if True: GUI.Add_VLAN(const.VLAN_ID, const.VLAN_Interface) time.sleep(3) if True: GUI.Configure_DA(const.Disk_Enclosure_Name, 18) GUI.close_browser() else: log.error("Failed to add account") else: log.error("Failed to add Node") else: log.error("Failed to add HA Group") else: log.error("Failed to create Site") else: log.error("Failed to Login to EC ") except Exception as e: print "Exception Occured:TC: ConfigDC", str(e) raise
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 try: print("Test begins") GUI = WebUtils() GUI.login_EC(Url, username, password) 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 ", str(fi) raise 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, '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, '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)