예제 #1
0
    def test_get_rx_power(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"])

        # TODO: Do more sanity checking on the data we retrieve
        # TODO: Should we should expect get_rx_power() to return None or a list of "N/A" strings
        # if the transceiver is non-optical, e.g., DAC
        for i in self.sfp_setup["sfp_test_port_indices"]:
            # Determine whether the transceiver type supports RX power
            info_dict = sfp.get_transceiver_info(platform_api_conn, i)
            if not self.expect(
                    info_dict is not None,
                    "Unable to retrieve transceiver {} info".format(i)):
                continue

            if not self.is_xcvr_optical(info_dict):
                logger.warning(
                    "test_get_rx_power: Skipping transceiver {} (not applicable for this transceiver type)"
                    .format(i))
                continue

            rx_power = sfp.get_rx_power(platform_api_conn, i)
            if self.expect(
                    rx_power is not None,
                    "Unable to retrieve transceiver {} RX power data".format(
                        i)):
                self.expect(
                    isinstance(rx_power, list)
                    and (all(isinstance(item, float) for item in rx_power)),
                    "Transceiver {} RX power data appears incorrect".format(i))
        self.assert_expectations()
예제 #2
0
    def test_get_rx_power(self, duthost, localhost, platform_api_conn):
        # TODO: Do more sanity checking on the data we retrieve
        # TODO: Should we should expect get_rx_power() to return None or a list of "N/A" strings
        # if the transceiver is non-optical, e.g., DAC
        for i in range(self.num_sfps):
            # Determine whether the transceiver type supports RX power
            info_dict = sfp.get_transceiver_info(platform_api_conn, i)
            if not self.expect(
                    info_dict is not None,
                    "Unable to retrieve transceiver {} info".format(i)):
                continue

            if not self.is_xcvr_optical(info_dict):
                logger.warning(
                    "test_get_rx_power: Skipping transceiver {} (not applicable for this transceiver type)"
                    .format(i))
                continue

            rx_power = sfp.get_rx_power(platform_api_conn, i)
            if self.expect(
                    rx_power is not None,
                    "Unable to retrieve transceiver {} RX power data".format(
                        i)):
                self.expect(
                    isinstance(rx_power, list)
                    and (all(isinstance(item, float) for item in rx_power)),
                    "Transceiver {} RX power data appears incorrect".format(i))
        self.assert_expectations()