Esempio n. 1
0
    def test_get_transceiver_bulk_status(self, duthosts,
                                         enum_rand_one_per_hwsku_hostname,
                                         localhost, platform_api_conn):
        duthost = duthosts[enum_rand_one_per_hwsku_hostname]
        skip_release_for_platform(duthost, ["202012"], ["arista", "mlnx"])

        for i in self.sfp_setup["sfp_test_port_indices"]:
            bulk_status_dict = sfp.get_transceiver_bulk_status(
                platform_api_conn, i)
            if self.expect(
                    bulk_status_dict is not None,
                    "Unable to retrieve transceiver {} bulk status".format(i)):
                if self.expect(
                        isinstance(bulk_status_dict, dict),
                        "Transceiver {} bulk status appears incorrect".format(
                            i)):
                    # TODO: This set of keys should be present no matter how many channels are present on the xcvr
                    #       If the xcvr has multiple channels, we should adjust the fields here accordingly
                    actual_keys = bulk_status_dict.keys()

                    missing_keys = set(
                        self.EXPECTED_XCVR_BULK_STATUS_KEYS) - set(actual_keys)
                    for key in missing_keys:
                        self.expect(
                            False,
                            "Transceiver {} bulk status does not contain field: '{}'"
                            .format(i, key))
        self.assert_expectations()
Esempio n. 2
0
    def test_get_transceiver_bulk_status(self, duthost, localhost, platform_api_conn):
        for i in range(self.num_sfps):
            bulk_status_dict = sfp.get_transceiver_bulk_status(platform_api_conn, i)
            if self.expect(bulk_status_dict is not None, "Unable to retrieve transceiver {} bulk status".format(i)):
                if self.expect(isinstance(bulk_status_dict, dict), "Transceiver {} bulk status appears incorrect".format(i)):
                    # TODO: This set of keys should be present no matter how many channels are present on the xcvr
                    #       If the xcvr has multiple channels, we should adjust the fields here accordingly
                    actual_keys = bulk_status_dict.keys()

                    missing_keys = set(self.EXPECTED_XCVR_BULK_STATUS_KEYS) - set(actual_keys)
                    for key in missing_keys:
                        self.expect(False, "Transceiver {} bulk status does not contain field: '{}'".format(i, key))
        self.assert_expectations()