def tc_qtmemtest_onlyrun_once(): """ id=5442423 verify the node1 craft interface name """ ontlist = [] rev10_list = [ "BVMCJ00ARA", "BVMCH00ARA", "BVMCL00ARA", "BVMCK00ARA", "BVMCK844E1", "BVMCK844E2" ] for key in App().__dict__: if re.match(r'DUT\d', key): ontlist.append(ont_lib.calixontbase(getattr(App(), key))) for ont in ontlist: r = ont.ont_get_clei() if r: print "ONT CLEI is: ", r if r in rev10_list: for i in range(0, 10): result = ont.ont_get_qtmemtest_result ont.ont_reboot_ont() time.sleep(300) cafe.Checkpoint( ont.ont_get_qtmemtest_executed()).exact(True) cafe.Checkpoint( result == ont.ont_get_qtmemtest_result).exact(True) else: print("This is not a Rev10 unit") else: print("Can't get CLEI from DUT")
def tc_usercases_1(): """ id=5442423 verify the node1 craft interface name """ ontlist = [] rev10_list = [ "BVMCJ00ARA", "BVMCH00ARA", "BVMCL00ARA", "BVMCK00ARA", "BVMCK844E1", "BVMCK844E2" ] for key in App().__dict__: if re.match(r'DUT\d', key): ontlist.append(ont_lib.calixontbase(getattr(App(), key))) for ont in ontlist: r = ont.ont_get_clei() if r: print "ONT CLEI is: ", r if r in rev10_list: cafe.Checkpoint(ont.ont_get_qtmemtest_executed()).exact(True) else: cafe.Checkpoint(ont.ont_get_qtmemtest_executed()).exact(False) else: print("Can't get CLEI from DUT")
def tc_777_test_case_with_arg(name): """ @test_id=777 @assignee=some_random_person @tag=TEST Test case description goes here. """ cafe.print_log("RANDOM ERROR?", level="ERROR") cafe.print_report("HELLO WORLD! THIS IS A REPORT") print("%s says hi!!!" % name) cafe.Checkpoint("Hello").verify_exact("Hello") cafe.Checkpoint("Hello").verify_exact("LOL")
def ixveriwave_buildfile(params): # Obtain required parameters ixvw = params['ixvw']['ixvwpcsession'] fsan = params['execution']['ontfsan1'] # Create file to execute IxVeriwave Test ixvw.simplebenchtest(chassisname="10.83.2.199", wifichannel="6", srcint="2:1", srcinttype="802.11n", srcgrouptype="802.11abgn", srcchanbw="40", srcssid=fsan, srcphyinterface="802.11n", srcmac="00:01:01:01:01:01", destint="2:1", destinttype="802.11n", destgrouptype="802.11abgn", destchanbw="40", destssid=fsan, destphyinterface="802.11n", destmac="00:02:02:02:02:02", framesize="500", srcpercentrate="20", debug=3, tclshpath="c:/Tcl") print("Hello! I am a test case!") cafe.Checkpoint("Pass me please").verify_exact("Pass me please")
def pre_actions(self): init_logging() cafe.Checkpoint(str(self.is_connected())).verify_contains("True") self.command("\n") self.command("exit") self.command("\n") self.login()
def ixveriwave_test_case(params): # Obtain required parameters ontgui = params['ontgui']['ontgui_session'] ixvw = params['ixvw']['ixvwpcsession'] ontip = params['ontgui']['ontgui'] fsan = params['execution']['ontfsan1'] # Configure WiFi values (Assume all values need to be set even if default) ontgui.wireless_radiosetup(ontip=ontip, radiotype="2.4GHz", radio="on", mode="802.11b, 802.11g, and 802.11n", bandwidth="20 MHz", channel="6", powerlevel="100%") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="2.4GHz", ssidstate="enabled", broadcast="enabled") ontgui.wireless_securitysetup(ontip=ontip, radiotype="2.4GHz", ssid=fsan, securitytype="Security Off") # Create file to execute IxVeriwave Test ixvw.buildsimplebenchtest(chassisname="10.83.2.199", wifichannel="6", srcint="2:1", srcinttype="802.11n", srcgrouptype="802.11abgn", srcchanbw="40", srcssid=fsan, srcphyinterface="802.11n", srcmac="00:01:01:01:01:01", destint="2:1", destinttype="802.11n", destgrouptype="802.11abgn", destchanbw="40", destssid=fsan, destphyinterface="802.11n", destmac="00:02:02:02:02:02", framesize="500", srcpercentrate="20", debug=3, tclshpath="c:/Tcl") # Return WiFi values to known defaults ontgui.wireless_radiosetup(ontip=ontip, radiotype="2.4GHz", channel="Auto") ontgui.wireless_securitysetup(ontip=ontip, radiotype="2.4GHz", ssid=fsan, securitytype="WPA - WPA2-Personal", encryptiontype="AES", keytype="default") print("Hello! I am a test case!") cafe.Checkpoint("Pass me please").verify_exact("Pass me please")
def tc_888RGGUI_test_case_2(): """ @test_id=888RGGUI @assignee=gliverm @tag=TEST Test case description goes here. """ cafe.Checkpoint("Hello").verify_exact("Hello", "Custom Checkpoint", "CC Passed!", "CC Failed!")
def UserCases1(CaseConf, **GeneralConf): """ id=5442423 verify the node1 craft interface name """ param = cafe.get_test_param() e7 = e7_lib.CalixE7Base(param.e7_sess) # ixia = Ixia_lib.IXIABase(**GeneralConf) CaseConf = CaseConf #import CaseConf as CaseConf # if ixia.connect_host(): # if ixia.connect_chassis(): if not e7.e7_provision_ont(**GeneralConf): cafe.Checkpoint().fail("Provision ONT Fail!") #add Data or Video Service for key, value in CaseConf.DataConf.items(): print value Conf = GeneralConf.copy() Conf.update(value) EthList = ["g1", "g2", "g3", "g4"] for eth in EthList: Conf["ETH"] = eth if not e7.e7_add_ont_dataservice(**Conf): cafe.Checkpoint().fail("Add Data or Video Service Fail!") r = e7.e7_check_ont_dataservice(**Conf) cafe.Checkpoint(r).not_contains("fail") #Add Iphost SIP service for key, value in CaseConf.SIPConf.items(): Conf = GeneralConf.copy() Conf.update(value) if not e7.e7_add_ont_sipservice(**Conf): cafe.Checkpoint().fail("Add SIP Service Fail!") r = e7.e7_check_ont_sipservice(**Conf) cafe.Checkpoint(r).not_contains("fail")
def e7_test_case(dut): print("Hello! I am a test case!") cafe.Checkpoint("Pass me please").verify_exact("Pass me please") # Simple display of system version # v1 = session1.command("show version")[2] # dut1_ver = stp.api.e7.e7_lib.show_version(dut1) resp = dut.show_version() print("dut_ver: ", resp) resp = dut.show_system() print("show system: ", resp)
def verify_801f_only_one_ssh_writable(): """ @id = 10004NetworkMgmt801F test_case 801F/GP-274 Refactory needed """ sshs1 = SSHSession(SSHConfig["sid"], SSHConfig["host"], SSHConfig["port"], SSHConfig["user"], SSHConfig["password"]) sshs1.login() sshs1.command("sudo -i") result = sshs1.command("ssh " + str(CPEConfig["ip"])) cafe.Checkpoint(str(result[2])).verify_contains(exp="password", pos_msg="re found!", neg_msg="re not found") result = sshs1.command(str(CPEConfig["password"])) cafe.Checkpoint(str(result[2])).verify_regex(exp="BusyBox v\d\.\d\d\.\d", pos_msg="re found!", neg_msg="re not found") result = sshs1.command("echo aaa >> 1") cafe.Checkpoint(str(result[2])).verify_contains(exp="aaa", pos_msg="re found!", neg_msg="re not found") sshs2 = SSHSession(SSHConfig["sid"], SSHConfig["host"], SSHConfig["port"], SSHConfig["user"], SSHConfig["password"]) sshs2.login() sshs2.command("sudo -i") result = sshs2.command("ssh " + str(CPEConfig["ip"])) cafe.Checkpoint(str(result[2])).verify_contains(exp="password", pos_msg="re found!", neg_msg="re not found") result = sshs2.command(str(CPEConfig["password"])) cafe.Checkpoint(str(result[2])).verify_regex(exp="BusyBox v\d\.\d\d\.\d", pos_msg="re found!", neg_msg="re not found") result = sshs2.command("echo aaa >> 2") result = sshs2.command("cat 2") cafe.Checkpoint(str(result[2])).verify_contains(exp="can't open \'2\'", pos_msg="re found!", neg_msg="re not found") sshs2.command("rm -rf 1 2") sshs1.close() sshs2.close()
def tc_qtmemtest_duration(): """ id=5442423 verify the node1 craft interface name """ ontlist = [] for key in App().__dict__: if re.match(r'DUT3|DUT5', key): ontlist.append(ont_lib.calixontbase(getattr(App(), key))) for ont in ontlist: r = ont.ont_get_ver() print "ONT Version is: ", r cafe.Checkpoint(r).contains("11") result = ont.ont_get_qtmemtest_result() print(result) stable_result = result if stable_result == True: sleep_time = 650 else: sleep_time = 300 errnum = 0 passnum = 0 for i in range(1, 10): ont.ont_del_qtmemtest_result() ont.ont_reboot_ont() time.sleep(sleep_time) result = ont.ont_get_qtmemtest_result() print("result:", result) print("stable_result:", stable_result) if result == stable_result: passnum = passnum + 1 print("Pass counts:", passnum) else: errnum = errnum + 1 print("error counts:", errnum) cafe.Checkpoint(errnum).exact(0)
def verify_801f_cold_restart_in_60s(): """ @id = 10003Performance801F test_case 801F/GP-249 """ tels = SerialConsoleTelnetSession(SerialConfig["sid"], SerialConfig["host"], SerialConfig["port"], SerialConfig["user"], SerialConfig["password"]) tels.pre_actions() # ================case logic======================== result = tels.command("reboot") result = re.search("Shutdown network interface", result[2]) cafe.Checkpoint(str(result.group())).verify_contains(exp="Shutdown network interface", pos_msg="re found!", neg_msg="re not found") tels.close() sleep(30) tels = SerialConsoleTelnetSession(SerialConfig["sid"], SerialConfig["host"], SerialConfig["port"], SerialConfig["user"], SerialConfig["password"]) cafe.Checkpoint(str(tels)).verify_contains("object at") tels.login() # ================================================== tels.post_actions()
def e7guifailure_test_case(params): # Obtain required parameters ontgui = params['ontgui']['ontgui_session'] ontip = params['ontgui']['ontgui'] fsan = params['execution']['ontfsan1'] print("Hello! I am a test case!") cafe.Checkpoint("Pass me please").verify_exact("Pass me please") ontgui.wireless_radiosetup(ontip=ontip, radiotype="5GHz", radio="on", mode="802.11n", dfs="disabled", channel="22")
def subtc_verify_traffic(ixia): r = ixia.ixia_controll_start_allprotocols() time.sleep(30) r = ixia.ixia_controll_start_traffics() time.sleep(120) r = ixia.ixia_controll_stop_traffics() time.sleep(10) dict_result = ixia.ixia_get_traffic_stats("traffic_item") lossrate = dict_result['traffic_item']['aggregate']['rx'][ 'loss_percent']["avg"] print("lossrate:", lossrate) if float(lossrate) > 10.0: r = False cafe.Checkpoint().fail("Loss rate is %f,more than 10 !" % float(lossrate)) return r
def verify_801f_version_format(): """ @id = 10002NetworkMgmt801F test_case 801F/GP-244 """ tels = SerialConsoleTelnetSession(SerialConfig["sid"], SerialConfig["host"], SerialConfig["port"], SerialConfig["user"], SerialConfig["password"]) tels.pre_actions() # ================case logic======================== result = tels.command("cat /root/version") result = re.search("\d\.\d\.\d", result[2]) cafe.Checkpoint(str(result.group())).verify_regex(exp="\d\.\d\.\d", pos_msg="re found!", neg_msg="re not found") # ================================================== tels.post_actions()
def verify_801f_log_timestamp_format(): """ @id = 10001NetworkMgmt801F test_case 801F/GP-142 """ tels = SerialConsoleTelnetSession(SerialConfig["sid"], SerialConfig["host"], SerialConfig["port"], SerialConfig["user"], SerialConfig["password"]) tels.pre_actions() # ================case logic======================== result = tels.command("tail -n 1 /tmp/log/messages") result = re.search("\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}", result[2]) check = cafe.Checkpoint(str(result.group())).verify_regex(exp="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}", pos_msg="re found!", neg_msg="re not found") if check: pass else: cafe.print_console("check result is: " + str(check) + " " + str(result.group())) # ================================================== tels.post_actions()
def tc_usercases_2(CaseConf, **GeneralConf): """ verify the node1 craft interface name """ e7 = e7_lib.CalixE7Base(getattr(App(), GeneralConf["e7"])) ont = ont_lib.calixontbase(getattr(App(), GeneralConf["ont_topo"])) tg2_session = GeneralConf["ixia_session"] #ixia = ixia_lib.IXIABase(getattr(App(),GeneralConf["ixia_session"])) ixia = ixia_lib.IXIABase(GeneralConf["ixia_session"]) CaseConf = CaseConf test_result = True # if ixia.connect_host(): # if ixia.connect_chassis(): cafe.Checkpoint(e7.e7_provision_ont(**GeneralConf)).exact(True) i = 0 # ixia.connect_chassis() for key, value in CaseConf.DataConf.items(): Conf = GeneralConf.copy() Conf.update(value) if Conf["Enable"] is "1": print("Start to add data service") cafe.Checkpoint(e7.e7_add_ont_dataservice(**Conf)).exact(True) cafe.Checkpoint( e7.e7_check_ont_dataservice(**Conf)).exact(True) #Start IXIA config #Config WAN Server and LAN Clients #config server if Conf["WANType"] is "pppoe": ixia.ixia_config_pppserver("tg_Server", "p1", **Conf) ixia.ixia_control_pppox_by_name("tg_Server", "connect") elif Conf["WANType"] is "dhcp": ixia.ixia_config_dhcps("tg_Server", "p1", **Conf) ixia.ixia_control_dhcp_server("tg_Server", "start") else: pass ServerHandle = 'tg_Server' #config client #config IGMP client if Conf["McastProfile"] is not "none": print("start to config IGMP on IXIA") #clienthandle1 = ixia.ixia_config_l3_staticintf("LAN",**Conf) IGMPHandler = ixia.ixia_config_igmp( "igmp_session", "igmp_source", "p2", **Conf) # IGMPHandler = ixia.tg_create_igmp_on_port(GeneralConf["ixia_session"]) # if Conf["MVREnable"] is "1": # ixia.ixia_config_mvrintf("Mvr_intf","p1",**Conf) # IGMPSourceHandle = "Mvr_intf" # else: # IGMPSourceHandle = "tg_Server" # if not IGMPSourceHandle or not IGMPHandler: # cafe.Checkpoint().fail("Get IGMP handle Fail!") # test_result=False # print("Get IGMP handle Fail!") # time.sleep(2) # #Start Protocols #r = ixia.ixia_controll_start_allprotocols() ixia.ixia_control_igmp("igmp_session", "start") time.sleep(40) if Conf["Bridge"] is "RG": i = i + 1 if Conf["WANType"]: if Conf["WANType"] is "pppoe": usercases.subtc_verify_rg_ip(ont, i, "pppoe") else: usercases.subtc_verify_rg_ip(ont, i) else: usercases.subtc_verify_rg_ip(ont, i) ixia.ixia_create_l2_igmp_traffic("igmp_traffic", "p2", "p1", **Conf) #cafe.Checkpoint().fail("Create IGMP Traffic fail!") #test_result=False print("Create IGMP Traffic") time.sleep(10) #r = ixia.ixia_controll_start_allprotocols() else: if Conf["Bridge"] is "RG": print("Start to config RG service on IXIA") ixia.ixia_config_l3_staticintf("wan_static", "p1", "WAN", **Conf) WANClientHandle = "wan_static" ixia.ixia_config_l3_staticintf("lan_static", "p2", "LAN", **Conf) clienthandle1 = "lan_static" i = i + 1 else: if Conf["WANType"] is "pppoe": clienthandle1 = ixia.ixia_config_pppclient( "lanclient", "p2", **Conf) ixia.ixia_control_pppox_by_name( 'lanclient', 'connect') else: # dhcpchandlebasic1 = ixia.ixia_config_dhcpc_basic() clienthandle1 = ixia.ixia_config_dhcpc( "lanclient", "p2", **Conf) ixia.ixia_control_dhcp_client("lanclient", "start") WANClientHandle = clienthandle1 if "False" in ServerHandle or "False" in clienthandle1: cafe.Checkpoint().fail("Get Data Traffic handle Fail!") #add data traffic time.sleep(2) #r = ixia.ixia_controll_start_allprotocols() time.sleep(40) if Conf["Bridge"] is "RG": if Conf["WANType"]: if Conf["WANType"] is "pppoe": usercases.subtc_verify_rg_ip(ont, i, "pppoe") else: usercases.subtc_verify_rg_ip(ont, i) else: usercases.subtc_verify_rg_ip(ont, i) if not ixia.ixia_create_bound_tagged_stream( "us_traffic", "p1", ServerHandle, WANClientHandle, "us", **Conf): cafe.Checkpoint().fail( "Create up stream traffic fail!") test_result = False time.sleep(5) if not ixia.ixia_create_bound_tagged_stream( "ds_traffic", "p2", WANClientHandle, ServerHandle, "ds", **Conf): cafe.Checkpoint().fail( "create down stream traffic fail") test_result = False else: pass #Add Iphost SIP service for key, value in CaseConf.SIPConf.items(): Conf = GeneralConf.copy() Conf.update(value) if not e7.e7_add_ont_sipservice(**Conf): cafe.Checkpoint().fail("Add SIP Service Fail!") print("add SIP service fail!") r = e7.e7_check_ont_sipservice(**Conf) time.sleep(10) # ixia.ixia_controll_start_allprotocols() # print("IXIA:start all protocols......") # time.sleep(10) # r = ixia.ixia_controll_start_traffics() ixia.ixia_control_traffic("p1", "run") print("IXIA:start all traffics......") time.sleep(72) ixia.ixia_control_traffic("p1", "stop") print("IXIA:stop all traffics......") time.sleep(5) #dict_result = ixia.ixia_get_traffic_stats("traffic_item") #lossrate = dict_result['traffic_item']['aggregate']['rx']['loss_percent']["avg"] # print("first test lossrate:",lossrate) # if float(lossrate) > 10.0: # cafe.Checkpoint().fail("Loss rate is more than 10%!") # test_result=False #diable/enable gpon port gponport = e7.e7_get_ont_gponport(Conf["ontid"]) if gponport: print("start to disable GPON port") if not e7.e7_set_gponport_status(gponport, "disabled"): cafe.Checkpoint().fail("Disable gponport %s fail!" % gponport) else: time.sleep(10) print("Enable GPON port....") if not e7.e7_set_gponport_status(gponport, "enabled"): cafe.Checkpoint().fail( ("Enable gpon port %s fail!" % gponport)) else: time.sleep(150) print("Start traffic verify.....") if not usercases.subtc_verify_traffic(ixia): cafe.Checkpoint().fail("Traffic verify fail!") test_result = False else: cafe.Checkpoint().pass_step("test pass") else: pass return test_result
def tc_usercases_800e(CaseConf, **GeneralConf): """ id=5442423 verify the node1 craft interface name """ e7 = e7_lib.CalixE7Base(App().e7) ont = ont_lib.calixontbase(getattr(App(), GeneralConf["ont_topo"])) ixia = ixia_lib.IXIABase(**GeneralConf) CaseConf = CaseConf if ixia.connect_host(): if ixia.connect_chassis(): cafe.Checkpoint(e7.e7_provision_ont(**GeneralConf)).exact(True) i = 0 for key, value in CaseConf.DataConf.items(): Conf = GeneralConf.copy() Conf.update(value) if Conf["Enable"] is "1": if e7.e7_check_ont_dataservice(**Conf): pass else: cafe.Checkpoint( e7.e7_add_ont_dataservice(**Conf)).exact(True) cafe.Checkpoint(e7.e7_check_ont_dataservice( **Conf)).exact(True) #Start IXIA config #Config WAN Server and LAN Clients #config server if not "noTraffic" in Conf.keys(): if Conf["WANType"] is "pppoe": ServerHandle = ixia.ixia_config_pppserver( **Conf) elif Conf["WANType"] is "dhcp": ServerHandle = ixia.ixia_config_dhcps(**Conf) else: pass #config client #config IGMP client if Conf["McastProfile"] is not "none": #clienthandle1 = ixia.ixia_config_l3_staticintf("LAN",**Conf) IGMPHandler = ixia.ixia_config_igmp(**Conf) if Conf["MVREnable"] is "1": IGMPSourceHandle = ixia.ixia_config_mvrintf( **Conf) else: IGMPSourceHandle = ServerHandle if not IGMPSourceHandle or not IGMPHandler: cafe.Checkpoint().fail( "Get IGMP handle Fail!") time.sleep(2) #Start Protocols r = ixia.ixia_controll_stop_allprotocols() time.sleep(5) r = ixia.ixia_controll_start_allprotocols() time.sleep(40) if Conf["Bridge"] is "RG": i = i + 1 if Conf["WANType"]: if Conf["WANType"] is "pppoe": usercases.subtc_verify_rg_ip( ont, i, "pppoe") else: usercases.subtc_verify_rg_ip( ont, i) else: usercases.subtc_verify_rg_ip(ont, i) if not ixia.ixia_create_l2_igmp_traffic( IGMPSourceHandle, IGMPHandler): cafe.Checkpoint().fail( "Create IGMP Traffic fail!") time.sleep(10) r = ixia.ixia_controll_start_allprotocols() else: if Conf["Bridge"] is "RG" or Conf.has_key( "800EConnect"): WANClientHandle = ixia.ixia_config_l3_staticintf( "WAN", **Conf) clienthandle1 = ixia.ixia_config_l3_staticintf( "LAN", **Conf) i = i + 1 else: if Conf["WANType"] is "pppoe": clienthandle1 = ixia.ixia_config_pppclient( **Conf) else: dhcpchandlebasic1 = ixia.ixia_config_dhcpc_basic( ) clienthandle1 = ixia.ixia_config_dhcpc( dhcpchandlebasic1, **Conf) WANClientHandle = clienthandle1 if "False" in ServerHandle or "False" in clienthandle1: cafe.Checkpoint().fail( "Get Data Traffic handle Fail!") #add data traffic r = ixia.ixia_controll_stop_allprotocols() time.sleep(10) r = ixia.ixia_controll_start_allprotocols() time.sleep(40) if Conf["Bridge"] is "RG": if Conf["WANType"]: if Conf["WANType"] is "pppoe": usercases.subtc_verify_rg_ip( ont, i, "pppoe") else: usercases.subtc_verify_rg_ip( ont, i) else: usercases.subtc_verify_rg_ip(ont, i) if not ixia.ixia_create_l2_dhcp_traffic_us( ServerHandle, clienthandle1): cafe.Checkpoint().fail( "Create up stream traffic fail!") time.sleep(5) if not ixia.ixia_create_l2_dhcp_traffic_ds( ServerHandle, WANClientHandle): cafe.Checkpoint().fail( "create down stream traffic fail") else: pass #Add Iphost SIP service for key, value in CaseConf.SIPConf.items(): Conf = GeneralConf.copy() Conf.update(value) if not e7.e7_add_ont_sipservice(**Conf): cafe.Checkpoint().fail("Add SIP Service Fail!") r = e7.e7_check_ont_sipservice(**Conf) r = ixia.ixia_controll_stop_allprotocols() time.sleep(10) r = ixia.ixia_controll_start_allprotocols() time.sleep(10) r = ixia.ixia_controll_start_traffics() time.sleep(120) r = ixia.ixia_controll_stop_traffics() time.sleep(5) dict_result = ixia.ixia_get_traffic_stats("traffic_item") lossrate = dict_result['traffic_item']['aggregate']['rx'][ 'loss_percent']["avg"] print("lossrate:", lossrate) if float(lossrate) > 0.2: cafe.Checkpoint().fail("Loss rate is more than 0.2%!") #diable/enable gpon port # gponport = e7.e7_get_ont_gponport(Conf["ontid"]) # if gponport: # if not e7.e7_set_gponport_status(gponport,"disabled"): # cafe.Checkpoint().fail("Disable gponport %s fail!" %gponport) # else: # time.sleep(10) # if not e7.e7_set_gponport_status(gponport,"enabled"): # cafe.Checkpoint().fail(("Enable gpon port %s fail!" %gponport)) # else: # time.sleep(100) # if not subtc_verify_traffic(ixia): # cafe.Checkpoint().fail("Traffic verify fail!") # else: # cafe.Checkpoint().pass_step("test pass") else: pass
def UserCases1(CaseConf, **GeneralConf): """ id=5442423 verify the node1 craft interface name """ e7 = e7_lib.CalixE7Base(App().e7) ixia = Ixia_lib.IXIABase(**GeneralConf) CaseConf = CaseConf if ixia.connect_host(): if ixia.connect_chassis(): if not e7.e7_provision_ont(**GeneralConf): cafe.Checkpoint().fail("Provision ONT Fail!") for key, value in CaseConf.DataConf.items(): Conf = GeneralConf.copy() Conf.update(value) if not e7.e7_add_ont_dataservice(**Conf): cafe.Checkpoint().fail("Add Data or Video Service Fail!") r = e7.e7_check_ont_dataservice(**Conf) cafe.Checkpoint(r).not_contains("fail") #Start IXIA config #Config WAN Server and LAN Clients if Conf["Enable"] is "1": #Init the ver ServerHandle = "" clienthandle1 = "" WANClientHandle = "" IGMPSourceHandle = "" IGMPHandler = "" if Conf["WANType"] is "pppoe": ServerHandle = ixia.ixia_config_pppserver(**Conf) if Conf["Bridge"] is not "RG": pass else: dhcpchandlebasic1 = ixia.ixia_config_dhcpc_basic() clienthandle1 = ixia.ixia_config_dhcpc( dhcpchandlebasic1, **Conf) else: ServerHandle = ixia.ixia_config_dhcps(**Conf) dhcpchandlebasic1 = ixia.ixia_config_dhcpc_basic() clienthandle1 = ixia.ixia_config_dhcpc( dhcpchandlebasic1, **Conf) cafe.Checkpoint(ServerHandle).not_contains("False") print("ServerHandle: %s" % ServerHandle) cafe.Checkpoint(clienthandle1).not_contains("False") print("clienthandle1: %s" % clienthandle1) #Config WAN DS Client when RG is enabled if Conf["Bridge"] is "RG": WANClientHandle = ixia.ixia_config_l3_staticintf( "WAN", **Conf) else: WANClientHandle = clienthandle1 #Config IGMP Service if Conf["McastProfile"] is not "none": IGMPHandler = ixia.ixia_config_igmp( clienthandle1, **Conf) if Conf["MVREnable"] is "1": IGMPSourceHandle = ixia.ixia_config_mvrintf(**Conf) else: IGMPSourceHandle = ServerHandle cafe.Checkpoint(IGMPHandler).not_contains("False") cafe.Checkpoint(IGMPSourceHandle).not_contains("False") time.sleep(2) #Start Protocols r = ixia.ixia_controll_start_allprotocols() time.sleep(40) r = ixia.ixia_create_l2_igmp_traffic( IGMPSourceHandle, IGMPHandler) cafe.Checkpoint(r).not_contains("False") r = ixia.ixia_controll_start_allprotocols() else: #Config Data Service r = ixia.ixia_controll_start_allprotocols() time.sleep(20) r = ixia.ixia_create_l2_dhcp_traffic_us( ServerHandle, clienthandle1) cafe.Checkpoint(r).not_contains("False") r = ixia.ixia_create_l2_dhcp_traffic_ds( ServerHandle, WANClientHandle) cafe.Checkpoint(r).not_contains("False") #time.sleep(20) else: pass #Add Iphost SIP service for key, value in CaseConf.SIPConf.items(): Conf = GeneralConf.copy() Conf.update(value) if not e7.e7_add_ont_sipservice(**Conf): cafe.Checkpoint().fail("Add SIP Service Fail!") r = e7.e7_check_ont_sipservice(**Conf) cafe.Checkpoint(r).not_contains("fail") time.sleep(5) r = ixia.ixia_controll_start_traffics()
def post_actions(self): self.command("exit") result = self.command("\n") result = re.search('com login: $', result[2]) cafe.Checkpoint(str(result.group())).verify_regex(exp="login: $", pos_msg="re found!", neg_msg="re not found") self.close()
def e7gui_test_case(params): # Obtain required parameters ontgui = params['ontgui']['ontgui_session'] ontip = params['ontgui']['ontgui'] fsan = params['execution']['ontfsan1'] print("Hello! I am a test case!") cafe.Checkpoint("Pass me please").verify_exact("Pass me please") ontgui.wireless_radiosetup(ontip=ontip, radiotype="2.4GHz", radio="off", mode="802.11b") ontgui.wireless_radiosetup(ontip=ontip, radiotype="2.4GHz", radio="on", mode="802.11g and 802.11n") ontgui.wireless_radiosetup(ontip=ontip, radiotype="5GHz", radio="on", mode="802.11n", dfs="disabled", channel="36") ontgui.wireless_radiosetup(ontip=ontip, radiotype="5GHz", radio="on", mode="802.11n", dfs="enabled", channel="60") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="5GHz", ssid="5GHz_Operator_5", ssidstate="enabled", renamessid="YodaWasHere!") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="5GHz", ssid="YodaWasHere!", ssidisolate="enabled", gw="192.168.100.1", startip="192.168.100.10", stopip="192.168.100.100", mask="255.255.255.0") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="5GHz", ssid="YodaWasHere!", renamessid="5GHz_Operator_5") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="5GHz", ssid="5GHz_Operator_5", ssidstate="disabled") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="2.4GHz", ssid="2.4GHz_Operator_1", ssidstate="enabled", renamessid="NakedMoleRat") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="2.4GHz", ssid="NakedMoleRat", ssidisolate="enabled", gw="192.168.99.1", startip="192.168.99.10", stopip="192.168.99.100", mask="255.255.255.0") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="2.4GHz", ssid="NakedMoleRat", l2wansvc="enabled") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="2.4GHz", ssid="NakedMoleRat", l2wansvc="disabled") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="2.4GHz", ssid="NakedMoleRat", renamessid="2.4GHz_Operator_1") ontgui.wireless_ssidsetup(ontip=ontip, radiotype="2.4GHz", ssid="2.4GHz_Operator_1", ssidstate="disabled") ontgui.wireless_securitysetup(ontip=ontip, radiotype="2.4GHz", ssid=fsan, securitytype="WPA2-Personal", passphrase="YodaLivesHere") ontgui.wireless_securitysetup(ontip=ontip, radiotype="5GHz", ssid=fsan, securitytype="WPA - WPA2-Personal", encryptiontype="AES", keytype="custom", passphrase="Livernet")
def tc_usercases_1(case_conf, **GeneralConf): """ id=5442423 verify the node1 craft interface name """ e7 = e7_lib.CalixE7Base(App().e7) ixia = ixia_lib.IXIABase(**GeneralConf) case_conf = case_conf #import CaseConf as CaseConf if ixia.connect_host(): if ixia.connect_chassis(): if not e7.e7_provision_ont(**GeneralConf): cafe.Checkpoint().fail("Provision ONT Fail!") #add Data or Video Service Datalist = [case_conf.Data1, case_conf.Data2, case_conf.Data3] Siplist = [case_conf.SIP1, case_conf.SIP2] for dict in Datalist: Conf = GeneralConf.copy() Conf.update(dict) if not e7.e7_add_ont_dataservice(**Conf): cafe.Checkpoint().fail( "Add Data or Video Service Fail!") r = e7.e7_check_ont_dataservice(**Conf) cafe.Checkpoint(r).not_contains("fail") #Start IXIA config #Config WAN Server and LAN Clients if Conf["Enable"] is "1": #Init the ver serverhandle = "" clienthandle1 = "" wanclienthandle = "" IGMPSourceHandle = "" IGMPHandler = "" if dict.has_key("WANType"): if dict["WANType"] is "pppoe": serverhandle = ixia.ixia_config_pppserver( **dict) if dict["Bridge"] is not "RG": pass else: dhcpchandlebasic1 = ixia.ixia_config_dhcpc_basic( ) clienthandle1 = ixia.ixia_config_dhcpc( dhcpchandlebasic1, **dict) else: serverhandle = ixia.ixia_config_dhcps(**dict) dhcpchandlebasic1 = ixia.ixia_config_dhcpc_basic( ) clienthandle1 = ixia.ixia_config_dhcpc( dhcpchandlebasic1, **dict) cafe.Checkpoint(serverhandle).not_contains("False") print("serverhandle: %s" % serverhandle) cafe.Checkpoint(clienthandle1).not_contains("False") print("clienthandle1: %s" % clienthandle1) #Config WAN DS Client when RG is enabled if dict["Bridge"] is "RG": wanclienthandle = ixia.ixia_config_l3_staticintf( "WAN", **dict) else: wanclienthandle = clienthandle1 #Config IGMP Service if dict["McastProfile"] is not "none": IGMPHandler = ixia.ixia_config_igmp(**dict) if dict["MVREnable"] is "1": IGMPSourceHandle = ixia.ixia_config_mvrintf( **dict) else: IGMPSourceHandle = serverhandle cafe.Checkpoint(IGMPHandler).not_contains("False") cafe.Checkpoint(IGMPSourceHandle).not_contains( "False") time.sleep(2) #Start Protocols r = ixia.ixia_controll_start_allprotocols() time.sleep(40) r = ixia.ixia_create_l2_igmp_traffic( IGMPSourceHandle, IGMPHandler) cafe.Checkpoint(r).not_contains("False") r = ixia.ixia_controll_start_allprotocols() else: #Config Data Service r = ixia.ixia_controll_start_allprotocols() time.sleep(20) r = ixia.ixia_create_l2_dhcp_traffic_us( serverhandle, clienthandle1) cafe.Checkpoint(r).not_contains("False") r = ixia.ixia_create_l2_dhcp_traffic_ds( serverhandle, wanclienthandle) cafe.Checkpoint(r).not_contains("False") #time.sleep(20) else: pass #Add Iphost SIP service for dict in Siplist: Conf = GeneralConf.copy() Conf.update(dict) if not e7.e7_add_ont_sipservice(**Conf): cafe.Checkpoint().fail("Add SIP Service Fail!") r = e7.e7_check_ont_sipservice(**Conf) cafe.Checkpoint(r).not_contains("fail") time.sleep(5) r = ixia.ixia_controll_start_traffics()