def test_get_error_description(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): """This function tests get_error_description() API (supported on 202106 and above)""" skip_version(duthosts[enum_rand_one_per_hwsku_hostname], ["201811", "201911", "202012"]) for i in self.sfp_setup["sfp_test_port_indices"]: error_description = sfp.get_error_description(platform_api_conn, i) if self.expect( error_description is not None, "Unable to retrieve transceiver {} error description". format(i)): if "Not implemented" in error_description: pytest.skip( "get_error_description isn't implemented. Skip the test" ) if self.expect( isinstance(error_description, str) or isinstance(error_description, unicode), "Transceiver {} error description appears incorrect". format(i)): self.expect(error_description == "OK", "Transceiver {} is not present".format(i)) self.assert_expectations()
def test_check_sfputil_error_status(duthosts, enum_rand_one_per_hwsku_frontend_hostname, enum_frontend_asic_index, conn_graph_facts, cmd_sfp_error_status): """ @summary: Check SFP error status using 'sfputil show error-status' and 'sfputil show error-status --fetch-from-hardware' This feature is supported on 202106 and above @param: cmd_sfp_error_status: fixture representing the command used to test """ duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] skip_version(duthost, ["201811", "201911", "202012"]) portmap, dev_conn = get_dev_conn(duthost, conn_graph_facts, enum_frontend_asic_index) logging.info("Check output of '{}'".format(cmd_sfp_error_status)) sfp_error_status = duthost.command(cmd_sfp_error_status) for line in sfp_error_status["stdout_lines"][2:]: if "Not implemented" in line: pytest.skip("Skip test as error status isn't supported") parsed_presence = parse_output(sfp_error_status["stdout_lines"][2:]) for intf in dev_conn: assert intf in parsed_presence, "Interface is not in output of '{}'".format( cmd_sfp_presence) assert parsed_presence[ intf] == "OK", "Interface error status is not 'OK'"
def test_get_revision(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): duthost = duthosts[enum_rand_one_per_hwsku_hostname] skip_version(duthost, ["201811", "201911", "202012"]) for i in range(self.num_psus): revision = psu.get_revision(platform_api_conn, i) if self.expect(revision is not None, "Unable to retrieve PSU {} serial number".format(i)): self.expect(isinstance(revision, STRING_TYPE), "PSU {} serial number appears incorrect".format(i)) self.assert_expectations()
def test_get_revision(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): duthost = duthosts[enum_rand_one_per_hwsku_hostname] skip_version(duthost, ["201811", "201911", "202012"]) revision = chassis.get_revision(platform_api_conn) pytest_assert(revision is not None, "Unable to retrieve chassis serial number") pytest_assert(isinstance(revision, STRING_TYPE), "Chassis serial number appears incorrect")
def check_image_version(duthost): """Skips this test if the SONiC image installed on DUT is older than 202106 Args: duthost: Hostname of DUT. Returns: None. """ skip_version(duthost, ["201811", "201911", "202012"])
def testbed_params(duthosts, rand_one_dut_hostname, tbinfo): duthost = duthosts[rand_one_dut_hostname] skip_version(duthost, ["201811", "201911"]) mg_facts = duthost.get_extended_minigraph_facts(tbinfo) vlan_intf_name = mg_facts["minigraph_vlans"].keys()[0] vlan_member_ports = mg_facts["minigraph_vlans"][vlan_intf_name]["members"] vlan_member_ports_to_ptf_ports = { _: mg_facts["minigraph_ptf_indices"][_] for _ in vlan_member_ports } vlan_intf = [ _ for _ in mg_facts["minigraph_vlan_interfaces"] if _["attachto"] == vlan_intf_name and is_ipv4_address(_["addr"]) ][0] return vlan_intf, vlan_member_ports_to_ptf_ports