def test_get_tx_power(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): # TODO: Do more sanity checking on the data we retrieve 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"]: tx_power = sfp.get_tx_power(platform_api_conn, i) if self.expect( tx_power is not None, "Unable to retrieve transceiver {} TX power data".format( i)): continue # Determine whether the transceiver type supports RX power # If the transceiver is non-optical, e.g., DAC, we should receive a list of "N/A" strings 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): self.expect( isinstance(tx_power, list) and (all(item == "N/A" for item in tx_power)), "Transceiver {} TX power data appears incorrect".format(i)) else: self.expect( isinstance(tx_power, list) and (all(isinstance(item, float) for item in tx_power)), "Transceiver {} TX power data appears incorrect".format(i)) self.assert_expectations()
def test_get_tx_power(self, duthost, localhost, platform_api_conn): # TODO: Do more sanity checking on the data we retrieve for i in range(self.num_sfps): tx_power = sfp.get_tx_power(platform_api_conn, i) if self.expect( tx_power is not None, "Unable to retrieve transceiver {} TX power data".format( i)): continue # Determine whether the transceiver type supports RX power # If the transceiver is non-optical, e.g., DAC, we should receive a list of "N/A" strings 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): self.expect( isinstance(tx_power, list) and (all(item == "N/A" for item in tx_power)), "Transceiver {} TX power data appears incorrect".format(i)) else: self.expect( isinstance(tx_power, list) and (all(isinstance(item, float) for item in tx_power)), "Transceiver {} TX power data appears incorrect".format(i)) self.assert_expectations()