From 39f18e68f8522183a4d31414bc8d35588c6bcef9 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 01/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/common/platform/interface_utils.py | 65 ++++++++++--------- tests/common/plugins/sanity_check/checks.py | 6 +- .../mellanox/test_check_sfp_presence.py | 3 +- .../mellanox/test_check_sfp_using_ethtool.py | 17 +++-- tests/platform_tests/sfp/test_sfputil.py | 8 +-- tests/snmp/test_snmp_lldp.py | 22 +++---- 6 files changed, 65 insertions(+), 56 deletions(-) diff --git a/tests/common/platform/interface_utils.py b/tests/common/platform/interface_utils.py index db84d19c7ce..4c43fa98ec9 100644 --- a/tests/common/platform/interface_utils.py +++ b/tests/common/platform/interface_utils.py @@ -4,7 +4,9 @@ This script contains re-usable functions for checking status of interfaces on SONiC. """ import json +import re import logging +import pytest from transceiver_utils import all_transceivers_detected @@ -42,40 +44,31 @@ def check_interface_status(dut, asic_index, interfaces, xcvr_skip_list): asichost = dut.asic_instance(asic_index) namespace = asichost.get_asic_namespace() logging.info("Check interface status using cmd 'show interface'") - #TODO Remove this logic when minigraph facts supports namespace in multi_asic - mg_ports = dut.minigraph_facts(host=dut.hostname)["ansible_facts"]["minigraph_ports"] - if asic_index is not None: - portmap = get_port_map(dut, asic_index) - # Check if the interfaces of this AISC is present in mg_ports - interface_list = {k:v for k, v in portmap.items() if k in mg_ports} - mg_ports = interface_list + ports = get_port_map(dut, asic_index) output = dut.command("show interface description") intf_status = parse_intf_status(output["stdout_lines"][2:]) check_intf_presence_command = 'show interface transceiver presence {}' for intf in interfaces: - expected_oper = "up" if intf in mg_ports else "down" - expected_admin = "up" if intf in mg_ports else "down" + expected_oper = "up" if intf in ports else "down" + expected_admin = "up" if intf in ports else "down" if intf not in intf_status: logging.info("Missing status for interface %s" % intf) return False if intf_status[intf]["oper"] != expected_oper: - logging.info("Oper status of interface %s is %s, expected '%s'" % (intf, intf_status[intf]["oper"], - expected_oper)) + logging.info("Oper status of interface %s is %s, expected '%s'" % (intf, intf_status[intf]["oper"], expected_oper)) return False if intf_status[intf]["admin"] != expected_admin: - logging.info("Admin status of interface %s is %s, expected '%s'" % (intf, intf_status[intf]["admin"], - expected_admin)) + logging.info("Admin status of interface %s is %s, expected '%s'" % (intf, intf_status[intf]["admin"], expected_admin)) return False # Cross check the interface SFP presence status - if intf not in xcvr_skip_list[dut.hostname]: + if xcvr_skip_list and intf not in xcvr_skip_list[dut.hostname]: check_presence_output = dut.command(check_intf_presence_command.format(intf)) presence_list = check_presence_output["stdout_lines"][2].split() assert intf in presence_list, "Wrong interface name in the output: %s" % str(presence_list) assert 'Present' in presence_list, "Status is not expected, presence status: %s" % str(presence_list) - logging.info("Check interface status using the interface_facts module") - intf_facts = dut.interface_facts(up_ports=mg_ports, namespace=namespace)["ansible_facts"] + intf_facts = dut.interface_facts(up_ports=ports, namespace=namespace)["ansible_facts"] down_ports = intf_facts["ansible_interface_link_down_ports"] if len(down_ports) != 0: logging.info("Some interfaces are down: %s" % str(down_ports)) @@ -83,6 +76,7 @@ def check_interface_status(dut, asic_index, interfaces, xcvr_skip_list): return True + # This API to check the interface information actoss all front end ASIC's def check_all_interface_information(dut, interfaces, xcvr_skip_list): for asic_index in dut.get_frontend_asic_ids(): @@ -98,6 +92,7 @@ def check_all_interface_information(dut, interfaces, xcvr_skip_list): return True + # This API to check the interface information per asic. def check_interface_information(dut, asic_index, interfaces, xcvr_skip_list): if not all_transceivers_detected(dut, asic_index, interfaces, xcvr_skip_list): @@ -109,24 +104,34 @@ def check_interface_information(dut, asic_index, interfaces, xcvr_skip_list): return True + def get_port_map(dut, asic_index=None): """ @summary: Get the port mapping info from the DUT @return: a dictionary containing the port map """ logging.info("Retrieving port mapping from DUT") - # copy the helper to DUT - src_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'files/getportmap.py') - dest_path = os.path.join('/usr/share/sonic/device', dut.facts['platform'], 'plugins/getportmap.py') - dut.copy(src=src_path, dest=dest_path) - - # execute command on the DUT to get portmap - get_portmap_cmd = "docker exec pmon python /usr/share/sonic/platform/plugins/getportmap.py -asicid {}".format(asic_index) - portmap_json_string = dut.command(get_portmap_cmd)["stdout"] - + if asic_index is not None: + asichost = dut.asic_instance(asic_index) + cfg_facts = asichost.config_facts(host=dut.hostname, source="persistent", verbose=False)['ansible_facts'] + else: + # execute command on the DUT to get port map from config_db.json + validate_config_db_file_exist(dut) + get_cfg_facts_cmd = "cat /etc/sonic/config_db.json" + portmap_json_string = dut.command(get_cfg_facts_cmd)["stdout"] + cfg_facts = json.loads(portmap_json_string) # parse the json - port_mapping = json.loads(portmap_json_string) - assert port_mapping, "Retrieve port mapping from DUT failed" - - return port_mapping - + port_mapping_res = {} + port_mapping = cfg_facts.get("PORT", {}) + for port, port_dict_info in port_mapping.items(): + port_alias = port_dict_info["alias"] + port_alias_number = int(re.search('etp(\d+)', port_alias).group(1)) + port_mapping_res[port] = [port_alias_number] + return port_mapping_res + + +def validate_config_db_file_exist(dut): + config_db_location_cmd = "ls /etc/sonic/config_db.json" + config_db_location_string = dut.command(config_db_location_cmd)["stdout"] + if re.search("No such file or directory", config_db_location_string): + assert False, "No /etc/sonic/config_db.json found on dut - please load a valid config_db.json to switch" diff --git a/tests/common/plugins/sanity_check/checks.py b/tests/common/plugins/sanity_check/checks.py index 95ae7cb4bc2..857c6cc800e 100644 --- a/tests/common/plugins/sanity_check/checks.py +++ b/tests/common/plugins/sanity_check/checks.py @@ -137,10 +137,12 @@ def _check_interfaces_on_dut(*args, **kwargs): check_result = {"failed": True, "check_item": "interfaces", "host": dut.hostname} for asic in dut.asics: ip_interfaces = [] + phy_interfaces = [] cfg_facts = asic.config_facts(host=dut.hostname, source="persistent", verbose=False)['ansible_facts'] - phy_interfaces = [k for k, v in cfg_facts["PORT"].items() if - "admin_status" in v and v["admin_status"] == "up"] + if "PORT" in cfg_facts: + phy_interfaces = [k for k, v in cfg_facts["PORT"].items() if + "admin_status" in v and v["admin_status"] == "up"] if "PORTCHANNEL_INTERFACE" in cfg_facts: ip_interfaces = cfg_facts["PORTCHANNEL_INTERFACE"].keys() if "VLAN_INTERFACE" in cfg_facts: diff --git a/tests/platform_tests/mellanox/test_check_sfp_presence.py b/tests/platform_tests/mellanox/test_check_sfp_presence.py index 2ed37e17896..2993a056cce 100644 --- a/tests/platform_tests/mellanox/test_check_sfp_presence.py +++ b/tests/platform_tests/mellanox/test_check_sfp_presence.py @@ -13,11 +13,12 @@ pytest.mark.topology('any') ] + def test_check_sfp_presence(duthosts, rand_one_dut_hostname, conn_graph_facts): """This test case is to check SFP presence status with CLI and sysfs. """ duthost = duthosts[rand_one_dut_hostname] - ports_config = json.loads(duthost.command("sudo sonic-cfggen -d --var-json PORT")["stdout"]) + duthost.command("sudo sonic-cfggen -d --var-json PORT") check_intf_presence_command = 'show interface transceiver presence {}' logging.info("Use show interface status information") diff --git a/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py b/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py index b7def59b132..8239a625132 100644 --- a/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py +++ b/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py @@ -5,10 +5,10 @@ https://github.com/Azure/SONiC/blob/master/doc/pmon/sonic_platform_test_plan.md """ import logging -import os import json import pytest from tests.common.fixtures.conn_graph_facts import conn_graph_facts +from tests.common.platform.interface_utils import get_port_map, check_interface_status from tests.common.mellanox_data import SPC3_HWSKUS from check_hw_mgmt_service import check_hw_management_service @@ -17,12 +17,16 @@ pytest.mark.topology('any') ] + def test_check_sfp_using_ethtool(duthosts, rand_one_dut_hostname, conn_graph_facts, tbinfo): """This test case is to check SFP using the ethtool. """ duthost = duthosts[rand_one_dut_hostname] - ports_config = json.loads(duthost.command("sudo sonic-cfggen -d --var-json PORT")["stdout"]) - + ports_config = {} + ports_config_output = duthost.command("sudo sonic-cfggen -d --var-json PORT")["stdout"] + if ports_config_output: + # in the case of zero ports the json output can be none + ports_config = json.loads(ports_config_output) logging.info("Use the ethtool to check SFP information") if duthost.facts["hwsku"] in SPC3_HWSKUS: lanes_divider = 8 @@ -46,9 +50,8 @@ def test_check_sfp_using_ethtool(duthosts, rand_one_dut_hostname, conn_graph_fac "Unexpected line %s in %s" % (line, str(ethtool_sfp_output["stdout_lines"])) logging.info("Check interface status") - mg_facts = duthost.get_extended_minigraph_facts(tbinfo) - intf_facts = duthost.interface_facts(up_ports=mg_facts["minigraph_ports"])["ansible_facts"] - assert len(intf_facts["ansible_interface_link_down_ports"]) == 0, \ - "Some interfaces are down: %s" % str(intf_facts["ansible_interface_link_down_ports"]) + for asic_index in duthost.get_frontend_asic_ids(): + interface_list = get_port_map(duthost, asic_index) + assert check_interface_status(duthost, asic_index, interface_list, []), "Not all interfaces are up" check_hw_management_service(duthost) diff --git a/tests/platform_tests/sfp/test_sfputil.py b/tests/platform_tests/sfp/test_sfputil.py index b8e2e68eaa8..5c85f0b9883 100644 --- a/tests/platform_tests/sfp/test_sfputil.py +++ b/tests/platform_tests/sfp/test_sfputil.py @@ -14,6 +14,7 @@ from util import parse_eeprom from util import parse_output from util import get_dev_conn +from tests.common.platform.interface_utils import get_port_map, check_interface_status cmd_sfp_presence = "sudo sfputil show presence" cmd_sfp_eeprom = "sudo sfputil show eeprom" @@ -90,10 +91,9 @@ def test_check_sfputil_reset(duthosts, enum_rand_one_per_hwsku_frontend_hostname assert parsed_presence[intf] == "Present", "Interface presence is not 'Present'" logging.info("Check interface status") - mg_facts = duthost.get_extended_minigraph_facts(tbinfo) - intf_facts = duthost.interface_facts(up_ports=mg_facts["minigraph_ports"])["ansible_facts"] - assert len(intf_facts["ansible_interface_link_down_ports"]) == 0, \ - "Some interfaces are down: {}".format(intf_facts["ansible_interface_link_down_ports"]) + for asic_index in duthost.get_frontend_asic_ids(): + interface_list = get_port_map(duthost, asic_index) + assert check_interface_status(duthost, asic_index, interface_list, []), "Not all interfaces are up" def test_check_sfputil_low_power_mode(duthosts, enum_rand_one_per_hwsku_frontend_hostname, enum_frontend_asic_index, conn_graph_facts, tbinfo): diff --git a/tests/snmp/test_snmp_lldp.py b/tests/snmp/test_snmp_lldp.py index d2f0d38e319..89b8e95ba6b 100644 --- a/tests/snmp/test_snmp_lldp.py +++ b/tests/snmp/test_snmp_lldp.py @@ -1,5 +1,6 @@ import pytest import re +from tests.common.platform.interface_utils import get_port_map pytestmark = [ pytest.mark.topology('any'), @@ -38,11 +39,14 @@ def test_snmp_lldp(duthosts, enum_rand_one_per_hwsku_hostname, localhost, creds_ hostip = duthost.host.options['inventory_manager'].get_host(duthost.hostname).vars['ansible_host'] snmp_facts = localhost.snmp_facts(host=hostip, version="v2c", community=creds_all_duts[duthost]["snmp_rocommunity"])['ansible_facts'] - mg_facts = {} - for asic_id in duthost.get_asic_ids(): - mg_facts_ns = duthost.asic_instance(asic_id).get_extended_minigraph_facts(tbinfo)['minigraph_neighbors'] - if mg_facts_ns is not None: - mg_facts.update(mg_facts_ns) + for asic in duthost.asics: + lldp_nei = [] + cfg_facts = asic.config_facts(host=duthost.hostname, + source="persistent", verbose=False)['ansible_facts'] + if "PORT" in cfg_facts: + for port, port_info_dict in cfg_facts["PORT"].items(): + if re.search('ARISTA', port_info_dict['description']): + lldp_nei.append(port) print snmp_facts['snmp_lldp'] for k in ['lldpLocChassisIdSubtype', 'lldpLocChassisId', 'lldpLocSysName', 'lldpLocSysDesc']: @@ -64,12 +68,6 @@ def test_snmp_lldp(duthosts, enum_rand_one_per_hwsku_hostname, localhost, creds_ assert snmp_facts['snmp_lldp'][k] assert "No Such Object currently exists" not in snmp_facts['snmp_lldp'][k] - minigraph_lldp_nei = [] - for k, v in mg_facts.items(): - if "server" not in v['name'].lower(): - minigraph_lldp_nei.append(k) - print minigraph_lldp_nei - # Check if lldpRemTable is present active_intf = [] for k, v in snmp_facts['snmp_interfaces'].items(): @@ -85,7 +83,7 @@ def test_snmp_lldp(duthosts, enum_rand_one_per_hwsku_hostname, localhost, creds_ active_intf.append(k) print "lldpRemTable: ", active_intf - assert len(active_intf) >= len(minigraph_lldp_nei) * 0.8 + assert len(active_intf) >= len(lldp_nei) * 0.8 # skip neighbors that do not send chassis information via lldp lldp_facts= {} From cbb863c06eca5ee55b93549a157f9fdbce78452b Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 02/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/platform_tests/mellanox/test_check_sfp_presence.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/platform_tests/mellanox/test_check_sfp_presence.py b/tests/platform_tests/mellanox/test_check_sfp_presence.py index 2993a056cce..96f7861f9d1 100644 --- a/tests/platform_tests/mellanox/test_check_sfp_presence.py +++ b/tests/platform_tests/mellanox/test_check_sfp_presence.py @@ -3,7 +3,6 @@ """ import logging import os -import json import pytest from tests.common.fixtures.conn_graph_facts import conn_graph_facts From 4d061f5173850ffc68e940c6eb261ef644feb428 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 03/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/common/platform/interface_utils.py | 1 - tests/snmp/test_snmp_lldp.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/common/platform/interface_utils.py b/tests/common/platform/interface_utils.py index 4c43fa98ec9..c103617fec9 100644 --- a/tests/common/platform/interface_utils.py +++ b/tests/common/platform/interface_utils.py @@ -6,7 +6,6 @@ import json import re import logging -import pytest from transceiver_utils import all_transceivers_detected diff --git a/tests/snmp/test_snmp_lldp.py b/tests/snmp/test_snmp_lldp.py index 89b8e95ba6b..55029b741ff 100644 --- a/tests/snmp/test_snmp_lldp.py +++ b/tests/snmp/test_snmp_lldp.py @@ -1,6 +1,5 @@ import pytest import re -from tests.common.platform.interface_utils import get_port_map pytestmark = [ pytest.mark.topology('any'), From b96e0f4ea600bcd072ede7095b7831f979b8f1f2 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 04/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/snmp/test_snmp_phy_entity.py | 2 +- tests/telemetry/test_telemetry.py | 42 ++++++++++++++++++------------ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/tests/snmp/test_snmp_phy_entity.py b/tests/snmp/test_snmp_phy_entity.py index 84f077c77f8..1b2e575c68d 100644 --- a/tests/snmp/test_snmp_phy_entity.py +++ b/tests/snmp/test_snmp_phy_entity.py @@ -614,7 +614,7 @@ def test_turn_off_psu_and_check_psu_info(duthosts, enum_rand_one_per_hwsku_hostn pdu_controller.turn_off_outlet(first_outlet) assert wait_until(30, 5, check_outlet_status, pdu_controller, first_outlet, False) # wait for psud update the database - assert wait_until(120, 20, _check_psu_status_after_power_off, duthost, localhost, creds_all_duts) + assert wait_until(180, 20, _check_psu_status_after_power_off, duthost, localhost, creds_all_duts) def _check_psu_status_after_power_off(duthost, localhost, creds_all_duts): diff --git a/tests/telemetry/test_telemetry.py b/tests/telemetry/test_telemetry.py index d0e7344c300..877116cf250 100644 --- a/tests/telemetry/test_telemetry.py +++ b/tests/telemetry/test_telemetry.py @@ -4,6 +4,7 @@ import re import pytest +from tests.common.platform.interface_utils import get_port_map from pkg_resources import parse_version from tests.common.helpers.assertions import pytest_assert from tests.common.utilities import wait_until, wait_tcp_connection @@ -153,21 +154,25 @@ def test_telemetry_enabledbydefault(duthosts, rand_one_dut_hostname): status_expected = "enabled"; pytest_assert(str(v) == status_expected, "Telemetry feature is not enabled") + def test_telemetry_ouput(duthosts, rand_one_dut_hostname, ptfhost, setup_streaming_telemetry, localhost): """Run pyclient from ptfdocker and show gnmi server outputself. """ duthost = duthosts[rand_one_dut_hostname] + for asic_index in duthost.get_frontend_asic_ids(): + interface_list = get_port_map(duthost, asic_index) + if "Ethernet0" in interface_list: + logger.info('start telemetry output testing') + dut_ip = duthost.mgmt_ip + cmd = 'python /gnxi/gnmi_cli_py/py_gnmicli.py -g -t {0} -p {1} -m get -x COUNTERS/Ethernet0 -xt COUNTERS_DB \ + -o "ndastreamingservertest"'.format(dut_ip, TELEMETRY_PORT) + show_gnmi_out = ptfhost.shell(cmd)['stdout'] + logger.info("GNMI Server output") + logger.info(show_gnmi_out) + result = str(show_gnmi_out) + inerrors_match = re.search("SAI_PORT_STAT_IF_IN_ERRORS", result) + pytest_assert(inerrors_match is not None, "SAI_PORT_STAT_IF_IN_ERRORS not found in gnmi_output") - logger.info('start telemetry output testing') - dut_ip = duthost.mgmt_ip - cmd = 'python /gnxi/gnmi_cli_py/py_gnmicli.py -g -t {0} -p {1} -m get -x COUNTERS/Ethernet0 -xt COUNTERS_DB \ - -o "ndastreamingservertest"'.format(dut_ip, TELEMETRY_PORT) - show_gnmi_out = ptfhost.shell(cmd)['stdout'] - logger.info("GNMI Server output") - logger.info(show_gnmi_out) - result = str(show_gnmi_out) - inerrors_match = re.search("SAI_PORT_STAT_IF_IN_ERRORS", result) - pytest_assert(inerrors_match is not None, "SAI_PORT_STAT_IF_IN_ERRORS not found in gnmi_output") def test_osbuild_version(duthosts, rand_one_dut_hostname, ptfhost, localhost): """ Test osbuild/version query. @@ -181,6 +186,7 @@ def test_osbuild_version(duthosts, rand_one_dut_hostname, ptfhost, localhost): assert_equal(len(re.findall('"build_version": "sonic\.', result)), 1, "build_version value at {0}".format(result)) assert_equal(len(re.findall('sonic\.NA', result, flags=re.IGNORECASE)), 0, "invalid build_version value at {0}".format(result)) + def test_sysuptime(duthosts, rand_one_dut_hostname, ptfhost, setup_streaming_telemetry, localhost): """ @summary: Run pyclient from ptfdocker and test the dataset 'system uptime' to check @@ -226,6 +232,7 @@ def test_sysuptime(duthosts, rand_one_dut_hostname, ptfhost, setup_streaming_tel if system_uptime_2nd - system_uptime_1st < 10: pytest.fail("The value of system uptime was not updated correctly.") + def test_virtualdb_table_streaming(duthosts, rand_one_dut_hostname, ptfhost, localhost): """Run pyclient from ptfdocker to stream a virtual-db query multiple times. """ @@ -234,9 +241,12 @@ def test_virtualdb_table_streaming(duthosts, rand_one_dut_hostname, ptfhost, loc duthost = duthosts[rand_one_dut_hostname] skip_201911_and_older(duthost) cmd = generate_client_cli(duthost=duthost, method=METHOD_SUBSCRIBE, update_count = 3) - show_gnmi_out = ptfhost.shell(cmd)['stdout'] - result = str(show_gnmi_out) - - assert_equal(len(re.findall('Max update count reached 3', result)), 1, "Streaming update count in:\n{0}".format(result)) - assert_equal(len(re.findall('name: "Ethernet0"\n', result)), 4, "Streaming updates for Ethernet0 in:\n{0}".format(result)) # 1 for request, 3 for response - assert_equal(len(re.findall('timestamp: \d+', result)), 3, "Timestamp markers for each update message in:\n{0}".format(result)) + for asic_index in duthost.get_frontend_asic_ids(): + interface_list = get_port_map(duthost, asic_index) + if "Ethernet0" in interface_list: + show_gnmi_out = ptfhost.shell(cmd)['stdout'] + result = str(show_gnmi_out) + + assert_equal(len(re.findall('Max update count reached 3', result)), 1, "Streaming update count in:\n{0}".format(result)) + assert_equal(len(re.findall('name: "Ethernet0"\n', result)), 4, "Streaming updates for Ethernet0 in:\n{0}".format(result)) # 1 for request, 3 for response + assert_equal(len(re.findall('timestamp: \d+', result)), 3, "Timestamp markers for each update message in:\n{0}".format(result)) From 447d6fc9772d3e6da45ca00fc079b6369ff87205 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 05/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/common/platform/interface_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/common/platform/interface_utils.py b/tests/common/platform/interface_utils.py index c103617fec9..9afa6dd64da 100644 --- a/tests/common/platform/interface_utils.py +++ b/tests/common/platform/interface_utils.py @@ -123,9 +123,8 @@ def get_port_map(dut, asic_index=None): port_mapping_res = {} port_mapping = cfg_facts.get("PORT", {}) for port, port_dict_info in port_mapping.items(): - port_alias = port_dict_info["alias"] - port_alias_number = int(re.search('etp(\d+)', port_alias).group(1)) - port_mapping_res[port] = [port_alias_number] + port_index = port_dict_info["index"] + port_mapping_res[port] = [int(port_index)] return port_mapping_res From 136d9b98cc321edc7584ab9ef2c3a0a0d6aed7c7 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 06/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/telemetry/test_telemetry.py | 64 ++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 23 deletions(-) diff --git a/tests/telemetry/test_telemetry.py b/tests/telemetry/test_telemetry.py index 877116cf250..1624140a777 100644 --- a/tests/telemetry/test_telemetry.py +++ b/tests/telemetry/test_telemetry.py @@ -27,6 +27,7 @@ SUBMODE_ON_CHANGE = 1 SUBMODE_SAMPLE = 2 + # Helper functions def get_dict_stdout(gnmi_out, certs_out): """ Extracts dictionary from redis output. @@ -39,6 +40,7 @@ def get_dict_stdout(gnmi_out, certs_out): params_dict = dict(zip(key_list, value_list)) return params_dict + def get_list_stdout(cmd_out): out_list = [] for x in cmd_out: @@ -46,6 +48,7 @@ def get_list_stdout(cmd_out): out_list.append(result) return out_list + def setup_telemetry_forpyclient(duthost): """ Set client_auth=false. This is needed for pyclient to sucessfully set up channel with gnmi server. Restart telemetry process @@ -58,6 +61,7 @@ def setup_telemetry_forpyclient(duthost): else: logger.info('client auth is false. No need to restart telemetry') + def generate_client_cli(duthost, method=METHOD_GET, xpath="COUNTERS/Ethernet0", target="COUNTERS_DB", subscribe_mode=SUBSCRIBE_MODE_STREAM, submode=SUBMODE_SAMPLE, intervalms=0, update_count=3): """Generate the py_gnmicli command line based on the given params. """ @@ -68,11 +72,13 @@ def generate_client_cli(duthost, method=METHOD_GET, xpath="COUNTERS/Ethernet0", cmd += " --subscribe_mode {0} --submode {1} --interval {2} --update_count {3}".format(subscribe_mode, submode, intervalms, update_count) return cmd + def assert_equal(actual, expected, message): """Helper method to compare an expected value vs the actual value. """ pytest_assert(actual == expected, "{0}. Expected {1} vs actual {2}".format(message, expected, actual)) + @pytest.fixture(scope="module", autouse=True) def verify_telemetry_dockerimage(duthosts, rand_one_dut_hostname): """If telemetry docker is available in image then return true @@ -85,6 +91,7 @@ def verify_telemetry_dockerimage(duthosts, rand_one_dut_hostname): if not (len(matching) > 0): pytest.skip("docker-sonic-telemetry is not part of the image") + @pytest.fixture def setup_streaming_telemetry(duthosts, rand_one_dut_hostname, localhost, ptfhost): """ @@ -105,12 +112,26 @@ def setup_streaming_telemetry(duthosts, rand_one_dut_hostname, localhost, ptfho file_exists = ptfhost.stat(path="/gnxi/gnmi_cli_py/py_gnmicli.py") pytest_assert(file_exists["stat"]["exists"] is True) + def skip_201911_and_older(duthost): """ Skip the current test if the DUT version is 201911 or older. """ if parse_version(duthost.kernel_version) <= parse_version('4.9.0'): pytest.skip("Test not supported for 201911 images. Skipping the test") + +@pytest.fixture(scope='function') +def skip_if_no_data_port(duthosts, rand_one_dut_hostname): + """ + Fixture that skips test execution in case dut doesn't have data port Ethernet0 + """ + duthost = duthosts[rand_one_dut_hostname] + for asic_index in duthost.get_frontend_asic_ids(): + interface_list = get_port_map(duthost, asic_index) + if "Ethernet0" not in interface_list: + pytest.skip("This test is not supported as there is no data port Ethernet0 in dut") + + # Test functions def test_config_db_parameters(duthosts, rand_one_dut_hostname): """Verifies required telemetry parameters from config_db. @@ -138,6 +159,7 @@ def test_config_db_parameters(duthosts, rand_one_dut_hostname): server_crt_expected = "/etc/sonic/telemetry/streamingtelemetryserver.cer" pytest_assert(str(value) == server_crt_expected, "'server_crt' value is not '{}'".format(server_crt_expected)) + def test_telemetry_enabledbydefault(duthosts, rand_one_dut_hostname): """Verify telemetry should be enabled by default """ @@ -155,23 +177,22 @@ def test_telemetry_enabledbydefault(duthosts, rand_one_dut_hostname): pytest_assert(str(v) == status_expected, "Telemetry feature is not enabled") -def test_telemetry_ouput(duthosts, rand_one_dut_hostname, ptfhost, setup_streaming_telemetry, localhost): +def test_telemetry_ouput(duthosts, rand_one_dut_hostname, ptfhost, skip_if_no_data_port, + setup_streaming_telemetry, localhost): """Run pyclient from ptfdocker and show gnmi server outputself. """ duthost = duthosts[rand_one_dut_hostname] - for asic_index in duthost.get_frontend_asic_ids(): - interface_list = get_port_map(duthost, asic_index) - if "Ethernet0" in interface_list: - logger.info('start telemetry output testing') - dut_ip = duthost.mgmt_ip - cmd = 'python /gnxi/gnmi_cli_py/py_gnmicli.py -g -t {0} -p {1} -m get -x COUNTERS/Ethernet0 -xt COUNTERS_DB \ - -o "ndastreamingservertest"'.format(dut_ip, TELEMETRY_PORT) - show_gnmi_out = ptfhost.shell(cmd)['stdout'] - logger.info("GNMI Server output") - logger.info(show_gnmi_out) - result = str(show_gnmi_out) - inerrors_match = re.search("SAI_PORT_STAT_IF_IN_ERRORS", result) - pytest_assert(inerrors_match is not None, "SAI_PORT_STAT_IF_IN_ERRORS not found in gnmi_output") + + logger.info('start telemetry output testing') + dut_ip = duthost.mgmt_ip + cmd = 'python /gnxi/gnmi_cli_py/py_gnmicli.py -g -t {0} -p {1} -m get -x COUNTERS/Ethernet0 -xt COUNTERS_DB \ + -o "ndastreamingservertest"'.format(dut_ip, TELEMETRY_PORT) + show_gnmi_out = ptfhost.shell(cmd)['stdout'] + logger.info("GNMI Server output") + logger.info(show_gnmi_out) + result = str(show_gnmi_out) + inerrors_match = re.search("SAI_PORT_STAT_IF_IN_ERRORS", result) + pytest_assert(inerrors_match is not None, "SAI_PORT_STAT_IF_IN_ERRORS not found in gnmi_output") def test_osbuild_version(duthosts, rand_one_dut_hostname, ptfhost, localhost): @@ -233,7 +254,7 @@ def test_sysuptime(duthosts, rand_one_dut_hostname, ptfhost, setup_streaming_tel pytest.fail("The value of system uptime was not updated correctly.") -def test_virtualdb_table_streaming(duthosts, rand_one_dut_hostname, ptfhost, localhost): +def test_virtualdb_table_streaming(duthosts, rand_one_dut_hostname, skip_if_no_data_port, ptfhost, localhost): """Run pyclient from ptfdocker to stream a virtual-db query multiple times. """ logger.info('start virtual db sample streaming testing') @@ -241,12 +262,9 @@ def test_virtualdb_table_streaming(duthosts, rand_one_dut_hostname, ptfhost, loc duthost = duthosts[rand_one_dut_hostname] skip_201911_and_older(duthost) cmd = generate_client_cli(duthost=duthost, method=METHOD_SUBSCRIBE, update_count = 3) - for asic_index in duthost.get_frontend_asic_ids(): - interface_list = get_port_map(duthost, asic_index) - if "Ethernet0" in interface_list: - show_gnmi_out = ptfhost.shell(cmd)['stdout'] - result = str(show_gnmi_out) + show_gnmi_out = ptfhost.shell(cmd)['stdout'] + result = str(show_gnmi_out) - assert_equal(len(re.findall('Max update count reached 3', result)), 1, "Streaming update count in:\n{0}".format(result)) - assert_equal(len(re.findall('name: "Ethernet0"\n', result)), 4, "Streaming updates for Ethernet0 in:\n{0}".format(result)) # 1 for request, 3 for response - assert_equal(len(re.findall('timestamp: \d+', result)), 3, "Timestamp markers for each update message in:\n{0}".format(result)) + assert_equal(len(re.findall('Max update count reached 3', result)), 1, "Streaming update count in:\n{0}".format(result)) + assert_equal(len(re.findall('name: "Ethernet0"\n', result)), 4, "Streaming updates for Ethernet0 in:\n{0}".format(result)) # 1 for request, 3 for response + assert_equal(len(re.findall('timestamp: \d+', result)), 3, "Timestamp markers for each update message in:\n{0}".format(result)) From ba0f3ec3ba5443fa103b2ecb57110ac3e07f7f01 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 07/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/snmp/test_snmp_default_route.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/snmp/test_snmp_default_route.py b/tests/snmp/test_snmp_default_route.py index efedcffea00..9fd35d5b45c 100644 --- a/tests/snmp/test_snmp_default_route.py +++ b/tests/snmp/test_snmp_default_route.py @@ -1,13 +1,24 @@ import pytest +from tests.common.platform.interface_utils import get_port_map pytestmark = [ pytest.mark.topology('any'), pytest.mark.device_type('vs') ] +@pytest.fixture(scope='function') +def skip_if_no_ports(duthosts, enum_rand_one_per_hwsku_frontend_hostname): + """ + Fixture that skips test execution in case dut doesn't have data ports + """ + duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] + for asic_index in duthost.get_frontend_asic_ids(): + interface_list = get_port_map(duthost, asic_index) + if not interface_list: + pytest.skip("This test is not supported as there are no data ports in dut") @pytest.mark.bsl -def test_snmp_default_route(duthosts, enum_rand_one_per_hwsku_frontend_hostname, localhost, creds_all_duts): +def test_snmp_default_route(duthosts, enum_rand_one_per_hwsku_frontend_hostname, skip_if_no_ports, localhost, creds_all_duts): """compare the snmp facts between observed states and target state""" duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] From 7e699c18c7fdf73adb7a17ee165dcde22f3c8e1a Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 08/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/snmp/conftest.py | 13 +++++++++++++ tests/snmp/test_snmp_loopback.py | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/snmp/conftest.py b/tests/snmp/conftest.py index 3877404cc47..f9dd3229638 100644 --- a/tests/snmp/conftest.py +++ b/tests/snmp/conftest.py @@ -1,4 +1,5 @@ import pytest +from tests.common.platform.interface_utils import get_port_map from tests.common.utilities import wait_until @pytest.fixture(scope="module", autouse=True) @@ -16,3 +17,15 @@ def pytest_addoption(parser): default=False, help="Set percentage difference for snmp test", type=int) + +@pytest.fixture(scope='function') +def skip_if_no_ports(duthosts, enum_rand_one_per_hwsku_frontend_hostname): + """ + Fixture that skips test execution in case dut doesn't have data ports + """ + duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] + for asic_index in duthost.get_frontend_asic_ids(): + interface_list = get_port_map(duthost, asic_index) + if not interface_list: + pytest.skip("This test is not supported as there are no data ports in dut") + diff --git a/tests/snmp/test_snmp_loopback.py b/tests/snmp/test_snmp_loopback.py index 1281f2d03d2..b677aa8309c 100644 --- a/tests/snmp/test_snmp_loopback.py +++ b/tests/snmp/test_snmp_loopback.py @@ -33,7 +33,7 @@ def get_snmp_output(ip, duthost, nbr, creds_all_duts): @pytest.mark.bsl -def test_snmp_loopback(duthosts, enum_rand_one_per_hwsku_frontend_hostname, nbrhosts, tbinfo, localhost, creds_all_duts): +def test_snmp_loopback(duthosts, enum_rand_one_per_hwsku_frontend_hostname, skip_if_no_ports, nbrhosts, tbinfo, localhost, creds_all_duts): """ Test SNMP query to DUT over loopback IP - Send SNMP query over loopback IP from one of the BGP Neighbors From b392c01cd1994507fcbe99d1eb7724249d976bb3 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 13 Jun 2021 10:43:00 +0300 Subject: [PATCH 09/16] tests fixes for zero ports setups Signed-off-by: Sharon Lutati --- tests/snmp/test_snmp_default_route.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/tests/snmp/test_snmp_default_route.py b/tests/snmp/test_snmp_default_route.py index 9fd35d5b45c..695d7973997 100644 --- a/tests/snmp/test_snmp_default_route.py +++ b/tests/snmp/test_snmp_default_route.py @@ -1,21 +1,10 @@ import pytest -from tests.common.platform.interface_utils import get_port_map pytestmark = [ pytest.mark.topology('any'), pytest.mark.device_type('vs') ] -@pytest.fixture(scope='function') -def skip_if_no_ports(duthosts, enum_rand_one_per_hwsku_frontend_hostname): - """ - Fixture that skips test execution in case dut doesn't have data ports - """ - duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] - for asic_index in duthost.get_frontend_asic_ids(): - interface_list = get_port_map(duthost, asic_index) - if not interface_list: - pytest.skip("This test is not supported as there are no data ports in dut") @pytest.mark.bsl def test_snmp_default_route(duthosts, enum_rand_one_per_hwsku_frontend_hostname, skip_if_no_ports, localhost, creds_all_duts): From 61d279860361a730df38b0c0b91b9427445f70ef Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Wed, 21 Jul 2021 17:22:58 +0300 Subject: [PATCH 10/16] use the ansible state module to check the existence of a file /etc/sonic/config_db.json --- tests/common/platform/interface_utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/common/platform/interface_utils.py b/tests/common/platform/interface_utils.py index 9afa6dd64da..5e3a3a350cf 100644 --- a/tests/common/platform/interface_utils.py +++ b/tests/common/platform/interface_utils.py @@ -1,6 +1,7 @@ """ Helper script for checking status of interfaces + This script contains re-usable functions for checking status of interfaces on SONiC. """ import json @@ -128,8 +129,7 @@ def get_port_map(dut, asic_index=None): return port_mapping_res -def validate_config_db_file_exist(dut): - config_db_location_cmd = "ls /etc/sonic/config_db.json" - config_db_location_string = dut.command(config_db_location_cmd)["stdout"] - if re.search("No such file or directory", config_db_location_string): - assert False, "No /etc/sonic/config_db.json found on dut - please load a valid config_db.json to switch" +def validate_config_db_file_exist(dut): + config_db_stat = dut.stat(path="/etc/sonic/config_db.json") + if not config_db_stat["stat"]["exists"]: + assert False, "No /etc/sonic/config_db.json found on dut - please load a valid config_db.json to switch" From 21048f5f74421a8345aeb804046ac1f1fd5693d2 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Wed, 21 Jul 2021 17:22:58 +0300 Subject: [PATCH 11/16] use the ansible state module to check the existence of a file /etc/sonic/config_db.json --- tests/common/platform/interface_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/platform/interface_utils.py b/tests/common/platform/interface_utils.py index 5e3a3a350cf..c478ca4ee99 100644 --- a/tests/common/platform/interface_utils.py +++ b/tests/common/platform/interface_utils.py @@ -132,4 +132,4 @@ def get_port_map(dut, asic_index=None): def validate_config_db_file_exist(dut): config_db_stat = dut.stat(path="/etc/sonic/config_db.json") if not config_db_stat["stat"]["exists"]: - assert False, "No /etc/sonic/config_db.json found on dut - please load a valid config_db.json to switch" + assert False, "No /etc/sonic/config_db.json found on dut - please load a valid config_db.json to switch" From bd46535db72df7a87977000e7bdd2bced96762de Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Wed, 21 Jul 2021 17:34:54 +0300 Subject: [PATCH 12/16] fix indentation From 4a3d8bbcd9013236fed8e92efb7d41eff77a9107 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Thu, 22 Jul 2021 09:26:48 +0300 Subject: [PATCH 13/16] remove HEAD markers from test_sfputil.py --- tests/platform_tests/sfp/test_sfputil.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/platform_tests/sfp/test_sfputil.py b/tests/platform_tests/sfp/test_sfputil.py index 8f95c28c944..15508306081 100644 --- a/tests/platform_tests/sfp/test_sfputil.py +++ b/tests/platform_tests/sfp/test_sfputil.py @@ -14,11 +14,8 @@ from util import parse_eeprom from util import parse_output from util import get_dev_conn -<<<<<<< HEAD from tests.common.platform.interface_utils import get_port_map, check_interface_status -======= from tests.common.utilities import skip_version ->>>>>>> 3403b65e0f19a8b4c33da737892af7b60ac0b1f4 cmd_sfp_presence = "sudo sfputil show presence" cmd_sfp_eeprom = "sudo sfputil show eeprom" From bc97af9a241559cdb46714519ec2da798ee740fc Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Tue, 17 Aug 2021 14:46:19 +0300 Subject: [PATCH 14/16] add skip_if_no_ports fixture back to test_snmp_default_route, it was removed by mistack- test shouldn't run on setup with no ports --- tests/snmp/test_snmp_default_route.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/snmp/test_snmp_default_route.py b/tests/snmp/test_snmp_default_route.py index 1bf1f8872bb..38ac92fb28c 100644 --- a/tests/snmp/test_snmp_default_route.py +++ b/tests/snmp/test_snmp_default_route.py @@ -10,7 +10,8 @@ @pytest.mark.bsl -def test_snmp_default_route(duthosts, enum_rand_one_per_hwsku_frontend_hostname, localhost, creds_all_duts, tbinfo): +def test_snmp_default_route(duthosts, enum_rand_one_per_hwsku_frontend_hostname, localhost, + creds_all_duts, tbinfo, skip_if_no_ports): """compare the snmp facts between observed states and target state""" duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] From 998955eb8fadbaa5119fc42032f5a6ca250a7832 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Wed, 18 Aug 2021 15:57:24 +0300 Subject: [PATCH 15/16] Adding a few more fixes to the tests Details: basing interfaces list on config_db (which is done by get_port_map) should be done in all cases not only where asic is not None. Also, added get_dev_conn to test_check_sfp_using_ethtool, as it is also used in that way in other sfp tests. --- .../mellanox/test_check_sfp_using_ethtool.py | 6 ++++-- tests/platform_tests/sfp/util.py | 9 +++------ tests/platform_tests/test_sequential_restart.py | 14 +++++--------- 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py b/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py index 8239a625132..ea6f87eec5c 100644 --- a/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py +++ b/tests/platform_tests/mellanox/test_check_sfp_using_ethtool.py @@ -8,6 +8,7 @@ import json import pytest from tests.common.fixtures.conn_graph_facts import conn_graph_facts +from tests.platform_tests.sfp.util import get_dev_conn from tests.common.platform.interface_utils import get_port_map, check_interface_status from tests.common.mellanox_data import SPC3_HWSKUS from check_hw_mgmt_service import check_hw_management_service @@ -18,12 +19,13 @@ ] -def test_check_sfp_using_ethtool(duthosts, rand_one_dut_hostname, conn_graph_facts, tbinfo): +def test_check_sfp_using_ethtool(duthosts, rand_one_dut_hostname, conn_graph_facts, tbinfo, enum_frontend_asic_index): """This test case is to check SFP using the ethtool. """ duthost = duthosts[rand_one_dut_hostname] ports_config = {} ports_config_output = duthost.command("sudo sonic-cfggen -d --var-json PORT")["stdout"] + portmap, dev_conn = get_dev_conn(duthost, conn_graph_facts, enum_frontend_asic_index) if ports_config_output: # in the case of zero ports the json output can be none ports_config = json.loads(ports_config_output) @@ -32,7 +34,7 @@ def test_check_sfp_using_ethtool(duthosts, rand_one_dut_hostname, conn_graph_fac lanes_divider = 8 else: lanes_divider = 4 - for intf in conn_graph_facts["device_conn"][duthost.hostname]: + for intf in dev_conn: intf_lanes = ports_config[intf]["lanes"] sfp_id = int(intf_lanes.split(",")[0])/lanes_divider + 1 diff --git a/tests/platform_tests/sfp/util.py b/tests/platform_tests/sfp/util.py index f0cc2b12e2e..7aeb7d3ca6d 100644 --- a/tests/platform_tests/sfp/util.py +++ b/tests/platform_tests/sfp/util.py @@ -33,15 +33,12 @@ def parse_eeprom(output_lines): def get_dev_conn(duthost, conn_graph_facts, asic_index): - dev_conn = conn_graph_facts["device_conn"][duthost.hostname] - # Get the interface pertaining to that asic portmap = get_port_map(duthost, asic_index) logging.info("Got portmap {}".format(portmap)) - if asic_index is not None: - # Check if the interfaces of this AISC is present in conn_graph_facts - dev_conn = {k: v for k, v in portmap.items() if k in conn_graph_facts["device_conn"][duthost.hostname]} - logging.info("ASIC {} interface_list {}".format(asic_index, dev_conn)) + # Check if the interfaces of this AISC is present in conn_graph_facts + dev_conn = {k: v for k, v in portmap.items() if k in conn_graph_facts["device_conn"][duthost.hostname]} + logging.info("ASIC {} interface_list {}".format(asic_index, dev_conn)) return portmap, dev_conn \ No newline at end of file diff --git a/tests/platform_tests/test_sequential_restart.py b/tests/platform_tests/test_sequential_restart.py index d8f03889c07..869e6ab684c 100644 --- a/tests/platform_tests/test_sequential_restart.py +++ b/tests/platform_tests/test_sequential_restart.py @@ -93,15 +93,11 @@ def test_restart_swss(duthosts, rand_one_dut_hostname, enum_frontend_asic_index, """ duthost = duthosts[rand_one_dut_hostname] all_interfaces = conn_graph_facts["device_conn"][duthost.hostname] - - if enum_frontend_asic_index is not None: - # Get the interface pertaining to that asic - interface_list = get_port_map(duthost, enum_frontend_asic_index) - - # Check if the interfaces of this AISC is present in conn_graph_facts - new_intf_dict = {k:v for k, v in interface_list.items() if k in all_interfaces} - all_interfaces = new_intf_dict - logging.info("ASIC {} interface_list {}".format(enum_frontend_asic_index, all_interfaces)) + interface_list = get_port_map(duthost, enum_frontend_asic_index) + # Check if the interfaces of this AISC is present in conn_graph_facts + new_intf_dict = {k:v for k, v in interface_list.items() if k in all_interfaces} + all_interfaces = new_intf_dict + logging.info("ASIC {} interface_list {}".format(enum_frontend_asic_index, all_interfaces)) restart_service_and_check(localhost, duthost, enum_frontend_asic_index, "swss", all_interfaces, xcvr_skip_list) From 74b9a83846900374433b67f18d7ba279c05cef92 Mon Sep 17 00:00:00 2001 From: Sharon Lutati Date: Sun, 12 Sep 2021 17:18:52 +0300 Subject: [PATCH 16/16] remove unused import statement --- tests/snmp/test_snmp_lldp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/snmp/test_snmp_lldp.py b/tests/snmp/test_snmp_lldp.py index 9c5e0e7e69f..55029b741ff 100644 --- a/tests/snmp/test_snmp_lldp.py +++ b/tests/snmp/test_snmp_lldp.py @@ -1,6 +1,5 @@ import pytest import re -from tests.common.helpers.snmp_helpers import get_snmp_facts pytestmark = [ pytest.mark.topology('any'),