def arp_static_route_reboot_module_hooks(request): # add things at the start of this module init_vars() initialize_variables() get_parms() global tg_handler tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2") global tg tg = tg_handler["tg"] tg_ph_list = [tg_handler["tg_ph_1"], tg_handler["tg_ph_2"]] st.log("configuring static route") adding_static_route() st.log("Getting ARP entry dynamically") adding_dynamic_arp() ip_obj.config_ip_addr_interface(vars.D1, vars.D1T1P2, data.ipv4_address_1, data.mask, family="ipv4", config='add') st.log("Configuring static ARP") arp_obj.add_static_arp(vars.D1, data.static_arp_ip, data.static_arp_mac, vars.D1T1P2) st.log( "Verifying static route entries before save and reboot/fast-reboot/warm-reboot" ) static_route_verify() st.log( "Verifying dynamic ARP entries before save and reboot/fast-reboot/warm-reboot" ) if not arp_obj.verify_arp(vars.D1, data.ipv4_address_ixia, data.src_mac_addr, vars.D1T1P1): st.report_fail("ARP_entry_dynamic_entry_fail", data.ipv4_address_ixia, vars.D1) else: st.log("Verified that dynamic ARP entry is present in arp table") st.log( "Verifying static ARP entries before save and reboot/fast-reboot/warm-reboot" ) if not arp_obj.verify_arp(vars.D1, data.static_arp_ip, data.static_arp_mac, ""): st.report_fail("static_arp_create_fail", vars.D1) else: st.log("Verified that static ARP entry is present in arp table") st.log("Save the config on the DUT") rb_obj.config_save(vars.D1) st.log("saving config in vtysh mode to save static route") rb_obj.config_save(vars.D1, shell="vtysh") yield # Below step will clear IP adresses configured on different interfaces in the device ip_obj.clear_ip_configuration(st.get_dut_names()) #Below step will clear static route configured in the device ip_obj.delete_static_route(vars.D1, data.ipv4_address_ixia, data.ipv4_address_network, family='ipv4', shell="vtysh") #Below step will delete static arp entries configured in the device arp_obj.delete_static_arp(vars.D1, data.static_arp_ip, vars.D1T1P2)
def full_cleanup(): bgpapi.cleanup_router_bgp(st.get_dut_names()) ipapi.clear_ip_configuration(st.get_dut_names(), thread=eh_data.thread_mode, family='all') vapi.clear_vlan_configuration(st.get_dut_names(), thread=eh_data.thread_mode)
def ndp_module_hooks(request): vars = st.ensure_min_topology("D1T1:2") # Initialize TG and TG port handlers tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2") tg = tg_handler["tg"] # Test setup details data.my_dut_list = st.get_dut_names() dut1 = data.my_dut_list[0] # NDP module configuration st.log("NDP module configuration.") ip_obj.config_ip_addr_interface(dut1, vars.D1T1P1, data.local_ip6_addr[0], 64, family=data.af_ipv6) vlan_obj.create_vlan(dut1, data.vlan_1) vlan_obj.add_vlan_member(dut1, data.vlan_1, vars.D1T1P2, True) ip_obj.config_ip_addr_interface(dut1, data.vlan_int_1, data.local_ip6_addr[1], 64, family=data.af_ipv6) # TG ports reset st.log("Resetting the TG ports") tg.tg_traffic_control(action="reset", port_handle=tg_handler["tg_ph_list"]) # TG protocol interface creation st.log("TG protocol interface creation") h1 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_1"], mode='config', ipv6_intf_addr=data.neigh_ip6_addr_gw[0], ipv6_prefix_length='64', ipv6_gateway=data.local_ip6_addr[0], src_mac_addr=data.tg_mac1, arp_send_req='1', count=data.count) st.log("INTFCONF: " + str(h1)) h2 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_2"], mode='config', ipv6_intf_addr=data.neigh_ip6_addr_gw[1], ipv6_prefix_length='64', ipv6_gateway=data.local_ip6_addr[1], src_mac_addr=data.tg_mac2, arp_send_req='1', vlan_id=data.vlan_1, vlan=1, count=data.count) st.log("INTFCONF: " + str(h2)) yield # NDP module cleanup st.log("NDP module cleanup.") ip_obj.clear_ip_configuration(dut1, family="ipv6", thread=data.clear_parallel) vlan_obj.clear_vlan_configuration(dut1, thread=data.clear_parallel)
def bgp_fast_reboot_module_hooks(request): global vars vars = st.ensure_min_topology("D1D2:1", "D1T1:2") if not st.is_feature_supported("bgp-neighbotship-performance", vars.D1): data.neighborship_wait = 30 st.log("Enabling IPv6 mode globally") ip_obj.config_ipv6(vars.D1, action='enable') ip_obj.config_ipv6(vars.D2, action='enable') st.log("Configuring ipv4 addresses on routing interfaces") ipv4_ip_address_config() st.log("Verifying ipv4 addresses on routing interfaces") verify_ipv4_address_config() if data.ipv6_support: st.log("Configuring ipv6 addresses on routing interfaces") ipv6_address_config() st.log("Verifying ipv6 addresses on routing interfaces") verify_ipv6_address_config() st.log( "Configuring IPV6 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG2" ) ipv6_bgp_config() st.log( "Configuring IPV4 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG1" ) ipv4_bgp_config() if data.ipv6_support: st.log("Configuring TG2 V6 iBGP config") tg_bgpv6_config(vars, data.local_asn4, data.remote_asn4) st.log("Configuring TG1 V4 iBGP config") tg_bgp_config(vars, data.local_asn4, data.remote_asn4) st.log( "Verify IPV4 eBGP neighborship between D1 and D2 and iBGP neighborship between D1 and TG1" ) verify_v4_bgp_neigborship() if data.ipv6_support: st.log( "Verify IPV6 eBGP neighborship between D1 and D2 and iBGP neighborship between D1 and TG2" ) verify_v6_bgp_neigborship() yield bgp_obj.cleanup_router_bgp(st.get_dut_names()) ip_obj.clear_ip_configuration(st.get_dut_names()) if data.ipv6_support: ip_obj.clear_ip_configuration(st.get_dut_names(), 'ipv6') vlan_obj.clear_vlan_configuration(st.get_dut_names()) portchannel_obj.clear_portchannel_configuration(st.get_dut_names())
def nat_post_config(): vars = st.get_testbed_vars() util_nat_zone_config(vars.D2, [vars.D2D1P1, vars.D2D3P1], [data.zone_1, data.zone_2], config=data.config_del) nat_obj.clear_nat_config(vars.D2) nat_obj.config_nat_feature(vars.D2, 'disable') ip_obj.delete_static_route(vars.D1, data.d2d1_ip_addr,"{}/{}".format(data.d1_static_nw, data.ip_addr_mask)) ip_obj.delete_static_route(vars.D3, data.d2d3_ip_addr,"{}/{}".format(data.d3_static_nw, data.ip_addr_mask)) ip_obj.clear_ip_configuration(st.get_dut_names())
def arp_module_hooks(request): global vars, tg_handler, tg, dut1, d1_mac_addr, h1, h2 # Min topology verification vars = st.ensure_min_topology("D1T1:2") # Initialize TG and TG port handlers tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2") tg = tg_handler["tg"] # Test setup details data.my_dut_list = st.get_dut_names() dut1 = data.my_dut_list[0] # Test variables d1_mac_addr = mac.get_sbin_intf_mac(dut1, "eth0") # ARP module configuration st.log("ARP module configuration.") ip_obj.config_ip_addr_interface(dut1, vars.D1T1P1, data.d1t1_ip_addr, data.mask) vlan_obj.create_vlan(dut1, data.vlan_1) vlan_obj.add_vlan_member(dut1, data.vlan_1, vars.D1T1P2, True) ip_obj.config_ip_addr_interface(dut1, data.vlan_int_1, data.d1t2_ip_addr, data.mask) # TG ports reset st.log("Resetting the TG ports") tg.tg_traffic_control(action="reset", port_handle=tg_handler["tg_ph_list"]) # TG protocol interface creation st.log("TG protocol interface creation") h1 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_1"], mode='config', intf_ip_addr=data.t1d1_ip_addr, gateway=data.d1t1_ip_addr, src_mac_addr=data.t1d1_mac_addr, arp_send_req='1') st.log("INTFCONF: " + str(h1)) h2 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_2"], mode='config', intf_ip_addr=data.t2d1_ip_addr, gateway=data.d1t2_ip_addr, src_mac_addr=data.t2d1_mac_addr, arp_send_req='1', vlan_id=data.vlan_1, vlan=1) st.log("INTFCONF: " + str(h2)) yield # ARP module cleanup st.log("ARP module cleanup.") ip_obj.clear_ip_configuration(dut1, family="ipv4", thread=data.clear_parallel) vlan_obj.clear_vlan_configuration(dut1, thread=data.clear_parallel)
def ip_module_hooks(request): global vars, tg_handler, tg # Min topology verification st.log("Ensuring minimum topology") vars = st.ensure_min_topology("D1T1:2") # Initialize TG and TG port handlers tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2") tg = tg_handler["tg"] yield ipfeature.clear_ip_configuration(vars.D1)
def bgp_rr_traffic_pre_config_cleanup(): st.banner("BGP RR WITH TRAFFIC CLASS CONFIG CLEANUP - START") bgplib.l3tc_vrfipv4v6_address_leafspine_bgp_config(config='no', rr_enable='true') bgplib.l3tc_vrfipv4v6_address_leafspine_config_unconfig(config='no') bgpapi.cleanup_router_bgp(st.get_dut_names()) ipapi.clear_ip_configuration(st.get_dut_names(), family='all', thread=True) bgplib.l3tc_underlay_config_unconfig(config='no') bgplib.l3tc_vrfipv4v6_address_leafspine_rr_tg_bgp_config(config='no', rr_enable='true') st.banner("BGP RR WITH TRAFFIC CLASS CONFIG CLEANUP - END")
def pre_test_l3_fwding(): # override from testbed vars = st.get_testbed_vars() data.my_dut_list = st.get_dut_names() ipfeature.clear_ip_configuration(st.get_dut_names()) ipfeature.clear_ip_configuration(st.get_dut_names(),'ipv6') vapi.clear_vlan_configuration(st.get_dut_names()) ipfeature.config_ip_addr_interface(vars.D1, vars.D1T1P1, data.d1t1_5_x_ip_addr, data.mask) ipfeature.config_ip_addr_interface(vars.D1, vars.D1T1P2, data.d1t2_5_x_ip_addr, data.mask)
def bgp_save_reboot_module_hooks(request): global vars vars = st.ensure_min_topology("D1D2:1", "D1T1:2") data.shell_vtysh = st.get_ui_type() if data.shell_vtysh == "click": data.shell_vtysh = "vtysh" if not st.is_feature_supported("bgp-neighbotship-performance", vars.D1): data.neighborship_wait = 30 st.log("Enabling IPv6 mode globally") st.exec_each([vars.D1, vars.D2], ip_obj.config_ipv6, action='enable') st.log("Configuring ipv4 addresses on routing interfaces") st.exec_each([vars.D1, vars.D2], ipv4_ip_address_config) st.log("Verifying ipv4 addresses on routing interfaces") st.exec_each([vars.D1, vars.D2], verify_ipv4_address_config) if data.ipv6_support: st.log("Configuring ipv6 addresses on routing interfaces") st.exec_each([vars.D1, vars.D2], ipv6_address_config) st.log("Verifying ipv6 addresses on routing interfaces") st.exec_each([vars.D1, vars.D2], verify_ipv6_address_config) st.log( "Configuring IPV6 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG2" ) st.exec_each([vars.D1, vars.D2], ipv6_bgp_config) st.log( "Configuring IPV4 eBGP config between DUT1 and DUT2,iBGP config between DUT1 and TG1" ) st.exec_each([vars.D1, vars.D2], ipv4_bgp_config) if data.ipv6_support: st.log("Configuring TG2 V6 iBGP config") tg_bgpv6_config(vars, data.local_asn4, data.remote_asn4) st.log("Configuring TG1 V4 iBGP config") tg_bgp_config(vars, data.local_asn4, data.remote_asn4) yield bgp_obj.cleanup_router_bgp(st.get_dut_names()) ip_obj.clear_ip_configuration(st.get_dut_names()) if data.ipv6_support: ip_obj.clear_ip_configuration(st.get_dut_names(), 'ipv6', skip_error_check=True) vlan_obj.clear_vlan_configuration(st.get_dut_names()) portchannel_obj.clear_portchannel_configuration(st.get_dut_names())
def nest_l3_32ecmp_scaling_tc(): (dut) = (data.dut) max_ecmp_32 = data.max_ecmp/4 use_config_file = True ipfeature.clear_ip_configuration([dut]) ret = l3_ecmp_scaling_tc(max_ecmp_32, use_config_file) if ret is True: st.log("Test Case 1.13 PASSED") st.report_pass("operation_successful") else: st.log("Test Case 1.13 FAILED") st.report_fail("operation_failed") st.report_pass("operation_successful")
def dhcp_relay_module_config(request): initialize_variables() vars = st.ensure_min_topology("D1D2:1", "D2D3:2") bind_class_action_copp_policy(vars.D3, classifier='copp-system-dhcpl2', action_group='copp-system-dhcp') response = basic_obj.dhcp_server_config( vars.D1, dhcp_files_path=data.dhcp_files_path, server_port=vars.D1D2P1, server_ipv4=data.dhcp_server_ip, route_list=data.route_list, ipv4_relay_agent_ip=data.RA_ipaddress_1) if not response: st.report_fail("service_operation_status", "isc-dhcp-server", "installation", "failed") connected_port_ip_address_config() if not basic_obj.check_interface_status(vars.D2, data.dhcp_relay_params, "up"): basic_obj.ifconfig_operation(vars.D2, data.dhcp_relay_params, "up") if not ip_obj.ping(vars.D2, data.dhcp_server_ip): st.log( "Pinging to DHCP server failed from DUT, issue either with DUT or server" ) st.report_fail("ping_fail", data.dhcp_server_ip) basic_dhcp_relay_config_addition() yield response = basic_obj.dhcp_server_config( vars.D1, action="unconfig", dhcp_files_path=data.dhcp_files_path, server_port=vars.D1D2P1, server_ipv4=data.dhcp_server_ip, route_list=data.route_list, ipv4_relay_agent_ip=data.RA_ipaddress_1) if not response: st.report_fail("service_operation_status", "isc-dhcp-server", "uninstallation", "failed") dhcp_relay_obj.dhcp_relay_config_remove(vars.D2, vlan=data.vlan_int, IP=data.dhcp_server_ip) ip_obj.config_ip_addr_interface(vars.D2, data.dhcp_relay_params, data.RA_ipaddress_1, data.subnet, family=data.family, config='remove') ip_obj.clear_ip_configuration(st.get_dut_names()) ip_obj.clear_ip_configuration(st.get_dut_names(), 'ipv6') vlan_obj.clear_vlan_configuration(st.get_dut_names())
def nat_post_config(): vars = st.get_testbed_vars() util_nat_zone_config(vars, [vars.D1T1P1, vars.D1T1P2], [data.zone_1, data.zone_2], config=data.config_del) nat_obj.clear_nat_config(vars.D1) nat_obj.config_nat_feature(vars.D1, 'disable') ip_obj.delete_static_route(vars.D1, data.out_ip_addr_h, "{}/{}".format(data.global_ip_addr_rt, data.global_ip_addr_mask)) ip_obj.clear_ip_configuration(st.get_dut_names()) vlan_obj.clear_vlan_configuration(st.get_dut_names()) st.log("Cleaning up routing interfaces configured on TG") tg1.tg_interface_config(port_handle=tg_ph_1, handle=tg_rt_int_handle[0]['handle'], mode='destroy') tg1.tg_interface_config(port_handle=tg_ph_2, handle=tg_rt_int_handle[1]['handle'], mode='destroy') tgapi.traffic_action_control(tg_handler, actions=['reset'])
def test_max_v4_route_with_max_paths_variant(): (dut) = (data.dut) max_ecmp = data.max_ecmp ipfeature.clear_ip_configuration([dut]) use_config_file = False max_routes = 65000 ret = l3_max_route_max_path_scaling_tc(max_ecmp, max_routes, use_config_file) if ret is True: st.log("Test Case PASSED") st.report_pass("operation_successful") else: st.log("Test Case FAILED") st.report_fail("operation_failed") st.report_pass("operation_successful")
def test_ft_l3_Xecmp_scaling_tc(): (dut) = (data.dut) max_ecmp_4 = data.max_ecmp/32 ipfeature.clear_ip_configuration([dut]) #use_config_file = False use_config_file = False ret = l3_ecmp_scaling_tc(max_ecmp_4, use_config_file) if ret is True: st.log("Test Case PASSED") st.report_pass("operation_successful") else: st.log("Test Case FAILED") st.report_fail("operation_failed") st.report_pass("operation_successful")
def test_max_v4_route_with_max_paths(): (dut) = (data.dut) max_ecmp_16 = data.max_ecmp/8 ipfeature.clear_ip_configuration([dut]) use_config_file = False max_routes = 100 ret = l3_max_route_max_path_scaling_tc(max_ecmp_16, max_routes, use_config_file) st.debug("ret : {}".format(ret)) if ret is True: st.log("Test Case PASSED") st.report_pass("operation_successful") else: st.log("Test Case FAILED") st.report_fail("operation_failed") st.report_pass("operation_successful")
def cmds_func_hooks(request): yield d1 = {'domain_id': 1, 'config': 'del', 'cli_type': 'click'} putils.exec_parallel(True, [data.d1, data.d2], mclag.config_domain, [d1, d1]) if st.get_func_name(request) == 'test_chef_evpn_vxlan_nvo': evpn_cleanup() bgp_cleanup() ip_obj.clear_ip_configuration(st.get_dut_names(), thread=data.clear_parallel) vlan.clear_vlan_configuration(st.get_dut_names(), thread=data.clear_parallel, cli_type=data.cli_type) clear_portchannel_configuration(st.get_dut_names(), thread=data.clear_parallel, cli_type=data.cli_type)
def sanity_l3_func_hooks(request): # add things at the start every test case # use 'st.get_func_name(request)' to compare # if any thing specific a particular test case global vars vars = st.ensure_min_topology("D1D2:1", "D1T1:1", "D2T1:1") st.log("POST TEST : Cleanup call are started..") ipfeature.clear_ip_configuration(st.get_dut_names(), thread=data.clear_parallel) ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6', thread=data.clear_parallel) vapi.clear_vlan_configuration(st.get_dut_names(), thread=data.clear_parallel) portchannel_obj.clear_portchannel_configuration(st.get_dut_names(), thread=data.clear_parallel) pre_test_l3_fwding() yield post_test_l3_fwding()
def l3fwd_func_hooks(request): global vars vars = st.get_testbed_vars() st.log("PRE TSET : Cleanup call are started.") ipfeature.clear_ip_configuration(st.get_dut_names()) ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6') vapi.clear_vlan_configuration(st.get_dut_names()) yield st.log("POST TSET : Cleanup call are started.") ipfeature.clear_ip_configuration(st.get_dut_names()) ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6') vapi.clear_vlan_configuration(st.get_dut_names())
def clear_module_configuration(): print_log("Clearing module configuration") # delete Ipv4 address print_log("Delete ip address configuration:") ip_obj.clear_ip_configuration([vars.D1, vars.D2], family='ipv4') # delete Ipv6 address ip_obj.clear_ip_configuration([vars.D1, vars.D2], family='ipv6') # delete ipv4 static routes ip_obj.delete_static_route(vars.D1, data.ipv4_portchannel_D2, data.ipv4_network_D2, shell="vtysh", family="ipv4") ip_obj.delete_static_route(vars.D2, data.ipv4_portchannel_D1, data.ipv4_network_D1, shell="vtysh", family="ipv4") # delete ipv6 static routes ip_obj.delete_static_route(vars.D1, data.ipv6_portchannel_D2, data.ipv6_network_D2, shell="vtysh", family="ipv6") ip_obj.delete_static_route(vars.D2, data.ipv6_portchannel_D1, data.ipv6_network_D1, shell="vtysh", family="ipv6") # delete port channel members print_log("Deleting members from port channel:") utils.exec_all(True, [ utils.ExecAllFunc(pc_obj.delete_portchannel_member, vars.D1, data.portChannelName, data.dut1_lag_members), utils.ExecAllFunc(pc_obj.delete_portchannel_member, vars.D2, data.portChannelName, data.dut2_lag_members), ]) # delete port channel print_log("Deleting port channel configuration:") utils.exec_all(True, [ utils.ExecAllFunc(pc_obj.delete_portchannel, vars.D1, data.portChannelName), utils.ExecAllFunc(pc_obj.delete_portchannel, vars.D2, data.portChannelName), ]) # delete acl tables and rules print_log("Deleting ACLs:") [_, exceptions] = utils.exec_all(True, [[acl_obj.acl_delete, vars.D1], [acl_obj.acl_delete, vars.D2]]) ensure_no_exception(exceptions) #Clear static arp entries print_log("Clearing ARP entries") arp_obj.clear_arp_table(vars.D1) arp_obj.clear_arp_table(vars.D2) #Clear static ndp entries print_log("Clearing NDP entries") arp_obj.clear_ndp_table(vars.D1) arp_obj.clear_ndp_table(vars.D2)
def ipv6_link_local_post_config(): vars = st.get_testbed_vars() st.log("Static route cleanup") utils.exec_all(True, [ [ip_obj.delete_static_route, vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6', "vtysh", vars.D1D2P1], [ip_obj.delete_static_route, vars.D2, data.tg_ip6_addr_l[1], data.static_rt, 'ipv6', "vtysh", vars.D2T1P1]]) ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6',"vtysh", data.vlan_in_1) ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6',"vtysh", data.prt_chnl) ip_obj.delete_static_route(vars.D1, d2_prt_link_local[0], data.static_rt, 'ipv6', "vtysh", data.vlan_in_2, vrf=data.vrf_name) vrf_obj.config_vrf(vars.D1, vrf_name=data.vrf_name, config='no') st.log("Disabling ipv6 link local") utils.exec_all(True, [[ip_obj.config_interface_ip6_link_local, vars.D1, d1_int_ipv6_list, 'disable'], [ip_obj.config_interface_ip6_link_local, vars.D2, d2_int_ipv6_list, 'disable']]) ip_obj.clear_ip_configuration(st.get_dut_names(), family = 'ipv6') st.log("Vlan and Port Channel clean up") vlan_obj.clear_vlan_configuration(st.get_dut_names()) pc_obj.clear_portchannel_configuration(st.get_dut_names()) st.log("Cleaning up routing interfaces configured on TG") st.log("Stopping the TG traffic again, if in case of any failures in test function misses the stop operation") tgapi.traffic_action_control(tg_handler, actions=['reset']) tg1.tg_interface_config(port_handle=tg_ph_1, handle=tg_rt_int_handle[0]['handle'], mode='destroy') tg2.tg_interface_config(port_handle=tg_ph_2, handle=tg_rt_int_handle[1]['handle'], mode='destroy')
def bgp_unnum_post_config(): vars = st.get_testbed_vars() bgp_obj.cleanup_router_bgp(st.get_dut_names()) ip_obj.clear_ip_configuration(st.get_dut_names(), family='ipv4', skip_error_check=True) ip_obj.clear_ip_configuration(st.get_dut_names(), family='ipv6', skip_error_check=True) utils.exec_all(True, [[ ip_obj.config_interface_ip6_link_local, vars.D1, d1_int_ipv6_list, "disable" ], [ ip_obj.config_interface_ip6_link_local, vars.D2, d2_int_ipv6_list, "disable" ]]) vlan_obj.clear_vlan_configuration(st.get_dut_names()) pc_obj.clear_portchannel_configuration(st.get_dut_names()) st.log("Cleaning up routing interfaces configured on TG") st.log( "Stopping the TG traffic again, if in case of any failures in test function misses the stop operation" )
def measure_v6_route_learning_time(route_count): vars = st.get_testbed_vars() dut = vars.D1 ipfeature.clear_ip_configuration(st.get_dut_names()) ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6') member3 = vars.D1T1P1 member4 = vars.D1T1P2 ipfeature.config_ip_addr_interface(dut, member3, data.my_ipv6_addr, data.ipv6_prefixlen, family="ipv6") ipfeature.config_ip_addr_interface(dut, member4, data.intf_ipv6_addr, data.ipv6_prefixlen, family="ipv6") ipfeature.get_interface_ip_address(dut, family="ipv6") ipfeature.show_ip_route(dut, family="ipv6") bgpfeature.create_bgp_router(dut, data.as_num, '') bgpfeature.create_bgp_neighbor(dut, data.as_num, data.neigh_ipv6_addr, data.remote_as_num, family="ipv6") create_bgp_neighbor_route_map_config(dut, data.as_num, data.neigh_ipv6_addr, data.routemap) (tg1, tg2, tg_ph_1, tg_ph_2) = get_handles() tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2) h1 = tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', ipv6_intf_addr='2000::2', ipv6_prefix_length='64', ipv6_gateway='2000::1', src_mac_addr='00:0a:01:00:00:01', arp_send_req='1') st.log("INTFCONF: " + str(h1)) h2 = tg2.tg_interface_config(port_handle=tg_ph_2, mode='config', ipv6_intf_addr='2200::2', ipv6_prefix_length='64', ipv6_gateway='2200::1', arp_send_req='1') st.log("INTFCONF: " + str(h2)) bgp_conf = tg1.tg_emulation_bgp_config(handle=h1['handle'], mode='enable', ip_version='6', active_connect_enable='1', local_as='200', remote_as='100', remote_ipv6_addr='2000::1') bgp_route = tg1.tg_emulation_bgp_route_config(handle=bgp_conf['handle'], mode='add', ip_version='6', num_routes=route_count, prefix='3300:1::', as_path='as_seq:1') tg1.tg_emulation_bgp_control(handle=bgp_conf['handle'], mode='start') # Configuring the BGP router. st.log("BGP neighborship established.") tr2 = tg2.tg_traffic_config(port_handle=tg_ph_2, emulation_src_handle=h2['handle'], emulation_dst_handle=bgp_route['handle'], circuit_endpoint_type='ipv6', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='0') tg2.tg_traffic_control(action='run', handle=tr2['stream_id']) output = bcm_show(dut, 'bcmcmd "l3 ip6route show" | wc -l') default_route = parse_route_output(output) #Assume default route as current number of routes in the system #and measure route_count perforamnce on top of it route_count += default_route cmd = 'bcmcmd "l3 ip6route show" | wc -l' measure_route_learn_time(dut, default_route, route_count, cmd) res = tg2.tg_traffic_control(action='stop', handle=tr2['stream_id']) st.log("TR_CTRL: " + str(res)) # Withdraw the routes. st.wait(10) bgp_ctrl = tg1.tg_emulation_bgp_control(handle=bgp_conf['handle'], mode='stop') st.log("BGPCTRL: " + str(bgp_ctrl)) tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2) st.wait(50) tg1.tg_interface_config(port_handle=tg_ph_1, handle=h1['handle'], mode='destroy') tg2.tg_interface_config(port_handle=tg_ph_2, handle=h2['handle'], mode='destroy')
def bgp_warm_reboot_module_hooks(request): global vars, tg_handler, tg, dut, ctrl_start, ctrl_stop global dut_to_tg_port_1, dut_to_tg_port_2, hwsku_under_test initialize_variables() vars = st.ensure_min_topology("D1T1:2") # Initialize TG and TG port handlers tg_handler = tgapi.get_handles(vars, [vars.T1D1P1, vars.T1D1P2]) tg = tg_handler["tg"] ctrl_start = {'mode': 'start'} ctrl_stop = {'mode': 'stop'} # Test setup details dut = vars.D1 dut_to_tg_port_1 = vars.D1T1P1 dut_to_tg_port_2 = vars.D1T1P2 hwsku_under_test = basic_obj.get_hwsku(dut) # Configuring v4/v6 routing interfaces on the DUT. ipfeature.clear_ip_configuration(st.get_dut_names()) ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6') ipfeature.config_ip_addr_interface(dut, dut_to_tg_port_1, data.my_ip_addr, data.ip_prefixlen, family="ipv4") ipfeature.config_ip_addr_interface(dut, dut_to_tg_port_1, data.my_ipv6_addr, data.ipv6_prefixlen, family="ipv6") ipfeature.config_ip_addr_interface(dut, dut_to_tg_port_2, data.intf_ip_addr, data.ip_prefixlen, family="ipv4") ipfeature.config_ip_addr_interface(dut, dut_to_tg_port_2, data.intf_ipv6_addr, data.ipv6_prefixlen, family="ipv6") # Configuring BGP router and v4/v6 neighbors on the DUT. bgpfeature.create_bgp_router(dut, data.as_num, '') bgpfeature.create_bgp_neighbor(dut, data.as_num, data.neigh_ip_addr, data.remote_as_num) bgpfeature.create_bgp_neighbor(dut, data.as_num, data.neigh_ipv6_addr, data.remote_as_num, family="ipv6") yield st.log("L3 Performance Enhancements Module Cleanup.") ipfeature.delete_ip_interface(dut, dut_to_tg_port_1, data.my_ip_addr, data.ip_prefixlen, family="ipv4") ipfeature.delete_ip_interface(dut, dut_to_tg_port_1, data.my_ipv6_addr, data.ipv6_prefixlen, family="ipv6") ipfeature.delete_ip_interface(dut, dut_to_tg_port_2, data.intf_ip_addr, data.ip_prefixlen, family="ipv4") ipfeature.delete_ip_interface(dut, dut_to_tg_port_2, data.intf_ipv6_addr, data.ipv6_prefixlen, family="ipv6") bgpfeature.delete_bgp_neighbor(dut, data.as_num, data.neigh_ip_addr, data.remote_as_num) bgpfeature.delete_bgp_neighbor(dut, data.as_num, data.neigh_ipv6_addr, data.remote_as_num) bgpfeature.cleanup_router_bgp(dut)
def ip_module_hooks(request): global vars, tg_handler, tg # Min topology verification st.log("Ensuring minimum topology") vars = st.ensure_min_topology("D1T1:4", "D2T1:2", "D1D2:4") # Initialize TG and TG port handlers tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D1P2", "T1D2P1", "T1D2P2") tg = tg_handler["tg"] # IP module configuration st.log("Vlan routing configuration on D1D2P1,D2D1P1") vlan_obj.create_vlan(vars.D1, data.vlan_1) vlan_obj.add_vlan_member(vars.D1, data.vlan_1, [vars.D1D2P1], tagging_mode=True) vlan_obj.create_vlan(vars.D2, data.vlan_1) vlan_obj.add_vlan_member(vars.D2, data.vlan_1, [vars.D2D1P1], tagging_mode=True) ipfeature.config_ip_addr_interface(vars.D1, data.vlan_int_1, data.ip4_addr[2], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D1, data.vlan_int_1, data.ip6_addr[2], 96, family=data.af_ipv6) ipfeature.config_ip_addr_interface(vars.D2, data.vlan_int_1, data.ip4_addr[3], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D2, data.vlan_int_1, data.ip6_addr[3], 96, family=data.af_ipv6) st.log("Port routing configuration on port-channel") data.dut1_pc_members = [vars.D1D2P2, vars.D1D2P3] data.dut2_pc_members = [vars.D2D1P2, vars.D2D1P3] pc_obj.create_portchannel(vars.D1, data.port_channel) pc_obj.add_portchannel_member(vars.D1, data.port_channel, data.dut1_pc_members) pc_obj.create_portchannel(vars.D2, data.port_channel) pc_obj.add_portchannel_member(vars.D2, data.port_channel, data.dut2_pc_members) ipfeature.config_ip_addr_interface(vars.D1, data.port_channel, data.ip4_addr[4], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D2, data.port_channel, data.ip4_addr[5], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D1, data.port_channel, data.ip6_addr[4], 96, family=data.af_ipv6) ipfeature.config_ip_addr_interface(vars.D2, data.port_channel, data.ip6_addr[5], 96, family=data.af_ipv6) st.log("port routing configuration on D1D2P4,D2D1P4") ipfeature.config_ip_addr_interface(vars.D1, vars.D1D2P4, data.ip4_addr[6], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D2, vars.D2D1P4, data.ip4_addr[7], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D1, vars.D1D2P4, data.ip6_addr[6], 96, family=data.af_ipv6) ipfeature.config_ip_addr_interface(vars.D2, vars.D2D1P4, data.ip6_addr[7], 96, family=data.af_ipv6) st.log("configuring the dut1 ports connected to TGen with ip addresses") ipfeature.config_ip_addr_interface(vars.D1, vars.D1T1P1, data.ip4_addr[1], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D1, vars.D1T1P2, data.ip6_addr[1], 96, family=data.af_ipv6) ipfeature.create_static_route(vars.D1, data.ip6_addr[7], data.static_ip6_rt, shell=data.shell_vtysh, family=data.af_ipv6) ipfeature.create_static_route(vars.D1, data.ip4_addr[7], data.static_ip_rt, shell=data.shell_vtysh, family=data.af_ipv4) st.log("configuring the dut2 ports connected to TGen with ip addresses") ipfeature.config_ip_addr_interface(vars.D2, vars.D2T1P1, data.ip4_addr[8], 24, family=data.af_ipv4) ipfeature.config_ip_addr_interface(vars.D2, vars.D2T1P2, data.ip6_addr[8], 96, family=data.af_ipv6) yield ipfeature.clear_ip_configuration(st.get_dut_names()) ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6') vlan_obj.clear_vlan_configuration(st.get_dut_names()) pc_obj.clear_portchannel_configuration(st.get_dut_names()) ipfeature.delete_static_route(vars.D1, data.ip4_addr[7], data.static_ip_rt, shell=data.shell_vtysh, family=data.af_ipv4) ipfeature.delete_static_route(vars.D1, data.static_ip6_rt_drop, data.static_ip6_rt, shell=data.shell_vtysh, family=data.af_ipv6)
def test_l3_ecmp_4paths_on_bo_tc(): (dut) = (data.dut) #count = 0 #intf_ip_addr = data.start_ip_addr #intf_ip_addr2 = data.start_ip_addr2 #nexthop = data.nexthop_start_ip_addr nexthop = "10.2.101.10/32" member1 = vars.D1T1P1 member2 = vars.D1T1P2 member3 = vars.D1T1P3 member4 = vars.D1T1P4 apply_file = False ipfeature.clear_ip_configuration([dut]) max_range = data.base_val+4 base_range = data.base_val-1 if apply_file is False: command = "config vlan range add 100 105" st.config(dut, command) command = "config vlan member add 100 {}".format(member4) st.config(dut, command) command = "config vlan member add 101 {}".format(member1) st.config(dut, command) command = "config vlan member add 102 {}".format(member2) st.config(dut, command) command = "config vlan member add 103 {}".format(member3) st.config(dut, command) command = "config vlan member add 104 {}".format(member4) st.config(dut, command) #ip_addr = data.start_ip_addr ip_addr = "10.2.100.1/24" for index in range(base_range, max_range): command = "config interface ip add "+ "Vlan" + str(index) + " " + ip_addr st.config(dut, command) (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network") base_range = data.base_val max_range = data.base_val+3 for index in range(base_range, max_range): (_, nexthop) = ipfeature.increment_ip_addr(nexthop, "network") nexthop1 = nexthop formatted_next_hop = nexthop1.replace("/32","") ipfeature.create_static_route(dut, formatted_next_hop, data.static_route) data.my_dut_list = st.get_dut_names() #dut1 = data.my_dut_list[0] (tg1, tg_ph_1, tg2, tg_ph_2, tg3, tg_ph_3, tg4, tg_ph_4) = get_handles_1() tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1) tg2.tg_traffic_control(action='reset',port_handle=tg_ph_2) tg2.tg_traffic_control(action='reset',port_handle=tg_ph_3) tg2.tg_traffic_control(action='reset',port_handle=tg_ph_4) h0=tg4.tg_interface_config(port_handle=tg_ph_4, mode='config', intf_ip_addr='10.2.100.10', gateway='10.2.100.1', src_mac_addr='00:0d:01:00:00:01', vlan='1', vlan_id='100', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.101.10', gateway='10.2.101.1', src_mac_addr='00:0d:02:00:00:01', vlan='1', vlan_id='101', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') h2=tg2.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr='10.2.102.10', gateway='10.2.102.1', src_mac_addr='00:0c:01:00:00:01', vlan='1', vlan_id='102', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') h3=tg3.tg_interface_config(port_handle=tg_ph_3, mode='config', intf_ip_addr='10.2.103.10', gateway='10.2.103.1', src_mac_addr='00:0c:02:00:00:01', vlan='1', vlan_id='103', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') h4=tg4.tg_interface_config(port_handle=tg_ph_4, mode='config', intf_ip_addr='10.2.104.10', gateway='10.2.104.1', src_mac_addr='00:0a:02:00:00:01', vlan='1', vlan_id='104', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') mac_eth = macapi.get_sbin_intf_mac(vars.D1,'eth0') tr1=tg4.tg_traffic_config(port_handle=tg_ph_4, mac_src='00:11:01:00:00:01', mac_dst=mac_eth, ip_dst_mode='increment', ip_dst_count=200, ip_dst_step='0.0.0.1',ip_src_addr='10.2.100.10', ip_dst_addr='200.1.0.1', l3_protocol='ipv4', l2_encap='ethernet_ii_vlan', vlan_id='100', vlan='enable', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='1') tg2.tg_traffic_control(action='run', handle=tr1['stream_id']) #count = 0 #Port Counters st.wait(20) st.show(dut, "show arp") #Port Counters ret = check_intf_traffic_bo_counters() if ret is True: st.log("Test Case PASSED") tg2.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_interface_config(port_handle=tg_ph_1, handle=h0['handle'], mode='destroy') tg1.tg_interface_config(port_handle=tg_ph_1, handle=h1['handle'], mode='destroy') tg2.tg_interface_config(port_handle=tg_ph_2, handle=h2['handle'], mode='destroy') tg3.tg_interface_config(port_handle=tg_ph_3, handle=h3['handle'], mode='destroy') tg4.tg_interface_config(port_handle=tg_ph_4, handle=h4['handle'], mode='destroy') if apply_file is False: base_range = data.base_val-1 ip_addr = data.start_ip_addr max_range = data.base_val+4 for index in range(base_range, max_range): command = "config interface ip remove "+ "Vlan" + str(index) + " " + ip_addr st.config(dut, command) (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network") command = "config vlan member del 100 {}".format(member4) st.config(dut, command) command = "config vlan member del 101 {}".format(member1) st.config(dut, command) command = "config vlan member del 102 {}".format(member2) st.config(dut, command) command = "config vlan member del 103 {}".format(member3) st.config(dut, command) command = "config vlan member del 104 {}".format(member4) st.config(dut, command) command = "config vlan range del 100 105" st.config(dut, command) if ret is True: st.log("Test Case PASSED") st.report_pass("operation_successful") else: st.log("Test Case FAILED") st.report_fail("operation_failed")
def portchannel_func_hooks(request): yield if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_is_up_or_not_with_one_active_member': portchannelobj.add_del_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1[1:]) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_is_up_with_active_members_when_no_lag_in_partner': portchannelobj.create_portchannel(vars.D2, static_data.portchannel_name, static=True) portchannelobj.add_del_portchannel_member(vars.D2, static_data.portchannel_name, static_data.members_dut2) add_vlan_member(vars.D2, static_data.vid, static_data.portchannel_name, tagging_mode=True) if st.get_func_name( request ) == 'test_ft_verify_fallback_is_configure_or_not_on_static_portchannel': if portchannelobj.get_portchannel(vars.D1, static_data.portchannel_name2): portchannelobj.delete_portchannel(vars.D1, static_data.portchannel_name2) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_del_from_ip_assigned_vlan': st.wait(2) ipobj.config_ip_addr_interface(vars.D1, 'Vlan{}'.format(static_data.vid), static_data.ip41, static_data.ip_mask, config='remove') portchannelobj.add_del_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1) if st.get_func_name(request) == 'test_ft_del_ip_assigned_portchannel': if not portchannelobj.get_portchannel(vars.D1, static_data.portchannel_name): portchannelobj.create_portchannel(vars.D1, static_data.portchannel_name, static=True) ipobj.delete_ip_interface(vars.D1, static_data.portchannel_name, static_data.ip41, static_data.ip_mask, skip_error=True) portchannelobj.add_del_portchannel_member(vars.D1, static_data.portchannel_name, static_data.members_dut1) exceptions = exec_all(True, [[ add_vlan_member, vars.D1, static_data.vid, static_data.portchannel_name, True ], [ add_vlan_member, vars.D2, static_data.vid, static_data.portchannel_name, True ]])[1] ensure_no_exception(exceptions) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_l3_hash_sip_dip_l4port': arpobj.delete_static_arp(vars.D2, static_data.ip42, interface=vars.D2T1P1, mac=static_data.remote_mac2) ipobj.clear_ip_configuration([vars.D1, vars.D2], family='ipv4', thread=True) exceptions = exec_all( True, [[ add_vlan_member, vars.D1, static_data.vid, [static_data.portchannel_name, vars.D1T1P1], True ], [ add_vlan_member, vars.D2, static_data.vid, [static_data.portchannel_name, vars.D2T1P1], True ]])[1] ensure_no_exception(exceptions) if st.get_func_name( request ) == 'test_ft_verify_static_portchannel_vlan_routing_l3_traffic': arpobj.delete_static_arp(vars.D2, static_data.ip42, interface=vars.D2T1P1, mac=static_data.remote_mac2) ipobj.clear_ip_configuration([vars.D1, vars.D2], family='ipv4', thread=True) exceptions = exec_all(True, [[ add_vlan_member, vars.D1, static_data.vid, vars.D1T1P1, True ], [add_vlan_member, vars.D2, static_data.vid, vars.D2T1P1, True]])[1] ensure_no_exception(exceptions)
def measure_v4_route_scale_time(route_count, show_flag): vars = st.get_testbed_vars() dut = vars.D1 default_route = 0 #TG pumps 512k per sec so to make measure route install #time more accurate we start from 600k + route_count #base_route_count = 60000 + route_count base_route_count = route_count ipfeature.clear_ip_configuration(st.get_dut_names()) ipfeature.clear_ip_configuration(st.get_dut_names(), 'ipv6') member3 = vars.D1T1P1 member4 = vars.D1T1P2 ipfeature.config_ip_addr_interface(dut, member3, data.my_ip_addr, data.ip_prefixlen, family="ipv4") ipfeature.config_ip_addr_interface(dut, member4, data.intf_ip_addr, data.ip_prefixlen, family="ipv4") ipfeature.get_interface_ip_address(dut, family="ipv4") ipfeature.show_ip_route(dut) interface_status_show(dut) bgpfeature.create_bgp_router(dut, data.as_num, '') bgpfeature.create_bgp_neighbor(dut, data.as_num, data.neigh_ip_addr, data.remote_as_num) (tg1, tg2, tg_ph_1, tg_ph_2) = get_handles() tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2) h1 = tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.10.10.2', gateway='10.10.10.1', src_mac_addr='00:0a:01:00:00:01', arp_send_req='1') st.log("INTFCONF: " + str(h1)) h2 = tg2.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr='20.20.20.2', gateway='20.20.20.1', arp_send_req='1') st.log("INTFCONF: " + str(h2)) conf_var = { 'mode': 'enable', 'active_connect_enable': '1', 'local_as': '200', 'remote_as': '100', 'remote_ip_addr': '10.10.10.1' } route_var = { 'mode': 'add', 'num_routes': base_route_count, 'prefix': '121.1.1.0', 'as_path': 'as_seq:1' } ctrl_start = {'mode': 'start'} ctrl_stop = {'mode': 'stop'} # Configuring the BGP router. bgp_rtr1 = tgapi.tg_bgp_config(tg=tg1, handle=h1['handle'], conf_var=conf_var, route_var=route_var, ctrl_var=ctrl_start) st.log("BGP_HANDLE: " + str(bgp_rtr1)) # Verified at neighbor. st.log("BGP neighborship established.") st.wait(10) tr1 = tg2.tg_traffic_config( port_handle=tg_ph_2, emulation_src_handle=h2['handle'], emulation_dst_handle=bgp_rtr1['route'][0]['handle'], circuit_endpoint_type='ipv4', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='0') retval = bgpfeature.verify_bgp_summary(dut, neighbor=data.neigh_ip_addr, state='Established') if retval is True: output = bcm_show(dut, 'bcmcmd "l3 defip show" | wc -l') st.log(output) default_route = parse_route_output(output) route_count += default_route cmd = 'bcmcmd "l3 defip show" | wc -l' measure_route_learn_time(dut, default_route, route_count, cmd) if (show_flag): cmd = "time show ip route" bcm_show(dut, cmd) data.result_14_3 = True res = tg2.tg_traffic_control(action='stop', handle=tr1['stream_id']) st.log("TR_CTRL: " + str(res)) tgapi.tg_bgp_config(tg=tg1, handle=bgp_rtr1['conf']['handle'], ctrl_var=ctrl_stop) ipfeature.delete_ip_interface(dut, member4, data.intf_ip_addr, data.ip_prefixlen, family="ipv4") ipfeature.delete_ip_interface(dut, member3, data.my_ip_addr, data.ip_prefixlen, family="ipv4") bgpfeature.delete_bgp_neighbor(dut, data.as_num, data.neigh_ip_addr, data.remote_as_num) delete_bgp_router(dut, '', data.as_num) tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2) tg1.tg_interface_config(port_handle=tg_ph_1, handle=h1['handle'], mode='destroy') tg2.tg_interface_config(port_handle=tg_ph_2, handle=h2['handle'], mode='destroy') st.wait(20)
def l3_max_route_max_path_scaling_tc(max_paths, max_routes, use_config_file, family="ipv4"): (dut) = (data.dut) #count = 0 data.my_dut_list = st.get_dut_names() dut1 = data.my_dut_list[0] dut2 = data.my_dut_list[1] #intf_ip_addr = data.dut1_start_ip_addr #intf_ip_addr2 = data.start_ip_addr2 #nexthop = data.nexthop_start_ip_addr vrf_flag = False member_dut1 = vars.D1T1P1 member_dut2 = vars.D2T1P1 # L3 INTF SCALING TEST CASE 1.1 START #json_path = os.getcwd() apply_file = False if apply_file is False: ipfeature.clear_ip_configuration(st.get_dut_names()) vapi.clear_vlan_configuration(st.get_dut_names()) st.banner("Started doing the needed config.") cmd = "config vlan range add 2 129" st.config(dut, cmd) st.config(dut2, cmd) command = "config vlan member add 2 {}".format(member_dut1) st.config(dut, command) command = "config vlan member add 2 {}".format(member_dut2) st.config(dut2, command) max_vlan = max_paths/4 base_vlan = 3 max_vlan = max_vlan - base_vlan v_range_t = str(base_vlan) + " " + str(base_vlan + max_vlan ) vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[0]) vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[0]) base_range = 1 max_range = 4 max_vlan = max_paths/4 incr_vlan = max_paths/4 for index in range(base_range, max_range): base_vlan = max_vlan + 1 max_vlan = max_vlan + incr_vlan #max_vlan = max_vlan + 32 v_range_t = str(base_vlan) + " " + str(max_vlan) vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[index]) vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[index]) ip_addr = data.dut1_start_ip_addr ip_addr2 = data.dut2_start_ip_addr v6_ip_addr = data.v6_start_ip_addr v6_ip_addr2 = data.v6_new_dut2_start_ip_addr ix_vlan_val = 2 #command = "config interface ip add "+ "Vlan" + str(data.vlan_val) + " " + ip_addr+'/24' if family == "ipv4": command1 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + ip_addr command2 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + ip_addr2 else: command1 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + v6_ip_addr command2 = "config interface ip add "+ "Vlan" + str(ix_vlan_val) + " " + v6_ip_addr2 st.config(dut1, command1) st.config(dut2, command2) ip_addr2 = data.dut2_start_ip_addr base_vlan = 3 max_vlan = max_paths + 1 #max_vlan = 130 for index in range(base_vlan, max_vlan): if family == "ipv4": (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network") (_, ip_addr2) = ipfeature.increment_ip_addr(ip_addr2, "network") command = "config interface ip add "+ "Vlan" + str(index) + " " + ip_addr command_dut2 = "config interface ip add "+ "Vlan" + str(index) + " " + ip_addr2 else: v6_tok = str(hex(index)[2:]) v6_ip_addr = "2100:0:" + v6_tok + "::1/64" v6_ip_addr2 = "2100:0:" + v6_tok + "::2/64" command = "config interface ip add "+ "Vlan" + str(index) + " " + v6_ip_addr command_dut2 = "config interface ip add "+ "Vlan" + str(index) + " " + v6_ip_addr2 st.config(dut, command) st.config(dut2, command_dut2) (tg1, tg_ph_1, tg2, tg_ph_2) = get_handles_2() tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1) tg2.tg_traffic_control(action='reset',port_handle=tg_ph_2) #h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.2.2', gateway='10.2.2.1', arp_send_req='1') #h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.2.2', gateway='10.2.2.1', src_mac_addr='00:0a:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0', vlan_id_step='1') if family == "ipv4": h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.2.3', gateway='10.2.2.1', src_mac_addr='00:0a:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1') arp_obj.show_arp(dut) h2=tg1.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr='10.2.2.4', gateway='10.2.2.2', src_mac_addr='00:0b:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1') arp_obj.show_arp(dut2) else: h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', ipv6_intf_addr='2100:0:2::3', ipv6_gateway='2100:0:2::1', src_mac_addr='00:0a:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1') st.show(dut, "show ndp") arp_obj.show_arp(dut) h2=tg1.tg_interface_config(port_handle=tg_ph_2, mode='config', ipv6_intf_addr='2200:0:2::4', ipv6_gateway='2200:0:2::2', src_mac_addr='00:0b:01:00:00:01', vlan='1', vlan_id='2', arp_send_req='1') st.show(dut2, "show ndp") arp_obj.show_arp(dut2) if family == "ipv4": bgpfeature.create_bgp_router(dut, data.as_num, '') bgpfeature.create_bgp_router(dut2, data.new_as_num, '') dut1_neigh_ip_addr = data.neigh_ip_addr dut2_neigh_ip_addr = data.dut1_start_ip_addr #formatted_dut1_neigh_ip_addr = dut1_neigh_ip_addr.replace("/24","") #formatted_dut2_neigh_ip_addr = dut2_neigh_ip_addr.replace("/24","") formatted_dut1_neigh_ip_addr = "10.2.2.3" bgpfeature.create_bgp_neighbor(dut, data.as_num, formatted_dut1_neigh_ip_addr, data.remote_as_num) (_, dut1_neigh_ip_addr) = ipfeature.increment_ip_addr(dut1_neigh_ip_addr, "network") (_, dut2_neigh_ip_addr) = ipfeature.increment_ip_addr(dut2_neigh_ip_addr, "network") base_vlan = 3 max_vlan = max_paths + 1 #max_vlan = 130 # The below neighbor config is for inter dut links ibgp for index in range(base_vlan, max_vlan): formatted_dut1_neigh_ip_addr = dut1_neigh_ip_addr.replace("/24","") bgpfeature.create_bgp_neighbor(dut, data.as_num, formatted_dut1_neigh_ip_addr, data.new_as_num) (_, dut1_neigh_ip_addr) = ipfeature.increment_ip_addr(dut1_neigh_ip_addr, "network") formatted_dut2_neigh_ip_addr = dut2_neigh_ip_addr.replace("/24","") bgpfeature.create_bgp_neighbor(dut2, data.new_as_num, formatted_dut2_neigh_ip_addr, data.as_num) (_, dut2_neigh_ip_addr) = ipfeature.increment_ip_addr(dut2_neigh_ip_addr, "network") conf_var = { 'mode' : 'enable', 'active_connect_enable' : '1', 'local_as' : '200', 'remote_as' : '100', 'remote_ip_addr' : '10.2.2.1' } max_route_str = str(max_routes) route_var = { 'mode' : 'add', 'num_routes' : max_route_str, 'prefix' : '121.1.1.0', 'as_path' : 'as_seq:1' } #'num_routes' : '30000', ctrl_start = { 'mode' : 'start'} ctrl_stop = { 'mode' : 'stop'} # Configuring the BGP router. bgp_rtr1 = tgapi.tg_bgp_config(tg = tg1, handle = h1['handle'], conf_var = conf_var, route_var = route_var, ctrl_var = ctrl_start) st.log("BGP_HANDLE: "+str(bgp_rtr1)) # Verified at neighbor. st.log("BGP neighborship established.") st.wait(10) def f1(d): st.show(d, "show bgp ipv4 summary", type='vtysh') st.show(d, "show interface status") st.show(d, "show ip route | head -1000") arp_obj.show_arp(d) st.banner("ARP entries before traffic is initiated on Dut1 and Dut2") st.exec_each([dut, dut2], f1) #Port Counters tr1=tg2.tg_traffic_config(port_handle=tg_ph_2, emulation_src_handle=h2['handle'], emulation_dst_handle=bgp_rtr1['route'][0]['handle'], circuit_endpoint_type='ipv4', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='0') else: v6_dut1_neigh_ip_addr = "2100:0:2::3" create_bgp_neighbor_route_map_config(dut, data.as_num, v6_dut1_neigh_ip_addr, data.routemap, vrf_flag) create_bgp_neighbor_route_map_config(dut2, data.new_as_num, v6_dut1_neigh_ip_addr, data.routemap, vrf_flag) bgpfeature.create_bgp_router(dut, data.as_num, '') create_bgp_neighbor_config(dut, data.as_num, v6_dut1_neigh_ip_addr, data.remote_as_num, data.routemap) #link_bgp_neighbor_to_routemap(dut, data.as_num, v6_dut1_neigh_ip_addr, data.routemap, vrf_flag) bgpfeature.create_bgp_router(dut2, data.new_as_num, '') base_vlan = 3 max_vlan = max_paths + 1 for index in range(base_vlan, max_vlan): v6_tok = str(hex(index)[2:]) v6_dut1_neigh_ip_addr = "2100:0:" + v6_tok + "::2" v6_dut2_neigh_ip_addr2 = "2100:0:" + v6_tok + "::1" create_bgp_neighbor_config(dut, data.as_num, v6_dut1_neigh_ip_addr, data.new_as_num, data.routemap) create_bgp_neighbor_config(dut2, data.new_as_num, v6_dut2_neigh_ip_addr2, data.as_num, data.routemap) #bgpfeature.create_bgp_neighbor(dut, data.as_num, v6_dut1_neigh_ip_addr, data.new_as_num, family="ipv6") #bgpfeature.create_bgp_neighbor(dut2, data.new_as_num, v6_dut2_neigh_ip_addr2, data.as_num, family="ipv6") bgp_conf=tg2.tg_emulation_bgp_config(handle=h1['handle'], mode='enable', ip_version='6', active_connect_enable='1', local_as='200', remote_as='100', remote_ipv6_addr='2100:0:2::1') max_route_str = str(max_routes) bgp_route=tg2.tg_emulation_bgp_route_config(handle=bgp_conf['handle'], mode='add', ip_version='6', num_routes=max_route_str, prefix='3300:0:0:2::1', as_path='as_seq:1') tg2.tg_emulation_bgp_control(handle=bgp_conf['handle'], mode='start') def f1(d): st.show(d, "show run bgp") st.show(d, "show ndp") st.show(d, "show bgp ipv6 summary", type='vtysh') st.show(d, "show ipv6 route | head -1000") arp_obj.show_arp(d) st.banner("ARP entries before traffic is initiated on Dut1 and Dut2") st.exec_each([dut, dut2], f1) tr1=tg2.tg_traffic_config(port_handle=tg_ph_2, emulation_src_handle=h2['handle'], emulation_dst_handle=bgp_route['handle'], circuit_endpoint_type='ipv6', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='0') #tr1=tg1.tg_traffic_config(port_handle=tg_ph_2, mac_src='00:11:01:00:00:01', mac_dst='80:a2:35:97:eb:c1', # ipv6_dst_mode='increment', ipv6_dst_count=200, ipv6_dst_step='::1',ipv6_src_addr='2200:0:2::5', # ipv6_dst_addr='3300:0:0:2::1', l3_protocol='ipv6', l2_encap='ethernet_ii_vlan', vlan_id='2', # vlan='enable', mode='create', transmit_mode='continuous', length_mode='fixed', # rate_pps=512000, enable_stream_only_gen='1') tg2.tg_traffic_control(action='run', handle=tr1['stream_id']) ret1 = check_inter_dut_intf_traffic_counters() ret2 = check_end_to_end_intf_traffic_counters() tg2.tg_traffic_control(action='stop', handle=tr1['stream_id']) st.banner("ARP entries in both DUT's after traffic is stopped") st.exec_each([dut, dut2], arp_obj.show_arp) tg1.tg_traffic_control(action='reset',port_handle=tg_ph_2) if family == "ipv4": tgapi.tg_bgp_config(tg = tg1, handle = bgp_rtr1['conf']['handle'], ctrl_var=ctrl_stop) else: tg1.tg_emulation_bgp_control(handle=bgp_conf['handle'], mode='stop') tg1.tg_interface_config(port_handle=tg_ph_1, handle=h1['handle'], mode='destroy') tg1.tg_interface_config(port_handle=tg_ph_2, handle=h2['handle'], mode='destroy') #import pdb;pdb.set_trace() if apply_file is False: ip_addr = data.dut1_start_ip_addr ip_addr2 = data.dut2_start_ip_addr st.log("Un-Config previously config") base_range = 2 max_range = max_paths + 1 for index in range(base_range, max_range): if family == "ipv4": command1 = "config interface ip remove "+ "Vlan" + str(index) + " " + ip_addr command2 = "config interface ip remove "+ "Vlan" + str(index) + " " + ip_addr2 (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network") (_, ip_addr2) = ipfeature.increment_ip_addr(ip_addr2, "network") else: v6_tok = str(hex(index)[2:]) if index == 2: v6_ip_addr2 = "2200:0:" + v6_tok + "::2/64" else: v6_ip_addr2 = "2100:0:" + v6_tok + "::2/64" v6_ip_addr = "2100:0:" + v6_tok + "::1/64" command1 = "config interface ip remove "+ "Vlan" + str(index) + " " + v6_ip_addr command2 = "config interface ip remove "+ "Vlan" + str(index) + " " + v6_ip_addr2 st.config(dut, command1) st.config(dut2, command2) max_vlan = max_paths/4 base_vlan = 3 max_vlan = max_vlan - base_vlan v_range_t = str(base_vlan) + " " + str(base_vlan + max_vlan ) vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[0], config='del') vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[0], config='del') base_range = 1 max_range = 4 max_vlan = max_paths/4 incr_vlan = max_paths/4 for index in range(base_range, max_range): base_vlan = max_vlan + 1 #max_vlan = max_vlan + 32 max_vlan = max_vlan + incr_vlan v_range_t = str(base_vlan) + " " + str(max_vlan) vapi.config_vlan_range_members(dut1, v_range_t, data.dut1_ports[index], config='del') vapi.config_vlan_range_members(dut2, v_range_t, data.dut2_ports[index], config='del') cmd = "config vlan range del 2 129" st.config(dut, cmd) my_cmd = "no router bgp {}".format(data.as_num) st.vtysh_config(dut, my_cmd) my_cmd = "no router bgp {}".format(data.new_as_num) st.vtysh_config(dut2, my_cmd) st.debug("ret1: {} , ret2: {}".format(ret1, ret2)) if ret1 is True and ret2 is True: ret = True st.log("Test Case PASSED") else: ret = False st.log("Test Case FAILED") st.log("operation_successful") return ret
def l3_ecmp_scaling_tc(max_ecmp, use_config_file): (dut) = (data.dut) count = 0 #intf_ip_addr = data.start_ip_addr #intf_ip_addr2 = data.start_ip_addr2 nexthop = data.nexthop_start_ip_addr member3 = vars.D1T1P3 member4 = vars.D1T1P4 # L3 INTF SCALING TEST CASE 1.1 START json_path = os.getcwd() apply_file = False if use_config_file is True: apply_file = True json_apply_path = json_path+"/routing/128_ecmp_config_db.json" #frr_apply_path = json_path+"/routing/64_ecmp_sr_config.frr" if apply_file is True: st.apply_files(dut, [json_apply_path]) #st.apply_files(dut, [json_apply_path, frr_apply_path]) max_range = data.base_val+max_ecmp base_range = data.base_val if apply_file is False: ipfeature.clear_ip_configuration(st.get_dut_names()) command = "config vlan add {}".format(data.vlan_val) st.config(dut, command) command = "config vlan member add {} {}".format(data.vlan_val, member3) st.config(dut, command) ip_addr = data.start_ip_addr #command = "config interface ip add "+ "Vlan" + str(data.vlan_val) + " " + ip_addr+'/24' command = "config interface ip add "+ "Vlan" + str(data.vlan_val) + " " + ip_addr st.config(dut, command) for index in range(base_range, max_range): command = "config vlan add {}".format(index) st.config(dut, command) command = "config vlan member add {} {}".format(index, member3) st.config(dut, command) (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network") command = "config interface ip add "+ "Vlan" + str(index) + " " + ip_addr st.config(dut, command) tg_vlan = 101 command = "config vlan member del {} {}".format(tg_vlan, member3) st.config(dut, command) command = "config vlan member add {} {}".format(tg_vlan, member4) st.config(dut, command) for index in range(base_range, max_range): #vapi.add_member(dut, data.vlans[index], member, True) (_, nexthop) = ipfeature.increment_ip_addr(nexthop, "network") nexthop1 = nexthop formatted_next_hop = nexthop1.replace("/32","") ipfeature.create_static_route(dut, formatted_next_hop, data.static_route) # L3 INTF SCALING TEST CASE 1.1 END data.my_dut_list = st.get_dut_names() dut1 = data.my_dut_list[0] # L3 traffic streams #For now Spirent link with 100G is not working , so the below code from START to END just books spirent port, it will be rectified # once infra team provides support for RS-FEC #START (tg1, tg_ph_1, tg2, tg_ph_2) = get_handles() #import pdb;pdb.set_trace() tg1.tg_traffic_control(action='reset',port_handle=tg_ph_1) tg2.tg_traffic_control(action='reset',port_handle=tg_ph_2) #h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.101.10', gateway='10.2.101.1', count='8', gateway_step='0.0.1.0', netmask='255.255.255.0', vlan='1', vlan_id='101', vlan_id_count='8', intf_ip_addr_step='0.0.1.0', arp_send_req='1') #h2=tg2.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr='10.2.109.10', gateway='10.2.109.1', count='8', gateway_step='0.0.1.0', netmask='255.255.255.0', vlan='1', vlan_id='109', vlan_id_count='7', intf_ip_addr_step='0.0.1.0', arp_send_req='1') vid_count = max_ecmp-1 h1=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.102.10', gateway='10.2.102.1', src_mac_addr='00:0c:01:00:00:01', vlan='1', vlan_id='102', count=vid_count, arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') h2=tg1.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr='10.2.101.10', gateway='10.2.101.1', src_mac_addr='00:0d:01:00:00:01', vlan='1', vlan_id='101', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') #h2=tg1.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr='10.2.109.10', gateway='10.2.109.1', src_mac_addr='00:0c:01:00:00:01', vlan='1', vlan_id='109', vlan_id_count='8', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') h3=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.100.10', gateway='10.2.100.1', netmask='255.255.255.0', vlan='1', vlan_id='100', arp_send_req='1') #tr1=tg1.tg_traffic_config(port_handle=tg_ph_1, emulation_src_handle=h3['handle'], ip_dst_addr='200.1.0.1', ip_dst_mode='increment', ip_dst_count='200', ip_dst_step='0.0.0.1', l3_protocol='ipv4', circuit_endpoint_type='ipv4', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='1') asicapi.dump_l3_egress(dut) tr1=tg1.tg_traffic_config(port_handle=tg_ph_1, mac_src='00:11:01:00:00:01', mac_dst='b8:6a:97:fd:b6:06', ip_dst_mode='increment', ip_dst_count=200, ip_dst_step='0.0.0.1',ip_src_addr='10.2.100.10', ip_dst_addr='200.1.0.1', l3_protocol='ipv4', l2_encap='ethernet_ii_vlan', vlan_id='100', vlan='enable', mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=512000, enable_stream_only_gen='1') tg2.tg_traffic_control(action='run', handle=tr1['stream_id']) count = 0 #Port Counters st.wait(20) st.show(dut, "show arp") #Port Counters ret = check_intf_traffic_counters() if ret is True: count = count+1 st.log("Test Case 1.14 PASSED") tg1.tg_interface_config(port_handle=tg_ph_2, handle=h2['handle'], mode='destroy') h4=tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr='10.2.101.10', gateway='10.2.101.1', src_mac_addr='00:0e:01:00:00:01', vlan='1', vlan_id='101', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') tg_vlan = 101 command = "config vlan member del {} {}".format(tg_vlan, member4) st.config(dut, command) command = "config vlan member add {} {}".format(tg_vlan, member3) st.config(dut, command) tg_intf_ip_addr = data.tg_start_ip_addr max_range = data.base_val+max_ecmp base_range = data.base_val+1 for index in range(base_range, max_range): data.thresh = 4 command = "config vlan member del {} {}".format(index, member3) st.config(dut, command) command = "config vlan member add {} {}".format(index, member4) st.config(dut, command) (_, tg_intf_ip_addr) = ipfeature.increment_ip_addr(tg_intf_ip_addr, "network") tg_intf_ip_addr_x = tg_intf_ip_addr; tg_formatted_intf_addr = tg_intf_ip_addr_x.replace("/24","") tg_formatted_gw_addr = tg_intf_ip_addr_x.replace("10/24","1") #ping_formatted_gw_addr = tg_intf_ip_addr_x.replace("10/24","1") tg_vlan=index st.log("tg_vlan: "+str(tg_vlan)) st.log("tg_formatted_gw_addr: "+str(tg_formatted_gw_addr)) st.log("tg_formatted_intf_addr: "+str(tg_formatted_intf_addr)) h2=tg1.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr=tg_formatted_intf_addr, gateway=tg_formatted_gw_addr, src_mac_addr='00:0a:01:00:00:01', vlan='1', vlan_id=tg_vlan, vlan_id_count='1', arp_send_req='1', gateway_step='0.0.1.0', intf_ip_addr_step='0.0.1.0') st.wait(3) #output = st.show(dut, "show arp") #Port Counters ret = check_intf_traffic_counters() if ret is True: count = count+1 st.log("Test Case 1.14 PASSED") else: st.log('Traffic test Failed') tg1.tg_interface_config(port_handle=tg_ph_2, handle=h2['handle'], mode='destroy') command = "config vlan member del {} {}".format(index, member4) st.config(dut, command) command = "config vlan member add {} {}".format(index, member3) st.config(dut, command) #res1=verify_ping(src_obj=tg1, port_handle=tg_ph_1, dev_handle=h1['handle'], dst_ip=ping_formatted_gw_addr,\ # ping_count='6', exp_count='6') #tg1.tg_traffic_config(mode='create', transmit_mode='continuous', length_mode='fixed', rate_pps=30, # mac_src='00:00:00:00:00:01', mac_dst='00:00:00:00:00:02', ip_src_addr ='11.11.11.2', # ip_dst_addr = '11.11.12.2') tg2.tg_traffic_control(action='stop', handle=tr1['stream_id']) asicapi.dump_l3_egress(dut) tg1.tg_interface_config(port_handle=tg_ph_1, handle=h1['handle'], mode='destroy') tg1.tg_interface_config(port_handle=tg_ph_1, handle=h3['handle'], mode='destroy') tg1.tg_interface_config(port_handle=tg_ph_1, handle=h4['handle'], mode='destroy') #import pdb;pdb.set_trace() if use_config_file is True: st.clear_config(dut1) # This code will not be needed if apply_file is True as config gets cleared already if apply_file is False: ip_addr = data.start_ip_addr base_range = data.base_val - 1 #max_range = data.base_val+max_ecmp-1 max_range = data.base_val+max_ecmp for index in range(base_range, max_range): command = "config interface ip remove "+ "Vlan" + str(index) + " " + ip_addr st.config(dut, command) command = "config vlan member del {} {}".format(index, member3) st.config(dut, command) command = "config vlan del {}".format(index) st.config(dut, command) (_, ip_addr) = ipfeature.increment_ip_addr(ip_addr, "network") #del_vlan = max_range #command = "config interface ip remove "+ "Vlan" + str(del_vlan) + " " + ip_addr #st.config(dut, command) #command = "config vlan member del {} {}".format(del_vlan, member4) #st.config(dut, command) #command = "config vlan del {}".format(del_vlan) #st.config(dut, command) ret = False st.log("count: "+str(count)) if count >= data.thresh: ret = True st.log("Test Case PASSED") else: ret = False st.log("Test Case FAILED") st.log("operation_successful") return ret