def test_l3_host_scaling_tc5_1(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) ifapi.interface_status_show(dut1) tr1 = create_l3_host(tg1, tg_ph_1, 8000, 5) st.wait(15) # Verified ARP and counters at the DUT. total_in_sw = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total_in_sw)) #We expect all 8k host entries should be programmed in hw within 32secs st.wait(20) output = bcm_show(dut1, 'bcmcmd "l3 l3table show" | wc -l') total_in_hw = parse_route_output(output) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding() if (total_in_sw >= data.max_host_1 and total_in_hw >= data.max_host_1): st.report_pass("test_case_passed") else: st.report_fail("test_case_failed")
def test_l3_host_scaling_tc5_5(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) ifapi.interface_status_show(dut1) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tr1 = create_l3_host(tg1, tg_ph_1, 8000, 120) st.wait(15) # Verified ARP and counters at the DUT. total = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total)) if (total): arpfeature.clear_arp_table(vars.D1) st.wait(30) total = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total)) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding() if (total >= data.max_host_1): st.report_pass("test_case_passed") else: st.report_fail("test_case_failed")
def test_l3_perf_tc_14_1(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.show_ip_route(dut1) interface_status_show(dut1) tr1 = create_l3_host(tg1, tg_ph_1, 10000) st.wait(15) # Verified ARP and counters at the DUT. output = bcm_show(dut1, "time show arp") st.log(output) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'], max_wait_timer=10) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding() st.report_pass("test_case_passed")
def get_intf_pmap(dut, interface_name=None): """ Author: Chaitanya Vella ([email protected]) This API is used to get the interface pmap details :param dut: dut :param interface_name: List of interface names :return: """ import apis.system.interface as interface_obj ##Passing the cli_type as click in the API call "interface_status_show" because the lanes information is available only in click CLI. ##Please refer the JIRA: SONIC-22102 for more information. interfaces = cutils.make_list(interface_name) if interface_name else '' if interfaces: if any("/" in interface for interface in interfaces): interfaces = st.get_other_names(dut, interfaces) key = 'alias' else: key = 'interface' st.debug("The interfaces list is: {}".format(interfaces)) interface_list = interface_obj.interface_status_show( dut, interfaces=interfaces, cli_type='click') else: key = 'alias' if interface_obj.show_ifname_type( dut, cli_type='klish') else 'interface' interface_list = interface_obj.interface_status_show(dut, cli_type='click') interface_pmap = dict() pmap_list = get_pmap(dut) for detail in cutils.iterable(interface_list): lane = detail["lanes"].split( ",")[0] if "," in detail["lanes"] else detail["lanes"] for pmap in pmap_list: if pmap["physical"] == lane: interface_pmap[detail[key]] = pmap["interface"] return interface_pmap
def test_l3_perf_tc_12_5(): pre_test_l3_fwding_v6() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) interface_status_show(dut1) tr1 = create_l3_host_v6(tg1, tg_ph_1, 16000) # Verified ARP and counters at the DUT. default_nd = arpapi.get_ndp_count(dut1) st.log("Total NDP entries are: {}".format(default_nd)) measure_nd_learn_time(dut1, default_nd, 16000) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id'], max_wait_timer=10) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding_v6() st.report_pass("test_case_passed")
def test_l3_perf_tc_12_1(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles() dut1 = vars.D1 port1 = vars.D1T1P1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) interface_status_show(dut1) tr1 = create_l3_host(tg1, tg_ph_1, 8000) # Verified ARP and counters at the DUT. cmd = "show arp | grep Total" default_arp = arpapi.get_arp_count(dut1) st.log("Total ARP entries: {}".format(default_arp)) measure_arp_learn_time(dut1, default_arp, 8000, cmd, False) #shut the link and make sure all the entries deleted from the hw interface_operation(dut1, port1, operation="shutdown") st.wait(15) cmd = 'bcmcmd "l3 l3table show" | wc -l' output = bcm_show(dut1, cmd) st.log(output) curr_arp = parse_route_output(output) if (curr_arp != default_arp): st.log("cleaning up host entries from HW failed" + str(curr_arp) + str(default_arp)) interface_operation(dut1, port1, operation="startup") #Now measure the hardware performance cmd = 'bcmcmd "l3 l3table show" | wc -l' output = bcm_show(dut1, cmd) st.log(output) default_arp = parse_route_output(output) measure_arp_learn_time(dut1, default_arp, 8000, cmd, True) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) post_test_l3_fwding() st.report_pass("test_case_passed")
def test_ft_ipv6_link_local_ping(): report_flag = 0 if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = vars.D1D2P1): st.log("Ipv6 Ping over Link Local address via the Port based routing interface is failed.") report_flag = 1 if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = data.vlan_in_1): st.log("Ipv6 Ping over Link Local address via the Vlan based routing interface is failed.") report_flag =1 if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = data.prt_chnl): st.log("Ipv6 Ping over Link Local address via the Port Channel based routing interface is failed.") report_flag =1 # Get show ndp output utils.exec_all(True, [[arp_obj.show_ndp, vars.D1, None], [arp_obj.show_ndp, vars.D2, None]]) d1_int_li = [vars.D2D1P1, vars.D2D1P2, data.prt_chnl] intf_obj.interface_operation(vars.D2, [vars.D2D1P1, vars.D2D1P2, data.prt_chnl], operation="shutdown", skip_verify=True) st.log("Waiting for 10 sec after shutdown the interfaces") st.wait(10) intf_obj.interface_status_show(vars.D1, [vars.D2D1P1, vars.D2D1P2, data.prt_chnl]) intf_obj.interface_operation(vars.D2, [vars.D2D1P1, vars.D2D1P2, data.prt_chnl], operation="startup", skip_verify=True) st.log("Polling for interface status after no shutdown") for intf in d1_int_li: if not intf_obj.poll_for_interface_status(vars.D2, intf, "oper", "up", iteration=5, delay=1): st.error("Failed to startup interface {} on the DUT {}".format(intf, vars.D2)) report_flag = 0 if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface = vars.D1D2P1): st.log("After shut no shut, Ipv6 Ping over Link Local address via the Port based routing interface is failed.") report_flag = 1 if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface=data.vlan_in_1): st.log("After shut no shut, Ipv6 Ping over Link Local address via the Vlan based routing interface is failed.") report_flag = 1 if not ip_obj.ping(vars.D1, d2_prt_link_local[0], family='ipv6', interface=data.prt_chnl): st.log("After shut no shut, Ipv6 Ping over Link Local address via the Port Channel based routing interface is failed.") report_flag = 1 if report_flag: st.report_fail("ip6_ping_fail_over_link_local_addr") st.report_pass("test_case_passed")
def test_l3_host_scaling_tc5_4(): pre_test_l3_fwding() vars = st.get_testbed_vars() data.my_dut_list = st.get_dut_names() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) ifapi.interface_status_show(dut1) # L3 traffic streams (tg1, tg2, tg_ph_1, tg_ph_2) = get_handles() tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tr1 = create_l3_host(tg1, tg_ph_1, data.max_host_1, 20) st.wait(15) # Verified ARP and counters at the DUT. total = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total)) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2) res = tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr=data.t1d1_ip_addr, gateway=data.d1t1_ip_addr, src_mac_addr='00:0a:01:00:11:01', arp_send_req='1') st.log("INTFCONF: " + str(res)) handle1 = res['handle'] #tg1.tg_test_control(action='sync') res = tg2.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr=data.t1d2_ip_addr, gateway=data.d1t2_ip_addr, src_mac_addr='00:0a:01:00:12:01', arp_send_req='1') st.log("INTFCONF: " + str(res)) handle2 = res['handle'] #tg2.tg_test_control(action='sync') tr1 = tg1.tg_traffic_config(port_handle=tg_ph_1, mode='create', transmit_mode='continuous', length_mode='fixed', l3_length=data.tgen_l3_len, rate_pps=data.tgen_rate_pps, emulation_src_handle=handle1, emulation_dst_handle=handle2) tr2 = tg2.tg_traffic_config(port_handle=tg_ph_2, mode='create', transmit_mode='continuous', length_mode='fixed', l3_length=data.tgen_l3_len, rate_pps=data.tgen_rate_pps, emulation_src_handle=handle2, emulation_dst_handle=handle1) tg1.tg_packet_control(port_handle=tg_ph_1, action='start') tg2.tg_packet_control(port_handle=tg_ph_2, action='start') tg1.tg_traffic_control(action='clear_stats', handle=tr1['stream_id']) tg2.tg_traffic_control(action='clear_stats', handle=tr2['stream_id']) papi.clear_interface_counters(dut1) tg1.tg_traffic_control(action='run', handle=tr1['stream_id'], duration=2) tg2.tg_traffic_control(action='run', handle=tr2['stream_id'], duration=2) st.wait(data.traffic_run_time) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg2.tg_traffic_control(action='stop', handle=tr2['stream_id']) st.wait(5) tg1.tg_packet_control(port_handle=tg_ph_1, action='stop') tg2.tg_packet_control(port_handle=tg_ph_2, action='stop') stats_tg1 = tg1.tg_traffic_stats(port_handle=tg_ph_1, mode='aggregate') total_tg1_tx = stats_tg1[tg_ph_1]['aggregate']['tx']['total_pkts'] total_tg1_rx = stats_tg1[tg_ph_1]['aggregate']['rx']['total_pkts'] stats_tg2 = tg2.tg_traffic_stats(port_handle=tg_ph_2, mode='aggregate') total_tg2_tx = stats_tg2[tg_ph_2]['aggregate']['tx']['total_pkts'] total_tg2_rx = stats_tg2[tg_ph_2]['aggregate']['rx']['total_pkts'] st.log( "Tgen Sent Packets on D1T1P1: {} and Received Packets on D2T1P1: {}". format(total_tg1_tx, total_tg2_rx)) st.log( "Tgen Sent Packets on D2T1P1: {} and Received Packets on D1T1P1: {}". format(total_tg2_tx, total_tg1_rx)) flap_interface(vars.D1T1P1) flap_interface(vars.D1T1P2) #Getting interfaces counter values on DUT DUT_rx_value = ifapi.get_interface_counters(dut1, vars.D1T1P1, "rx_ok") DUT_tx_value = ifapi.get_interface_counters(dut1, vars.D1T1P2, "tx_ok") for i in DUT_rx_value: p1_rcvd = i['rx_ok'] p1_rcvd = p1_rcvd.replace(",", "") for i in DUT_tx_value: p2_txmt = i['tx_ok'] p2_txmt = p2_txmt.replace(",", "") st.log( "rx_ok counter value on DUT Ingress port: {} and tx_ok xounter value on DUT Egress port : {}" .format(p1_rcvd, p2_txmt)) post_test_l3_fwding() if (total >= data.max_host_1): st.report_pass("test_case_passed") else: st.report_fail("test_case_failed")
def test_l3_host_scaling_tc5_3(): pre_test_l3_fwding() vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, tg2, tg_ph_1, tg_ph_2) = get_handles() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) ifapi.interface_status_show(dut1) tr1 = create_l3_host(tg1, tg_ph_1, data.max_host_1, 20) st.wait(15) # Verified ARP and counters at the DUT. total = arpfeature.get_arp_count(dut1) st.log("Total ARP entries: {}".format(total)) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tg1.tg_traffic_control(action='reset', port_handle=tg_ph_1) tg2.tg_traffic_control(action='reset', port_handle=tg_ph_2) res = tg1.tg_interface_config(port_handle=tg_ph_1, mode='config', intf_ip_addr=data.t1d1_ip_addr, gateway=data.d1t1_ip_addr, src_mac_addr='00:0a:01:00:11:01', arp_send_req='1') st.log("INTFCONF: " + str(res)) handle1 = res['handle'] #tg1.tg_test_control(action='sync') res = tg2.tg_interface_config(port_handle=tg_ph_2, mode='config', intf_ip_addr=data.t1d2_ip_addr, gateway=data.d1t2_ip_addr, src_mac_addr='00:0a:01:00:12:01', arp_send_req='1') st.log("INTFCONF: " + str(res)) handle2 = res['handle'] #tg2.tg_test_control(action='sync') tr1 = tg1.tg_traffic_config(port_handle=tg_ph_1, mode='create', transmit_mode='continuous', length_mode='fixed', l3_length=data.tgen_l3_len, rate_pps=data.tgen_rate_pps, emulation_src_handle=handle1, emulation_dst_handle=handle2) tr2 = tg2.tg_traffic_config(port_handle=tg_ph_2, mode='create', transmit_mode='continuous', length_mode='fixed', l3_length=data.tgen_l3_len, rate_pps=data.tgen_rate_pps, emulation_src_handle=handle2, emulation_dst_handle=handle1) tg1.tg_packet_control(port_handle=tg_ph_1, action='start') tg2.tg_packet_control(port_handle=tg_ph_2, action='start') tg1.tg_traffic_control(action='clear_stats', handle=tr1['stream_id']) tg2.tg_traffic_control(action='clear_stats', handle=tr2['stream_id']) papi.clear_interface_counters(dut1) tg1.tg_traffic_control(action='run', handle=tr1['stream_id'], duration=2) tg2.tg_traffic_control(action='run', handle=tr2['stream_id'], duration=2) st.wait(data.traffic_run_time) tg1.tg_traffic_control(action='stop', handle=tr1['stream_id']) tg2.tg_traffic_control(action='stop', handle=tr2['stream_id']) tg1.tg_packet_control(port_handle=tg_ph_1, action='stop') tg2.tg_packet_control(port_handle=tg_ph_2, action='stop') papi.clear_interface_counters(dut1) tg2.tg_traffic_control(action='run', handle=tr1['stream_id']) st.wait(20) retval = check_intf_traffic_counters(dut1) post_test_l3_fwding() if (total >= data.max_host_1 and retval): st.report_pass("test_case_passed") else: st.report_fail("test_case_failed")
def get_dut_ports_dict_from_topo(min_req_topo): """ :param : None :return: a dict of all dut-ports Returned dict will map all port connections in globals()['vars'] with some additional details. key : dut val : list of intf_properties_tuple intf_properties_tuple : ( ifname, destination_dut, linkno, speed) More interface specific details shall be added to the intf_tuple as and when required Example: For the below given topology in testbed.yaml topology: DUT1: interfaces: Ethernet0: {EndDevice: DUT2, EndPort: Ethernet0, params: def_link} Ethernet4: {EndDevice: DUT2, EndPort: Ethernet4, params: def_link} Ethernet8: {EndDevice: DUT3, EndPort: Ethernet8, params: def_link} Ethernet12: {EndDevice: DUT4, EndPort: Ethernet12, params: def_link} DUT2: interfaces: Ethernet16: {EndDevice: DUT3, EndPort: Ethernet16, params: def_link} Ethernet20: {EndDevice: DUT4, EndPort: Ethernet20, params: def_link} This api will return the following dictionary. This output was captured on vsonic. topology = {'D101': [('Ethernet0', 'D102', '1', 'N/A'), ('Ethernet4', 'D102', '2', 'N/A'), ('Ethernet8', 'D103', '1', 'N/A'), ('Ethernet12', 'D104', '1', 'N/A')], 'D102': [('Ethernet0', 'D101', '1', 'N/A'), ('Ethernet4', 'D101', '2', 'N/A'), ('Ethernet16', 'D103', '1', 'N/A'), ('Ethernet20', 'D104', '1', 'N/A')], 'D103': [('Ethernet8', 'D101', '1', 'N/A'), ('Ethernet16', 'D102', '1', 'N/A')], 'D104': [('Ethernet12', 'D101', '1', 'N/A'), ('Ethernet20', 'D102', '1', 'N/A')]} """ import apis.system.interface as intf_obj sys_vars = st.ensure_min_topology(*min_req_topo) topology = {} service_string = ' -> '.join("Build topology dictionary") for key in sys_vars.keys(): port_info = re.match(r'D([\d+])([DT])([\d+])P([\d+])', key) if port_info: ifname = '' dest_dut = '' link_no = '' intf_speed = '' (src_dut_no, dst_dut_or_tg, dest_dut_no, link_no) = port_info.groups() src_dut = 'D' + str(src_dut_no) src_dut = sys_vars[src_dut] dest_dut = dst_dut_or_tg + str(dest_dut_no) if dst_dut_or_tg == 'D': dest_dut = sys_vars[dest_dut] ifname = sys_vars[key] if (not ifname) or (not ifname.startswith("Ethernet")): st.error("'{}' is not a Valid Interface name.".format(ifname)) st.report_env_fail("test_case_not_executed_s_service", service_string) intf_status = intf_obj.interface_status_show(src_dut, ifname) if not intf_status: st.error("'{}' Interface Speed not Available.".format(ifname)) st.report_env_fail("test_case_not_executed_s_service", service_string) intf_speed = intf_status[0]['speed'] topology.setdefault(src_dut, []).append( (ifname, dest_dut, link_no, intf_speed)) return topology
def create_v4_route(route_count): vars = st.get_testbed_vars() dut = vars.D1 ipfeature.show_ip_route(dut) ipfeature.get_interface_ip_address(dut) intf_obj.interface_status_show(dut) bgpfeature.create_bgp_router(dut, data.as_num, '') bgpfeature.create_bgp_neighbor(dut, data.as_num, data.ip4_addr[0], data.remote_as_num) tg_handler = tgapi.get_handles_byname("T1D1P1", "T1D2P1") tg = tg_handler["tg"] tg.tg_traffic_control(action="reset", port_handle=tg_handler["tg_ph_list"]) tg.tg_traffic_control(action="clear_stats", port_handle=tg_handler["tg_ph_list"]) dut_rt_int_mac1 = basic_obj.get_ifconfig_ether(vars.D1, vars.D1T1P1) h1 = tg.tg_interface_config(port_handle=tg_handler["tg_ph_1"], mode='config', intf_ip_addr=data.ip4_addr[0], \ gateway=data.ip4_addr[1], src_mac_addr=data.tg_mac1, 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.ip4_addr[9], \ gateway=data.ip4_addr[8], src_mac_addr=data.tg_mac2, arp_send_req='1') st.log("INTFCONF: " + str(h2)) # Ping from tgen to DUT. res = tgapi.verify_ping(src_obj=tg, port_handle=tg_handler["tg_ph_1"], dev_handle=h1['handle'], dst_ip=data.ip4_addr[1], \ ping_count='1', exp_count='1') if res: st.log("Ping succeeded.") else: st.warn("Ping failed.") conf_var = { 'mode': 'enable', 'active_connect_enable': '1', 'local_as': '200', 'remote_as': '100', 'remote_ip_addr': data.ip4_addr[1] } route_var = { 'mode': 'add', 'num_routes': route_count, 'prefix': '121.1.1.0', 'as_path': 'as_seq:1' } ctrl_start = {'mode': 'start'} # Configuring the BGP router. bgp_rtr1 = tgapi.tg_bgp_config(tg=tg, handle=h1['handle'], conf_var=conf_var, route_var=route_var, ctrl_var=ctrl_start) st.log("BGP_HANDLE: " + str(bgp_rtr1)) st.log( "waiting for 10 sec to get the BGP neighbor started before going for another TG operation" ) st.wait(10) # Verified at neighbor. tr1 = tg.tg_traffic_config(port_handle=tg_handler["tg_ph_1"], mode='create', transmit_mode='single_burst', pkts_per_burst=2000, \ length_mode='fixed', rate_pps=2000, l3_protocol='ipv4', mac_src=data.tg_mac1, \ mac_dst=dut_rt_int_mac1, ip_src_addr=data.ip4_addr[0], ip_dst_addr=data.ip4_addr[9]) st.log("TRAFCONF: " + str(tr1)) res = tg.tg_traffic_control(action='run', stream_handle=tr1['stream_id']) st.log("TR_CTRL: " + str(res)) tg.tg_traffic_control(action='stop', stream_handle=tr1['stream_id']) st.log("Checking the stats and verifying the traffic flow") traffic_details = { '1': { 'tx_ports': [vars.T1D1P1], 'tx_obj': [tg_handler["tg"]], 'exp_ratio': [1], 'rx_ports': [vars.T1D2P1], 'rx_obj': [tg_handler["tg"]], } } #verify statistics aggrResult = tgapi.validate_tgen_traffic(traffic_details=traffic_details, mode='aggregate', comp_type='packet_count') if not aggrResult: return False return True
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 test_ft_bgp_unnumbered_peer_basic(): # ################ Author Details ################ # Name: Kiran Vedula # Email: [email protected] # ################################################ utils_obj.banner_log( 'FtOtSoRtBgpUnFn001,FtOtSoRtBgpUnFn002,FtOtSoRtBgpUnFn018,FtOtSoRtBgpUnFn019' ) st.log('######------Configure Unnumbered BGP peers------######') result = 0 if not utils.poll_wait(bgp_obj.verify_bgp_summary, data.wait_timer, vars.D1, family='ipv6', shell=bgp_cli_type, neighbor=vars.D1D2P1, state='Established'): st.log("Failed to form BGP unnumbered peering using IPv6 link local") result += 1 bgp_obj.config_bgp_neighbor_properties(vars.D1, data.d1_local_as, vars.D1D2P1, family="ipv6", neighbor_shutdown='', no_form='') if utils.poll_wait(bgp_obj.verify_bgp_summary, data.wait, vars.D1, family='ipv6', shell=bgp_cli_type, neighbor=vars.D1D2P1, state='Established'): st.log("unnumbered BGP peering is established even after shutdown") result += 1 bgp_obj.config_bgp_neighbor_properties(vars.D1, data.d1_local_as, vars.D1D2P1, family="ipv6", neighbor_shutdown='', no_form='no') if not utils.poll_wait(bgp_obj.verify_bgp_summary, data.wait_timer, vars.D1, family='ipv6', shell=bgp_cli_type, neighbor=vars.D1D2P1, state='Established'): st.log( "Failed to form BGP unnumbered peering using IPv6 link local after no shutdown" ) result += 1 if not utils.poll_wait(bgp_obj.verify_bgp_summary, data.wait_timer, vars.D1, family='ipv6', shell=bgp_cli_type, neighbor=data.vlan_in_1, state='Established'): st.log( "Failed to form BGP unnumbered peering using IPv6 link local on a VLAN" ) result += 1 # Get show ndp output st.log('######------shut/no shut link with unnumbered BGP------######') utils.exec_all( True, [[arp_obj.show_ndp, vars.D1, None], [arp_obj.show_ndp, vars.D2, None]]) intf_obj.interface_operation(vars.D1, vars.D1D2P1, operation="shutdown", skip_verify=True) st.wait(data.wait) intf_obj.interface_status_show(vars.D1, vars.D1D2P1) intf_obj.interface_operation(vars.D1, vars.D1D2P1, operation="startup", skip_verify=True) st.wait(data.wait) if not utils.poll_wait(bgp_obj.verify_bgp_summary, data.wait_timer, vars.D1, family='ipv6', shell=bgp_cli_type, neighbor=vars.D1D2P1, state='Established'): st.log("Failed to form BGP unnumbered peering using IPv6 link local") result += 1 if result == 0: st.report_pass("test_case_passed") else: st.log("BGP IPv6 unnumbered neighborship failure") st.report_fail("test_case_failed")
def qos_module_hooks(request): # add things at the start of this module global vars vars = dict() vars = st.ensure_min_topology("D1D2:1", "D1T1:2", "D2T1:2") intf_show = interface_status_show(vars.D1, interfaces=[vars.D1T1P1, vars.D1D2P1]) port_speed_info = dict() for port in [vars.D1T1P1, vars.D1D2P1]: filter_data = filter_and_select(intf_show, ['speed'], {'interface': port}) if filter_data and 'speed' in filter_data[0]: port_speed_info[port] = int(filter_data[0]['speed'].replace( 'G', '000')) if port_speed_info[vars.D1D2P1] != port_speed_info[vars.D1T1P1]: st.debug("The TG connected port speed: {}".format( port_speed_info[vars.D1T1P1])) st.debug("The DUT interconnected port speed: {}".format( port_speed_info[vars.D1D2P1])) st.report_unsupported( "msg", "The TG connected port and the DUT interconnected port speeds are not equal" ) scheduling_vars() scheduling_data.pmap_details = asicapi.get_intf_pmap( vars.D1, interface_name=[vars.D1D2P1]) if not scheduling_data.pmap_details: st.debug("PMAP details are: {}".format(scheduling_data.pmap_details)) st.report_fail('no_data_found') scheduling_module_config(config='yes') st.debug("Getting TG handlers") tg1, scheduling_data.tg_ph_1 = tgapi.get_handle_byname("T1D1P1") tg2, scheduling_data.tg_ph_2 = tgapi.get_handle_byname("T1D1P2") tg3, scheduling_data.tg_ph_3 = tgapi.get_handle_byname("T1D2P1") tg4, scheduling_data.tg_ph_4 = tgapi.get_handle_byname("T1D2P2") scheduling_data.tg = tg1 st.unused(tg2, tg3, tg4) st.debug("Reset and clear statistics of TG ports") scheduling_data.tg.tg_traffic_control(action='reset', port_handle=[ scheduling_data.tg_ph_1, scheduling_data.tg_ph_2, scheduling_data.tg_ph_3, scheduling_data.tg_ph_4 ]) scheduling_data.tg.tg_traffic_control(action='clear_stats', port_handle=[ scheduling_data.tg_ph_1, scheduling_data.tg_ph_2, scheduling_data.tg_ph_3, scheduling_data.tg_ph_4 ]) st.debug("Creating TG streams") scheduling_data.streams = {} stream = scheduling_data.tg.tg_traffic_config( port_handle=scheduling_data.tg_ph_3, mode='create', length_mode='fixed', frame_size=64, pkts_per_burst=10, l2_encap='ethernet_ii_vlan', transmit_mode='single_burst', vlan_id=scheduling_data.vlan, mac_src=scheduling_data.mac_egress_1, mac_dst='00:0a:12:00:00:01', vlan="enable") scheduling_data.streams['vlan_tagged_egress_port1'] = stream['stream_id'] stream = scheduling_data.tg.tg_traffic_config( port_handle=scheduling_data.tg_ph_4, mode='create', length_mode='fixed', frame_size=64, pkts_per_burst=10, l2_encap='ethernet_ii_vlan', transmit_mode='single_burst', vlan_id=scheduling_data.vlan, mac_src=scheduling_data.mac_egress_2, mac_dst='00:0a:12:00:00:02', vlan="enable") scheduling_data.streams['vlan_tagged_egress_port2'] = stream['stream_id'] stream = scheduling_data.tg.tg_traffic_config( port_handle=scheduling_data.tg_ph_1, mode='create', transmit_mode='continuous', length_mode='fixed', rate_percent=100, l2_encap='ethernet_ii_vlan', frame_size=1024, vlan_id=scheduling_data.vlan, vlan="enable", vlan_user_priority=scheduling_data.dwrr_queue1, mac_src="00:00:00:00:00:11", mac_dst=scheduling_data.mac_egress_1) scheduling_data.streams['scheduling_port_dwrr_ingress1'] = stream[ 'stream_id'] stream = scheduling_data.tg.tg_traffic_config( port_handle=scheduling_data.tg_ph_2, mode='create', transmit_mode='continuous', length_mode='fixed', rate_percent=100, l2_encap='ethernet_ii_vlan', frame_size=1024, vlan_id=scheduling_data.vlan, vlan="enable", vlan_user_priority=scheduling_data.dwrr_queue2, mac_src="00:00:00:00:00:22", mac_dst=scheduling_data.mac_egress_2) scheduling_data.streams['scheduling_port_dwrr_ingress2'] = stream[ 'stream_id'] yield st.debug('Module config Cleanup') scheduling_module_config(config='no')
def validate_image(dut): tc_list = [ 'verify_system_status', 'verify_show_version', 'show_platform_summary', 'show_platform_syseprom', 'show_interface_status' ] result_count = len(tc_list) st.log('Executing Image Validation Tests on: {}'.format( data.dut_platform_info[dut])) version_op = basic_api.show_version(dut) if data.dut_version_info[dut] in version_op['version']: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Passed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[1])) result_count -= 1 else: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Failed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[1])) if basic_api.get_system_status(dut): st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Passed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[0])) result_count -= 1 else: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Failed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[0])) plat_sum_op = basic_api.get_platform_summary(dut) if data.dut_platform_info[dut].lower() in plat_sum_op['platform'].lower(): st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Passed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[2])) result_count -= 1 else: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Failed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[2])) st.log(plat_sum_op) plat_eep_op = basic_api.get_platform_syseeprom(dut) if plat_eep_op: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Passed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[3])) result_count -= 1 else: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Failed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[3])) st.log(plat_eep_op) intf_status_op = intf_api.interface_status_show(dut) if intf_status_op: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Passed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[4])) result_count -= 1 else: st.log('Build: {}, DUT: {}, Platform: {}, TestCase: {} Failed'.format( version_op['version'], dut, data.dut_platform_info[dut], tc_list[4])) if result_count == 0: st.log('Image Validation on platform {}: Passed'.format( data.dut_platform_info[dut])) st.report_pass('test_case_passed') else: st.log('Image Validation on platform {}: Failed'.format( data.dut_platform_info[dut])) st.report_fail('test_case_failed')