def test_l3_host_scaling_tc5_8(): vars = st.get_testbed_vars() # Config 2 IPV4 interfaces on DUT. (tg1, _, tg_ph_1, _) = get_handles_1() dut1 = vars.D1 ipfeature.get_interface_ip_address(dut1, family="ipv4") ipfeature.get_interface_ip_address(dut1, family="ipv6") ipfeature.show_ip_route(dut1) papi.get_status(dut1) ret = fast_reboot_node(dut1) pre_test_l3_fwding() if (ret): 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) total = 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") else: post_test_l3_fwding() st.report_fail("test_case_failed")
def dut_links_status(dut): local_list = [] for local, partner, remote in st.get_dut_links(dut): local_list.append(local) for local, partner, remote in st.get_tg_links(dut): local_list.append(local) output = portapi.get_status(dut, ",".join(local_list)) results = dict() for local, partner, remote in st.get_dut_links(dut): match = {"interface": local} entries = utils.filter_and_select(output, ["admin", "oper"], match) name = "{}--{}".format(dut, local) if entries: results[name] = "{}/{}".format(entries[0]["admin"], entries[0]["oper"]) else: results[name] = "----" for local, partner, remote in st.get_tg_links(dut): match = {"interface": local} entries = utils.filter_and_select(output, ["admin", "oper"], match) name = "{}--{}".format(dut, local) if entries: results[name] = "{}/{}".format(entries[0]["admin"], entries[0]["oper"]) else: results[name] = "----" return results
def interface_status_show(dut, interfaces=None, cli_type="click"): """ Author: Chaitanya Vella ([email protected]) Function to get the interface(s) status :param dut: :param interfaces: :param cli_type: :return: """ if cli_type == "click": if interfaces: return portapi.get_status(dut, ','.join(make_list(interfaces))) return portapi.get_status(dut, interfaces) elif cli_type == "klish": command = "show interface status" interface = make_list(interfaces) if interface: command += " | grep \"{}\"".format("|".join(interface)) return st.show(dut, command, type=cli_type) else: st.log("Unsupported CLI TYPE {}".format(cli_type)) return False
def check_port_speed(dut, in_port1, in_port2, out_port): global rate_percent, sp_ratio_1, sp_ratio_2, pkts_sec in_speed1 = port.get_status(dut, in_port1)[0]['speed'] in_speed1 = get_speed(in_speed1) in_speed2 = port.get_status(dut, in_port2)[0]['speed'] in_speed2 = get_speed(in_speed2) if in_speed1 != in_speed2: st.error( 'ingress port1 {} speed {} and port2 {} speed {} are not same,' 'skip the testcase'.format(in_port1, in_speed1, in_port2, in_speed2)) return False eg_speed = port.get_status(dut, out_port)[0]['speed'] eg_speed = get_speed(eg_speed) if in_speed1 >= eg_speed and in_speed1 / eg_speed == 1: rate_percent = 100 elif in_speed1 >= eg_speed and in_speed1 / eg_speed == 2: rate_percent = 40 elif in_speed1 >= eg_speed and in_speed1 / eg_speed == 4: rate_percent = 20 elif in_speed1 >= eg_speed and in_speed1 / eg_speed == 10: rate_percent = 10 pkts_sec = in_speed1 / 1024 in_speed = in_speed1 + in_speed2 if in_speed / eg_speed > 1: st.log( "egress speed: {} less than ingress speed: {}, congestion criteria met" .format(eg_speed, in_speed)) return True else: st.log( "egress speed: {} higher than ingress speed: {}, congestion criteria not met" .format(eg_speed, in_speed)) return False
def get_status(self, dut, port_csv): cli_type = st.getenv("SPYTEST_HOOKS_PORT_STATUS_UITYPE", "click") return port.get_status(dut, port_csv, cli_type=cli_type)