def fcr_state_persist_enabled(): """ Check if FCR is enabled, if not bail out and ask user to enable it. When FCR is enabled, do a reboot then check FCR is still enabled. """ host = sys.argv[1] user = sys.argv[2] password = sys.argv[7] #test_file = '/home/RunFromHere/ini/SwitchMatrix.csv' #csv_file = csv.DictReader(open(test_file, 'r'), delimiter=',', quotechar='"') fcr_state = fcr_tools.switch_status() state = fcr_state['fcr_enabled'] if state is True: anturlar.fos_cmd("switchdisable") print('\n\nSleeping: 10') liabhar.JustSleep(10) enabled = fcr_tools.switch_status() if enabled['fcr_enabled'] is True: anturlar.fos_cmd("switchenable") print('\n\nSleeping: 10') liabhar.JustSleep(10) print("\n\nENABLE/DISABLE TEST PASSED") else: pass else: print("\n\nENABLE/DISABLE TEST FAILED") print("Please enable fcr for this test and try again") sys.exit(0) print('\n\nSleeping: 10') liabhar.JustSleep(10) si = anturlar.SwitchInfo() cn = si.chassisname() a = cofra.switch_power_off_on(cn, 'off') print('Sleeping: 20') liabhar.JustSleep(20) a = cofra.switch_power_off_on(cn, 'on') print('Sleeping: 120') liabhar.JustSleep(120) anturlar.connect_tel_noparse(host, user, password) si = anturlar.SwitchInfo() #print("GETTINGFCRSTATE") fcr_state = fcr_tools.switch_status() state = fcr_state['fcr_enabled'] if state is True: print('Reboot Complete. FCR State remains consistent') print('TEST PASSED') else: print('FCR State changed.') print('TEST FAILED')
def switch_status(): """ Retrieve FCR fabric and return info. Variable #'s: 0) Switch name 1) IP address 1) Chassis or Pizza Box 2) VF or not 3) FCR Enabled 4) Base Configured return dictionary with {switch_name, ipaddr, chassis, vf_enabled, base, fcr_enabled}} """ fcrinfo = anturlar.FcrInfo() si = anturlar.SwitchInfo() initial_checks = si.switch_status() print('\n\n' + '=' * 20) print("Switch Name : %s" % initial_checks[0]) print("IP address : %s" % initial_checks[1]) print("Chassis : %s" % initial_checks[2]) print("VF enabled : %s" % initial_checks[3]) print("FCR enabled : %s" % initial_checks[4]) print("Base configured : %s" % initial_checks[5]) print('=' * 20 + '\n\n') switch_info = { 'switch_name': initial_checks[0], 'ipaddr': initial_checks[1], 'chassis': initial_checks[2], 'vf_enabled': initial_checks[3], 'fcr_enabled': initial_checks[4], 'base': initial_checks[5] } return (switch_info)
def def_zone_reset(fid1, fid2): si = anturlar.SwitchInfo() sleep = liabhar.count_down(3) g = [fid1, fid2] for i in g: anturlar.fos_cmd("setcontext %s" % i) a = str(si.ae_ports()) b = a.strip('[') b = b.strip(']') index = (b[0]) port = (b[1]) reg_ex = [b"no] "] ### Needs to be square brackets to send as a list z = anturlar.fos_cmd_regex( "defzone --allaccess", reg_ex, 9) #### use regex because return is something other than "root:" anturlar.fos_cmd("yes") sleep y = anturlar.fos_cmd_regex("cfgsave", reg_ex, 9) anturlar.fos_cmd("yes") sleep for i in port: anturlar.fos_cmd(" portdisable %s" % port) sleep anturlar.fos_cmd(" portenable %s" % port) sleep anturlar.fos_cmd("switchshow") sys.exit()
def license_restore(): #### NEED TO ADD supportftp settings AND Timeserver """ Ned to replace sys.argv statements as the order can change on the cli input by user """ host = sys.argv[1] user = sys.argv[2] password = sys.argv[7] print(password) si = anturlar.SwitchInfo() cn = si.chassisname() test_file = '/home/RunFromHere/ini/SwitchLicenses.csv' csv_file = csv.DictReader(open(test_file, 'r'), delimiter=',', quotechar='"') for line in csv_file: a = (type(line)) switch_name = (line['Nickname']) if switch_name == cn[0]: del (line['']) del (line['Nickname']) del (line['IP Address']) a = (list(line.values())) for i in a: if i != (''): anturlar.fos_cmd("licenseadd %s" % i) liabhar.JustSleep(5) anturlar.fos_cmd("echo y | reboot") print('\n\nSleeping: 150') liabhar.JustSleep(150) anturlar.connect_tel_noparse(host, user, "password") anturlar.fos_cmd('licenseshow') return (True)
def ex_deconfig(): """ Find all EX-Ports AND VEX-Ports on either director or pizzabox and deconfigure. This parses "portcfgshow" command for any EX-Port, online or not, and deconfigures. This includes VEX ports as well. """ si = anturlar.SwitchInfo() anturlar.fos_cmd("switchdisable") portlist = si.all_ports() if si.am_i_director: for i in portlist: slot = i[0] port = i[1] pattern = re.compile(r'(?:\EX\sPort\s+)(?P<state> ON)') cmd = anturlar.fos_cmd("portcfgshow %a/%a" % (slot, port)) ex = pattern.search(cmd) if ex: anturlar.fos_cmd("portcfgexport %s/%s %s" % (slot, port, "-a 2")) anturlar.fos_cmd("portcfgvexport %s/%s %s" % (slot, port, "-a 2")) else: for i in portlist: print(i) port = i[1] pattern = re.compile(r'(?:\EX\sPort\s+)(?P<state> ON)') cmd = anturlar.fos_cmd("portcfgshow %a" % port) ex = pattern.search(cmd) if ex: anturlar.fos_cmd("portcfgexport %s %s" % (port, "-a 2")) anturlar.fos_cmd("portcfgvexport %s %s" % (port, "-a 2")) cmd_cap = anturlar.fos_cmd("switchenable") print('\n\nAll EX_ports found are now deconfigured.') return (cmd_cap)
def main(): my_ip = "10.38.37.50" user_name = "root" psswd = "pass" cons_out = anturlar.login() cons_out = anturlar.fos_cmd("") cons_out = anturlar.clear_stats() cons_out = anturlar.fos_cmd("switchshow") print(cons_out) ################################################################################# ################################################################################# #### test the SWICH INFO CLASS ## si = anturlar.SwitchInfo() print(si) cons_out = anturlar.close_tel()
def all_ex_ports_with_edge_fid(): """ Capture all ex ports for both Chassis and Pizza Box using "switchshow" command, """ si = anturlar.SwitchInfo() anturlar.fos_cmd("setcontext %s" % si.base_check()) ###################NEW capture_cmd = si.__getportlist__("EX-Port") print(capture_cmd) length = len(capture_cmd) print(length) ex = [] for i in capture_cmd: slot = i[0] port = i[1] a = anturlar.fos_cmd("portcfgexport %s/%s" % (slot, port)) fid = (re.findall('Edge Fabric ID:\s+(\d{1,3})', a)) fid = int(fid[0]) ex_list = [slot, port, fid] ex.append(ex_list) print("YYYYYYYYYYYYYYYYYY") print(ex) print("ZZZZZZZZZZZZZZZZZZ") print(ex[1]) sys.exit() return (ex)
def cfgupload(ftp_ip, ftp_user, ftp_pass, clear=0): """ capture any information for testing of the configdownload - including mapspolicy --show mapsconfig --show flow --show flow --show -ctrlcfg relayconfig --show bottleneckmon --status then perform configupload config upload Nimbus_______________Odin_86__:FID25:root> configupload Protocol (scp, ftp, sftp, local) [ftp]: ftp Server Name or IP Address [host]: 10.38.38.138 User Name [user]: ftp2 Path/Filename [<home dir>/config.txt]: Odin_configupload.txt Section (all|chassis|FID# [all]): all Password: or configdownload [- all ] [-p ftp | -ftp] ["host","user","path"[,"passwd"]] configdownload [- all ] [-p scp | -scp ] ["host","user","path"] """ sw_info = anturlar.SwitchInfo() sw_info_ls = sw_info.ls() fid_now = sw_info.ls_now() cons_out = anturlar.fos_cmd(" ") sw_ip = sw_info.ipaddress() f = "%s%s%s" % ("logs/Configupload_test_case_file", sw_ip, ".txt") if clear == 1: ff = liabhar.FileStuff(f, 'w+b') #### reset the log file else: ff = liabhar.FileStuff(f, 'a+b') #### open for appending header = "%s%s%s%s" % ("\nCONFIGUPLOAD CAPTURE FILE \n", " sw_info ipaddr ", sw_ip, "\n==============================\n\n") ff.write(header) ff.close() ff = liabhar.FileStuff(f, 'a+b') #### open the log file for writing ff.write(str(sw_info_ls)) ff.write("\n" * 2) cons_out = anturlar.fos_cmd("setcontext %s" % fid_now) #cons_out = anturlar.fos_cmd(" ") configdown_cmd = ("configupload -all -p ftp %s,%s,/configs/%s.txt,%s") % ( ftp_ip, ftp_user, sw_ip, ftp_pass) ftp_ip, ftp_user, ftp_pass cons_out = anturlar.fos_cmd(configdown_cmd)
def ports_disable(portlist="", t=1, wait=10): """ port disable for the number of time passed in should be no reason to do more than one time """ if portlist == "": si = anturlar.SwitchInfo() portlist = si.all_ports() for x in range(1, t + 1): for a in portlist: cons_out = anturlar.fos_cmd("portdisable %s" % a)
def ha_failover_check_frame_log(times=1): """ """ sw_info = anturlar.SwitchInfo() #fid_now = sw_info.ls_now() ip_addr = sw_info.ipaddress() go_or_not = sw_info.synchronized() cons_out = anturlar.fos_cmd(" ") username = '******' pwrd = 'password' #counter = 1 new_connect = True liabhar.count_down(10) while times > 0: cofra.ha_failover(1) print("\n\n\n") print("@"*60) print("HA Failovers remaining -- %s " % times) print("@"*60) anturlar.connect_tel_noparse(ip_addr,'root','password') times -= 1 flog_status = maps_tools.frameview_status() print("$"*80) print("$"*80) print(flog_status) print("$"*80) print("$"*80) if 'Enabled' in flog_status: print("Framelog is Enabled") elif 'Disabled' in flog_status: print("Framelog is Disabled") sys.exit() else: print("Framelog State is UnKnown") return(flog_status)
def get_licenses(ip): anturlar.connect_tel_noparse(ip, 'root', 'password') sw_info = anturlar.SwitchInfo() #sw_ip = sw_info.ipaddr sw_name = sw_info.switch_name() f = "%s%s%s" % ("logs/Switch_Licenses/License_File_", sw_name, ".txt") ff = liabhar.FileStuff(f, 'a+b') ###open new file or clobber old header = "%s%s%s%s" % ("\nLICENSE FILE \n", ip + "\n", sw_name, "\n==============================\n\n") cons_out = anturlar.fos_cmd("licenseshow") ff.write(header) ff.write(cons_out + "\n") ff.close()
def ge_ports(): """ Return a list of the ge-ports in the current FID """ si = anturlar.SwitchInfo() capture_cmd = anturlar.fos_cmd("switchshow") if si.am_i_director: ras = re.compile('\s([0-9]{1,2})\s+([a-z]{1,3}[0-9])') ge_ports = ras.findall(capture_cmd) return (ge_ports) else: ras = re.compile('\s?(ge[0-9]{1,2})') ge_ports = ras.findall(capture_cmd) return (ge_ports)
def make_changes(): """ make changes so configdownload can reload previous configuration """ s = anturlar.SwitchInfo() ls_list = s.ls() for l in ls_list: cons_out = anturlar.fos_cmd("echo Y | mapsconfig --purge ") cons_out = anturlar.fos_cmd("echo Y | flow --delete all") return(True)
def enable_disabled_ports(): si = anturlar.SwitchInfo() portlist = si.disabled_ports() print(type(portlist)) print(portlist) if si.am_i_director: for i in portlist: slot = i[0] port = i[1] cons_out = anturlar.fos_cmd("portenable %a/%a" % (slot, port)) else: for i in portlist: pt = i[0] #port = (int(pt)) cons_out = anturlar.fos_cmd("portenable %s" % pt)
def create_ls(number_of_ls): si = anturlar.SwitchInfo() #sleep = liabhar.count_down(10) a = number_of_ls print(a) print("9999999999999999999999999999999999999999999") reg_ex = [b"[y/n]?:"] for i in a: print(i) print(type(i)) #sys.exit() z = anturlar.fos_cmd_regex("lscfg --create %s" % i, reg_ex, 9) #### use regex because return is something other than "root:" anturlar.fos_cmd("y") anturlar.fos_cmd("lscfg --show") #sleep print("done")
def fcr_state_persist_disabled(): host = (sys.argv[1]) user = sys.argv[2] password = sys.argv[7] test_file = '/home/RunFromHere/ini/SwitchMatrix.csv' csv_file = csv.DictReader(open(test_file, 'r'), delimiter=',', quotechar='"') fcr_state = switch_status() state = fcr_state['fcr_enabled'] if state is False: #the same to here disabled is false, enabled is true anturlar.fos_cmd("switchdisable") print('\n\nSleeping: 10') liabhar.JustSleep(10) enabled = switch_status() if enabled['fcr_enabled'] is False: anturlar.fos_cmd("switchenable") print('\n\nSleeping: 10') liabhar.JustSleep(10) print("\n\nENABLE/DISABLE TEST PASSED") else: pass else: print("\n\nENABLE/DISABLE TEST FAILED") print("Please disable fcr for this test and try again") sys.exit(0) print('\n\nSleeping: 10') liabhar.JustSleep(10) si = anturlar.SwitchInfo() cn = si.chassisname() a = cofra.switch_power_off_on(cn, 'off') print('\n\nSleeping: 20') liabhar.JustSleep(20) a = cofra.switch_power_off_on(cn, 'on') print('\n\nSleeping: 120') liabhar.JustSleep(120) anturlar.connect_tel_noparse(host, user, password) fcr_state = switch_status() state = fcr_state['fcr_enabled'] if state is False: print('Reboot Complete. FCR State remains consistent') print('TEST PASSED') else: print('FCR State changed.') print('TEST FAILED') sys.exit(0) #######################
def configdl(clear=0): """ capture any information for testing of the configdownload - including mapspolicy --show mapsconfig --show flow --show flow --show -ctrlcfg relayconfig --show bottleneckmon --status then perform configupload config upload Nimbus_______________Odin_86__:FID25:root> configupload Protocol (scp, ftp, sftp, local) [ftp]: ftp Server Name or IP Address [host]: 10.38.38.138 User Name [user]: ftp2 Path/Filename [<home dir>/config.txt]: Odin_configupload.txt Section (all|chassis|FID# [all]): all Password: or configdownload [- all ] [-p ftp | -ftp] ["host","user","path"[,"passwd"]] configdownload [- all ] [-p scp | -scp ] ["host","user","path"] """ #### capture maps config all FIDS #### capture flow config all FIDS #### sw_info = anturlar.SwitchInfo() sw_info_ls = sw_info.ls() fid_now = sw_info.ls_now() cons_out = anturlar.fos_cmd(" ") sw_ip = sw_info.ipaddress() cons_out = anturlar.fos_cmd("setcontext %s" % fid_now) #cons_out = anturlar.fos_cmd(" ") configdown_cmd = ( "configdownload -all -p ftp 10.38.35.131,ftp1,/configs/%s.txt,ftp2" ) % (sw_ip) cons_out = anturlar.fos_cmd(configdown_cmd)
def ha_failover(times=1): """ do HA failover on directors do hareboot on pizza box """ #### steps #### 1. Determine Pizza box or Director #### 2. save username and password #### 3. HA Failover or HA reboot #### 4. wait some time #### 5. reconnect sw_info = anturlar.SwitchInfo() print(sw_info) ip_addr = sw_info.ipaddress() chassis = sw_info.am_i_director #sys.exit() while times > 0: print("\n\n\n") print("@" * 60) print("HA Failovers remaining -- %s " % times) print("@" * 60) times -= 1 liabhar.count_down(10) if chassis: capture = anturlar.fos_cmd("echo Y | hafailover") else: capture = anturlar.fos_cmd("hareboot") liabhar.count_down(300) tn = anturlar.connect_tel_noparse(ip_addr, 'root', 'password') switch_sync = sw_info.synchronized() print("\n\n") print("@" * 60) print("VALUE OF switch_sync is -- %s " % switch_sync) print("@" * 60) while switch_sync is False: liabhar.count_down(120) switch_sync = sw_info.synchronized() print("\n\n") print("@" * 60) print("The VALUE OF switch_sync is -- %s " % switch_sync) print("@" * 60) return (tn)
def ve_ports(): """ Return a list of the VE-ports in the current FID """ si = anturlar.SwitchInfo() capture_cmd = anturlar.fos_cmd("switchshow") if si.am_i_director: ras = re.compile( '\s?([0-9]{1,3})\s+(\d+)\s+(?:[-0-9a-f]{6})\s+(?:[-id]{2})\s+(?:[-UNG12486]{2,3})\s+(?:[_\w]{5,9})(?:\s+VE)' ) ve_ports = ras.findall(capture_cmd) print('$$$$$$$$$$$$$$$$$$$$') #print(ve_ports) return (ve_ports) else: ras = re.compile( '\s?([0-9]{1,3})\s+(?:\d+)\s+(?:[-0-9a-f]{6})\s+(?:[-id]{2})\s+(?:[-UNG12486]{2,3})\s+(?:[_\w]{5,9})(?:\s+VE)' ) ve_ports = ras.findall(capture_cmd) #print(ve_ports) return (ve_ports)
def ports_enable(portlist="", t=1, wait=10): """ port enable for the number of time passed in there should be no reason for time to be more than 1 """ if portlist == "": si = anturlar.SwitchInfo() portlist = si.all_ports() print('$$$$$$$$$$$$$$$$$$$$') print(type(portlist)) print(portlist) if si.am_i_director == (True): for x in range(1, t + 1): for i in portlist: slot = i[0] print('$$$$$$$$$$$$$$$$$$$$') print(slot) port = i[1] print(port) cons_out = anturlar.fos_cmd("portenable %a/%a" % (slot, port)) else: for x in range(1, t + 1): for i in portlist: cons_out = anturlar.fos_cmd("portenable %i" % i) else: if si.am_i_director == "1": for x in range(1, t + 1): for i in portlist: slot = i[0] port = i[1] cons_out = anturlar.fos_cmd("portenable %a/%a" % (slot, port)) else: for x in range(1, t + 1): for a in portlist: cons_out = anturlar.fos_cmd("portenable " + a)
def check_gen_all_stats(): """ start the gen_all SIM ports test and capture the number of runs the percent of run, the frames generated brom IngrPort and frames generated to EgrPort """ sw_info = anturlar.SwitchInfo() sw_info_ls = sw_info.ls() fid_now = sw_info.ls_now() sw_ip = sw_info.ipaddress() fv = anturlar.FlowV() fv.toggle_all() #### default is to turn all ports to SIM ports fv.genAll("on") f = "%s%s%s" % ("logs/Gen_all_stats_test_case_file", sw_ip, ".txt") clear = 0 if clear == 1: ff = liabhar.FileStuff(f, 'w+b') #### reset the log file else: ff = liabhar.FileStuff(f, 'a+b') #### open for appending st = "Runs Percent Ingrport Egrport \n" header = "%s%s%s%s" % ("\nGEN ALL CAPTURE FILE \n", " sw_info ipaddr ", sw_ip, "\n==============================\n\n") ff.write(header) ff.write(st) d = 0 while d <= 1000: stats = fv.genAllStats() print(stats) print("run number %s" % d) ff.write(stats) liabhar.count_down(60) d += 1 ff.close()
def ports_toggle(portlist="", t=2, wait=10): """ port disable / port enable for the number of times passed in """ #### this is for pizza box #### need to add chassis #### if portlist == "": si = anturlar.SwitchInfo() portlist = si.all_ports() for x in range(1, t): for a in portlist: cons_out = anturlar.fos_cmd("portdisable %s" % a) liabhar.count_down(wait) for a in portlist: cons_out = anturlar.fos_cmd("portenable %s" % a) liabhar.count_down(10) liabhar.count_down(wait)
def slotpower_off_on_check_devices(): si = anturlar.SwitchInfo() fcrc = anturlar.FcrInfo() fi = anturlar.FcipInfo() ip_address = fcr_tools.all_switches_in_bb_ip() switch_info = fcr_tools.bb_fabric_switch_status() #blades = si.blades() #ex_ports = si.ex_ports() b = (len(switch_info)) print("The number of switches in backbone is:", b) print('\n\n\n') print('IP addresses of all switches in Backbone:') print(ip_address) print('\n\n\n') for i in ip_address: print(i) anturlar.connect_tel_noparse(i, 'root', 'password') a = si.ex_ports() print(a) sys.exit(0) ex_port = a.append(a) print('EXPORTSEXPORTS') print(ex_port)
def flow_to_each_SIM(): """ find all the SIM ports in the fabric and create a flow from each SIM port to all the Other SIM ports Since this test case finds all the switches in the fabric it might not be good to run in fabric mode steps 1. get the ip list of switches in the fabric 2. for each switch get a list of SIM ports 3. create a flow for each SIMport to all other SIM ports 4. start all of the flows if not started 5. if there are only 2 switches only send to the other switch if there are more than 2 switches then send to a random port which could also be on the same switch """ sw_info = anturlar.SwitchInfo() fid_now = sw_info.ls_now() cons_out = anturlar.fos_cmd(" ") #sw_ip = sw_info.ipaddress() f = anturlar.FabricInfo(fid_now) ip_list = f.ipv4_list() ip_count = len(ip_list) ip_c = ip_count combine_port_list = [] list_for_j = [] list_for_i = [] temp_list = [] for ip in ip_list: anturlar.connect_tel_noparse(ip, 'root', 'password') s = anturlar.SwitchInfo() cons_out = anturlar.fos_cmd(" ") cons_out = anturlar.fos_cmd("setcontext %s" % (fid_now)) ports = s.sim_ports(False) #print("\n\n\n",ports, "\n\n\n") #combine_port_list.append(ports) combine_port_list = combine_port_list + ports if ip_c == 2: list_for_i = ports #print("\n\n\nI list \n") #print(list_for_i) liabhar.count_down(10) ip_c = 1 if ip_c == 1: list_for_j = ports #print("\n\n\nJ list \n") #print(list_for_j) liabhar.count_down(10) flow_name_base = "Send_to_each_" count = 0 #### need index address for simport #### now create a flow to each simport #print(combine_port_list) for ip in ip_list: anturlar.connect_tel_noparse(ip, 'root', 'password') s = anturlar.SwitchInfo() cons_out = anturlar.fos_cmd(" ") cons_out = anturlar.fos_cmd("setcontext %s " % (fid_now)) cons_out = anturlar.fos_cmd( "flow --deact sys_gen_all_simports -fea all") #### randomize the list #combine_port_list = liabhar.randomList(combine_port_list) random.shuffle(combine_port_list) j_port_list = combine_port_list #print("\n\n\nPORT LIST RANDOMIZED \n", combine_port_list) #print("\n\n\nNEW LIST RANDOMIZED \n", new_combine_port_list) if len(ip_list) == 2: #print("\n\n\nyes only two switches\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n") liabhar.count_down(10) random.shuffle(list_for_i) #print("start I list ") for i in list_for_i: random.shuffle(list_for_j) generate_port = i[0] generate_addr = i[1] #print("\n\ngenerator port and address %s %s \n\n" %(generate_port, generate_addr)) #### this loops on the same list of combined port list #### one idea was to select a random element from the list each time #### for j in list_for_j: target_port = j[0] target_addr = j[1] #print("\n\ntarget port and address %s %s \n\n" %( target_port, target_addr)) if generate_port not in target_port: flow_name = ("%s%s" % (flow_name_base, count)) count += 1 #print(flow_name, " " , generate_port," ", generate_addr, "to this port " ,target_port," ", target_addr) cmd_create = "flow --create %s -srcdev %s -dstdev %s -ingrport %s -fea gen,mon" % ( flow_name, generate_addr, target_addr, generate_port) cons_out = anturlar.fos_cmd(cmd_create) if "maximum limit" in cons_out: count -= 1 break if "Port does not" in cons_out: break if "PID or WWN do not" in cons_out: break if "Exceeds maximum flow limit" in cons_out: count -= 1 break temp_list = list_for_i list_for_i = list_for_j list_for_j = temp_list else: for i in combine_port_list: random.shuffle(j_port_list) generate_port = i[0] generate_addr = i[1] #### this loops on the same list of combined port list #### one idea was to select a random element from the list each time #### for j in j_port_list: target_port = j[0] target_addr = j[1] if generate_port not in target_port: flow_name = ("%s%s" % (flow_name_base, count)) count += 1 print(flow_name, " ", generate_port, " ", generate_addr, "to this port ", target_port, " ", target_addr) cmd_create = "flow --create %s -srcdev %s -dstdev %s -ingrport %s -fea gen,mon" % ( flow_name, generate_addr, target_addr, generate_port) cons_out = anturlar.fos_cmd(cmd_create) if "maximum limit" in cons_out: count -= 1 break if "Port does not" in cons_out: break if "PID or WWN do not" in cons_out: break if "Exceeds maximum flow limit" in cons_out: count -= 1 break
def main(): global tn ############################################################################### #### #### #### ############################################################################### pa = parse_args(sys.argv) #print(pa) #print(pa.chassis_name) #print(pa.ipaddr) #print(pa.quiet) #print(pa.verbose) #print(pa.firmware) #print("@"*40) #sys.exit() ########################################################################## ########################################################################## ### ### hold the ip address from the command line ### if pa.ipaddr: pa.chassis_name = console_info_from_ip(pa.ipaddr, pa.chassis_name) cons_info = console_info(pa.chassis_name) console_ip = cons_info[0] console_port = cons_info[1] power_pole_info = pwr_pole_info(pa.chassis_name) usr_pass = get_user_and_pass(pa.chassis_name) user_name = usr_pass[0] usr_psswd = usr_pass[1] tn = anturlar.connect_tel_noparse(pa.ipaddr, user_name, usr_psswd) fi = anturlar.FabricInfo() si = anturlar.SwitchInfo() su = cofra.SwitchUpdate() fcr = anturlar.FcrInfo() if pa.fabwide: ipaddr_switch = fi.ipv4_list() elif pa.csvall: ipaddr_switch = get_ip_from_file(pa.chassis_name) elif pa.fcrwide: anturlar.fos_cmd("setcontext %s" % fcr.base_check()) ipaddr_switch = fcr.fcr_fab_wide_ip() else: ipaddr_switch = [pa.ipaddr] anturlar.close_tel() #### pass ip(s)to login procedure #### and write the file ################################################################################################## # Manual list of switches to run suppportftp against. Entire csv list is printed out above but the # list below overwries it. # This keeps bombing on AMP switch IP (not included below). ################################################################################################## ip_no_amp = [ '10.38.36.240', '10.38.36.10', '10.38.36.33', '10.38.36.158', '10.38.36.249', '10.38.36.102', '10.38.36.246', '10.38.36.250', '10.38.36.98', '10.38.36.125', '10.38.36.25', '10.38.36.24', '10.38.36.111', '10.38.36.95', '10.38.36.85', '10.38.36.112' ] for i in ip_no_amp: try: tn = anturlar.connect_tel_noparse(i, user_name, usr_psswd) except OSError: print("Switch %s not available" % i) nos = si.nos_check() if not nos: anturlar.fos_cmd( "supportftp -s -h 10.39.2.171 -u ftp1 -p ftp2 -d ssaves -l ftp" ) anturlar.fos_cmd("supportftp -e") anturlar.fos_cmd("supportftp -t 8") anturlar.fos_cmd( "tsclockserver 10.38.2.80; tstimezone America/Denver") anturlar.fos_cmd("echo Y | reboot") #anturlar.fos_cmd("tsclockserver LOCL") else: print("\n" + "@" * 40) print('\nTHIS IS A NOS SWITCH> SKIPPING') print("\n" + "@" * 40) pass # tn = su.reboot_reconnect() anturlar.close_tel() sys.exit()
def main(): global tn #### varable for telnet session ####################################################################################################################### #### #### #### ####################################################################################################################### pa = parse_args(sys.argv) print(pa) print(pa.ipaddr) print(pa.quiet) print(pa.verbose) print(pa.cmdprompt) print("@" * 40) ################################################################################################################### ################################################################################################################### #### #### if user enter ip address then get the chassisname from the #### SwitchMatrix file #### then get the info from the SwitchMatrix file using the Chassis Name #### #### #### if pa.ipaddr: print("do IP steps") pa.chassis_name = console_info_from_ip(pa.ipaddr) cons_info = console_info(pa.chassis_name) console_ip = cons_info[0] console_port = cons_info[1] console_ip_bkup = cons_info[2] console_port_bkup = cons_info[3] power_pole_info = pwr_pole_info(pa.chassis_name) usr_pass = get_user_and_pass(pa.chassis_name) user_name = usr_pass[0] usr_psswd = usr_pass[1] ipaddr_switch = get_ip_from_file(pa.chassis_name) steps_to_run = pa.steps fid_to_compare = 128 fid_to_compare = pa.fid ################################################################################################################### #### if the user does not enter a value for which steps to run prompt for user input value #### if not steps_to_run: # pa.start = user_start() steps_to_run = pa.start = user_start() tn = anturlar.connect_tel_noparse(ipaddr_switch, user_name, usr_psswd) ################################################################################################################### #### #### configure some settings that are not defualt to confirm they remain after disruptions #### cons_out = send_cmd("creditrecovmode --cfg onLrThresh") cons_out = send_cmd("creditrecovmode --cfg onLrThresh -lrthreshold 7") cons_out = send_cmd("creditrecovmode --fe_crdloss off") cons_out = send_cmd("creditrecovmode --be_crdloss off") cons_out = send_cmd("creditrecovmode --be_losync off") cons_out = send_cmd("creditrecovmode --fault edgeblade") ################################################################################################################### #### #### capture teh configuration file if the user selected 1 or 3 #### if steps_to_run == 1 or steps_to_run == 3: # cons_out = anturlar.fos_cmd("mapspolicy --enable dflt_base_policy") # cons_out = anturlar.fos_cmd("mapspolicy --enable dflt_aggressive_policy") switch_info = capture_switch_info("compare_orig", fid_to_compare) ################################################################################################################### #### path to the first file to compare # switch_data_0 = "logs/Switch_Info_cudc%s_compare_orig.txt" % pa.ipaddr #switch_data_0 = "logs/Switch_Info_cudc%s_compare_orig.txt" % ipaddr_switch switch_data_0 = "/home/runfromhere/logs/Switch_Info_cudc%s_compare_orig.txt" % ipaddr_switch liabhar.JustSleep(10) ################################################################################################################### ################################################################################################################### ################################################################################################################### #### #### do configupload or other test steps here #### make other changes here before configupload or other commands #### ################################################################################################################### #### #### REBOOT and RECONNECT WAIT 60 SECONDS and CONTINUE #### print("START Switch Update Class") liabhar.JustSleep(10) pp = cofra.SwitchUpdate() # tn = pp.reboot_reconnect() # liabhar.count_down(60) ################################################################################################################### #### #### hafailover or hareboot on pizza box #### call the failover function from cofra and send the number of failovers #### print("START HA FAILOVER") liabhar.JustSleep(10) tn = cofra.ha_failover(100) liabhar.count_down(600) ################################################################################################################### #### #### power cycle slots #### ss = anturlar.SwitchInfo() slot_list = ss.blades(True) #### skip if switch is a pizza box # if "not a d" not in slot_list: # pc_result = slot_pwr_cycle(slot_list) # else: # print("NOT A DIRECTOR SO PASSING SLOT POWER CYCLE TEST") # #### #### #### other interuptions #### #### ################################################################################################################### ################################################################################################################### ################################################################################################################### if steps_to_run == 2 or steps_to_run == 3: liabhar.JustSleep(10) liabhar.count_down(360) # cons_out = anturlar.fos_cmd("setcontext 128") # cons_out = anturlar.fos_cmd("mapspolicy --enable dflt_base_policy") # cons_out = anturlar.fos_cmd("mapspolicy --enable dflt_aggressive_policy") switch_info = capture_switch_info("compare", fid_to_compare) ################################################################################################################### #### path to the second file to compare switch_data_1 = "logs/Switch_Info_cudc%s_compare.txt" % ipaddr_switch liabhar.cls() #### compare the two files print("#" * 80) print("#" * 80) print("#######") print("####### @@@@@ @@@@@ @@@@@ @ @ @ @@@@@ @ ") print("####### @ @ @ @ @ @ @ @ @ ") print("####### @@@ @@@@ @@@@ @ @ @ @ @ ") print("####### @ @ @ @ @ @ @ @ ") print("####### @ @ @@@@@ @@@@@ @@@ @@@@@ @ @ ") print("#" * 80) print("#" * 80) diff_f = liabhar.file_diff(switch_data_0, switch_data_1) print("#" * 80) print("#" * 80) print("#" * 80) print("#" * 80) print("Result ") print(diff_f) ################################################################################################################### #### put additional commands here before disconnecting from telnet #### # cons_out = anturlar.fos_cmd("mapsdb --show all") # print(cons_out) # cons_out = anturlar.fos_cmd("mapspolicy --enable dflt_base_policy") #cons_out = anturlar.fos_cmd("mapspolicy --enable Nervio") anturlar.close_tel() dt = liabhar.dateTimeStuff() date_is = dt.current() print(date_is) print(type(steps_to_run)) print(steps_to_run)
def capture_switch_info(extend_name="", fid=128): """ """ si = anturlar.SwitchInfo() mi = anturlar.Maps() fi = anturlar.FlowV() fcr = anturlar.FcrInfo() vdx = si.nos_check() switch_ip = si.ipaddress() switch_cp_ips = si.cp_ipaddrs_get() license_list = si.getLicense() ls_list = si.ls() first_ls = si.ls_now() switch_id = si.switch_id() fid_now = si.currentFID() try: theswitch_name = si.switch_name() except IndexError: theswitch_name = "unknown" pass chassis_name = si.chassisname() director_pizza = si.director() vf_enabled = si.vf_enabled() sw_type = si.switch_type() base_sw = si.base_check() sim_ports = si.sim_ports() ex_ports = fcr.all_ex_ports() fcr_state = si.fcr_enabled() ports_and_ls = si.all_ports_fc_only() psw_reset_value = "YES" xisl_st_per_ls = si.allow_xisl() maps_policy_sum = mi.get_policies() maps_non_dflt_policy = mi.get_nondflt_policies() flow_per_ls = fi.flow_names() blades = si.blades() deflt_switch = si.default_switch() # sfp_info = si.sfp_info() maps_email_cfg = mi.get_email_cfg() maps_actions = mi.get_actions() logical_groups = mi.logicalgroup_count() relay_server_info = mi.get_relay_server_info() credit_recov_info = mi.credit_recovery() dns_info = mi.dns_config_info() ################################################################################################################### ################################################################################################################### #### #### print the variables for review #### ################################################################################################################### ################################################################################################################### print("\n\n\n") print("SWITCH IP : %s " % switch_ip) print("SWITCH NAME : %s " % theswitch_name) # print("SWITCH DOMAIN : %s " % domain_list) print("LS LIST : %s " % ls_list) print("DEFAULT SWITCH : %s " % deflt_switch) print("BASE SWITCH : %s " % base_sw) print("EX_PORTS : %s " % ex_ports) ######################NEW print("VF SETTING : %s " % vf_enabled) print("SWITCH TYPE : %s " % sw_type) print("TIMEOUT VALUE : 0 ") print("RESET PASSWORD : %s " % psw_reset_value) print("FCR ENABLED : %s " % fcr_state) print("BLADES : %s " % blades) print("LICENSE LIST : %s " % license_list) ####################################################################################################################### ####################################################################################################################### ####################################################################################################################### #### #### Write to the file #### ####################################################################################################################### ####################################################################################################################### ####################################################################################################################### # f = "%s%s%s" % ("logs/Switch_Info_cudc", switch_ip, "_%s.txt" % extend_name) f = "%s%s%s" % ("/home/runfromhere/logs/Switch_Info_cudc", switch_ip, "_%s.txt" % extend_name) header = "%s%s%s%s" % ("\nSwitch_info_for_playback CAPTURE FILE \n", \ "", "", "==============================\n") ff = liabhar.FileStuff(f, 'w+b') #### open the log file for writing ff.write(header) ################################################################################################################### ff.write("SWITCH IP : %s \n" % switch_ip) ff.write("LS LIST : %s \n" % ls_list) ff.write("DEFAULT SWITCH : %s \n" % deflt_switch) ff.write("BASE SWITCH : %s \n" % base_sw) ff.write("EX_PORTS : %s \n" % ex_ports) ff.write("SWITCH NAME : %s \n" % theswitch_name) ff.write("CHASSIS NAME : %s \n" % chassis_name) ff.write("DIRECTOR STATUS : %s \n" % director_pizza) ff.write("VF SETTING : %s \n" % vf_enabled) ff.write("SWITCH TYPE : %s \n" % sw_type) ff.write("TIMEOUT VALUE : 0 \n") ff.write("RESET PASSWORD : %s \n" % psw_reset_value) ff.write("FCR ENABLED : %s \n" % fcr_state) ff.write("Ports : %s \n" % ports_and_ls) ff.write("SIM PORTS : %s \n" % sim_ports) ff.write("Blades : %s \n" % blades) ff.write("LICENSE LIST : %s \n" % license_list) #ff.write("SFP INFO : %s \n" % sfpinfo) ff.write("=" * 80) ff.write("\n") ff.write("MAPS POLICIES : %s \n" % maps_policy_sum) ff.write("MAPS NON DFLT POLICIES : %s \n" % maps_non_dflt_policy) ff.write("EMAIL CFG : %s \n" % maps_email_cfg) ff.write("MAPS ACTIONS : %s \n" % maps_actions) ff.write("LOGICAL GROUPS : %s \n" % logical_groups) ff.write("RELAY SERVER HOST IP : %s \n" % relay_server_info) ff.write("CREDIT RECOVERY INFO : %s \n" % credit_recov_info) ff.write("DNS CONFIG INFO : %s \n" % dns_info) ff.write("=" * 80) ff.write("\n") ff.write("FLOW CONFIGURATION : %s \n" % flow_per_ls) ff.write("\n" * 2) ff.close() # cons_out = anturlar.fos_cmd("setcontext %s " % fid_now) return (True)
def ex_port_list(): """ Grabs only ONLINE EX-Ports. Parses "switchshow" for EX-Ports. """ si = anturlar.SwitchInfo() ex_list = si.ex_ports()
def main(): global tn ############################################################################### #### #### #### ############################################################################### pa = parse_args(sys.argv) #print(pa) #print(pa.chassis_name) #print(pa.ipaddr) #print(pa.quiet) #print(pa.verbose) #print(pa.firmware) print(porttype) print("@" * 40) sys.exit() ########################################################################## ########################################################################## ### ### hold the ip address from the command line ### if pa.ipaddr: pa.chassis_name = console_info_from_ip(pa.ipaddr, pa.chassis_name) cons_info = console_info(pa.chassis_name) console_ip = cons_info[0] console_port = cons_info[1] power_pole_info = pwr_pole_info(pa.chassis_name) usr_pass = get_user_and_pass(pa.chassis_name) user_name = usr_pass[0] usr_psswd = usr_pass[1] tn = anturlar.connect_tel_noparse(pa.ipaddr, user_name, usr_psswd) fi = anturlar.FabricInfo() si = anturlar.SwitchInfo() #fcr = anturlar.FcrInfo() if pa.fabwide: ipaddr_switch = fi.ipv4_list() elif pa.csvall: ipaddr_switch = get_ip_from_file(pa.chassis_name) elif pa.fcrwide: anturlar.fos_cmd("setcontext %s" % fcr.base_check()) ipaddr_switch = fcr.fcr_fab_wide_ip() else: ipaddr_switch = [pa.ipaddr] anturlar.close_tel() #### pass ip(s)to login procedure #### and write the file for i in ipaddr_switch: try: tn = anturlar.connect_tel_noparse(i, user_name, usr_psswd) except OSError: print("Switch %s not available" % i) nos = si.nos_check() if not nos: #print("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&") f_ports = si.f_ports() e_ports = si.e_ports() print(fports) print(eports) sys.exit() #devices = fcr.fcr_proxy_dev() print("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX") fabric_check = fi.fabric_members() #print(fabric_check) f = ('logs/PortFlapper.txt') try: with open(f, 'w') as file: file.write("F-Ports = %s\n" % str(fports)) file.write("E-Ports = %s\n" % str(eports)) except IOError: print("\n\nThere was a problem opening the file:", f) sys.exit() file.close() print(eports ) ################ if...else statement to use eport or fport for i in eports: slot = i[0] port = i[1] if slot: anturlar.fos_cmd("portdisable %s/%s" % (slot, port)) liabhar.count_down(15) anturlar.fos_cmd("portenable %s/%s" % (slot, port)) liabhar.count_down(15) else: anturlar.fos_cmd("portdisable %s" % (port)) liabhar.count_down(15) anturlar.fos_cmd("portenable %s" % (port)) liabhar.count_down(15) fabric_check1 = fi.fabric_members() if fabric_check != fabric_check1: print("WTF") #email_sender_html(you, me, subj, html_to_send, htmlfile_path = "" ) liabhar.email_sender_html("*****@*****.**", "*****@*****.**", "portflapper failed", "portflapper failed", "") sys.exit() liabhar.email_sender_html("*****@*****.**", "*****@*****.**", "portflapper passed", "portflapper passed", "") anturlar.close_tel() return (True) else: print("\n" + "@" * 40) print('\nTHIS IS A NOS SWITCH> SKIPPING') print("\n" + "@" * 40) pass anturlar.close_tel() sys.exit()
def main(): global tn ################################################################################################################### # # start with parsing the command line # # use the procedures parent_parser and parse_args # to determine the command line switches # ################################################################################################################### pa = parse_args() print(pa) print(pa.ipaddr) print(pa.quiet) print(pa.verbose) print(pa.cmdprompt) print(pa.iterations) print(pa.porttype) print(pa.email) print("@" * 40) print("@" * 40) # sys.exit() ################################################################################################################### ################################################################################################################### # # if user enter ip address then get the chassisname from the # SwitchMatrix file # # then get the info from the SwitchMatrix file using the Chassis Name # # # Type,Chassisname,IP Address,Username,Password,Console1 IP,Console1 Port,Console2 IP,Console2 Port, # Power1 IP,Power1 Port,Power2 IP,Power2 Port,Power3 IP,Power3 Port,Power4 IP,Power4 Port, # KVM IP,KVM Port,Web Username,Web Password,Admin Password # ################################################################################################################### ################################################################################################################### if pa.ipaddr: print("do IP steps") pa.chassis_name = sw_matrix_tools.console_info_from_ip(pa.ipaddr) # cons_info = sw_matrix_tools.console_info(pa.chassis_name) # console_ip = cons_info[0] # console_port = cons_info[1] # console_ip_bkup = cons_info[2] # console_port_bkup = cons_info[3] # power_pole_info = sw_matrix_tools.pwr_pole_info(pa.chassis_name) usr_pass = sw_matrix_tools.get_user_and_pass(pa.chassis_name) user_name = usr_pass[0] usr_psswd = usr_pass[1] ipaddr_switch = sw_matrix_tools.get_ip_from_file(pa.chassis_name) ################################################################################################################### # # connect via telnet: # if you want to connect to the console it is available in anturlar and an example is available below # # ################################################################################################################### # Config_up_down_compare.main() # cons_out = anturlar.fos_cmd("firmwareshow") # send any command with anturlar.fos_cmd # print("\r\n") # liabhar.JustSleep(5) # sleep without printing anything # print(cons_out) # print("now closing telnet session ") # #anturlar.close_tel() #### close the telnet session ################################################################################################################### # # connect via console example and other "send command" commands # # ################################################################################################################### # tn = anturlar.connect_tel_noparse(ipaddr_switch,user_name,usr_psswd) # connect to console w/o parser info # cons_out = anturlar.fos_cmd("firmwareshow") # cons_out = anturlar.fos_cmd("setcontext %s " % pa.fid) # hange to the fid given on the command # tn = anturlar.connect_console(console_ip,console_port) # use the console ip and console port info # cons_out = anturlar.fos_cmd("switchshow") # send a command via the console # cons_out = cofra.power_cycle(power_pole_info) # powercycle switch w switchmatrix.csv file # liabhar.JustSleep(30) # wait for the switch to boot # cons_out = anturlar.send_cmd_console("\r\n") # end some commands to the console # cons_out = anturlar.send_cmd_console("setcontext %s " % pa.fid) # send some commands to the console # cons_out = anturlar.send_cmd_console("firmwareshow") # send some commands to the console # capture = cofra.cfgupload("10.38.35.131", "ftp1", "ftp2") # send a cfgupload file to a ftp server # liabhar.count_down(5) #### set and observe a count down timer ################################################################################################################### ################################################################################################################### # # This starts the template for configshow output comparison (after some type of switch operation). # First snippet of code simply opens a connection, changes to requested fid, sends output of configshow to a # file ################################################################################################################### ################################################################################################################### tn = anturlar.connect_tel_noparse(ipaddr_switch, user_name, usr_psswd) # cons_out = anturlar.fos_cmd("setcontext %s " % pa.fid) dt = liabhar.dateTimeStuff() # create the object for date and time stuff date_is = dt.current_no_dash_at_end() # get the current time for file naming purposes # print("\n\nDate is %s" % date_is) liabhar.count_down(3) # count down to the next command # configup_cmd = ("configupload -all -p ftp %s,%s,/configs/%s.txt,%s") % ("172.16.114.67","ftp1",/ # ipaddr_switch,"ftp2") f = "%s%s%s%s" % ("logs/Configupload_test_case_file_ORIG", "_" + ipaddr_switch + "_", date_is, ".txt") ff = liabhar.FileStuff(f, 'w+b') # open the log file for writing header = "%s%s%s%s" % ("\nCONFIGUPLOAD CAPTURE FILE \n", " sw_info ipaddr ", ipaddr_switch, "\n==============================\n\n") # write a header line at top of file ff.write(header) ff.write(anturlar.fos_cmd("configshow")) # ff.write("THE END") ff.close() # close this file for comparison later # g = open(f, "r") # lines = g.readlines() # g.close() # ff = liabhar.FileStuff(f, 'w+b') # for l in lines: # if " date = " not in l: # ff.write(l) # ff.close() ################################################################################################################## ################################################################################################################## # # do anything else you want to try (small sample of examples): # anturlar.fos_cmd("tsclockserver 10.38.2.80; tstimezone America/Denver") # anturlar.fos_cmd("cfgenable") # anturlar.fos_cmd("switchdisable") # anturlar.fos_cmd("switchenable") # # In the below snippet we run tsclockerver: anturlar.fos_cmd("tsclockserver 10.38.2.80;\ # tstimezone America/Denver") # Then grab output of configshow, drop into a file and compare that with original # ################################################################################################################## ################################################################################################################## # tn = cofra.clear_stats() # print(pa.porttype) # #sys.exit() # porttype = pa.porttype # print(porttype) # PortFlapper.main(porttype) ############################################################################################# si = anturlar.SwitchInfo() fi = anturlar.FabricInfo() fabric_check = fi.fabric_members() f_ports = si.f_ports() e_ports = si.e_ports() print("\n\n\n\n") print(f_ports) print(e_ports) print("\n\n\n\n") if pa.porttype == "eports": ports = e_ports else: ports = f_ports # try: # tn = anturlar.connect_tel_noparse(i,user_name,usr_psswd) # except OSError: # print("Switch %s not available" % i) g = pa.iterations while g > 0: for i in ports: slot = i[0] port = i[1] if slot: anturlar.fos_cmd("portdisable %s/%s" % (slot, port)) liabhar.count_down(15) anturlar.fos_cmd("portenable %s/%s" % (slot, port)) liabhar.count_down(15) else: anturlar.fos_cmd("portdisable %s" % port) liabhar.count_down(15) anturlar.fos_cmd("portenable %s" % port) liabhar.count_down(15) fabric_check1 = fi.fabric_members() if fabric_check != fabric_check1: print("WTF") # email_sender_html(you, me, subj, html_to_send, htmlfile_path = "" ) liabhar.email_sender_html(pa.email, pa.email, "portflapper failed", "portflapper failed", "") anturlar.close_tel() sys.exit(0) else: c = "%s%s%s%s" % ("logs/Configupload_test_case_file_COMPARE", "_" + ipaddr_switch + "_", date_is, ".txt") cc = liabhar.FileStuff(c, 'w+b') # open the log file for writing header = "%s%s%s%s" % ("\nCONFIGUPLOAD CAPTURE FILE \n", " sw_info ipaddr ", ipaddr_switch, "\n==============================\n\n") # write a header line at top of file cc.write(header) cc.write(anturlar.fos_cmd("configshow")) # ff.write("THE END") cc.close() # x = open(c, "r") # lines = x.readlines() # x.close() # cc = liabhar.FileStuff(f, 'w+b') # for l in lines: # if " date = " not in l: # cc.write(l) # cc.close() diff_f = liabhar.file_diff(f, c) print(diff_f) g = g - 1 print(g) if not diff_f: liabhar.email_sender_html(pa.email, pa.email, "PF_configshow_compare failed a checkpoint", "PF_configshow_compare failed" "a checkpoint. Support Save and trace dump transferred", "") cofra.DoSupportsave("172.16.114.67", "ftp1", "ftp2", pa.chassis_name) anturlar.close_tel() sys.exit(0) # diff_f = liabhar.file_diff(f, f1) print("#" * 80) print("#" * 80) print("#" * 80) print("#" * 80) print("Result ") print(diff_f) liabhar.email_sender_html(pa.email, pa.email, "PF_configshow_compare passed", "PF_configshow_compare passed", "") return True