def test_temperature(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): ''' PSU temperature test ''' for psu_id in range(self.num_psus): name = psu.get_name(platform_api_conn, psu_id) if name in self.psu_skip_list: logger.info("skipping check for {}".format(name)) else: temperature = psu.get_temperature(platform_api_conn, psu_id) if self.expect( temperature is not None, "Failed to retrieve temperature of PSU {}".format( psu_id)): self.expect( isinstance(temperature, float), "PSU {} temperature appears incorrect".format(psu_id)) temp_threshold = psu.get_temperature_high_threshold( platform_api_conn, psu_id) if self.expect( temp_threshold is not None, "Failed to retrieve temperature threshold of PSU {}". format(psu_id)): if self.expect( isinstance(temp_threshold, float), "PSU {} temperature high threshold appears incorrect" .format(psu_id)): self.expect( temperature < temp_threshold, "Temperature {} of PSU {} is over the threshold {}" .format(temperature, psu_id, temp_threshold)) self.assert_expectations()
def test_temperature(self, duthost, localhost, platform_api_conn): ''' PSU temperature test ''' for psu_id in range(self.num_psus): temperature = psu.get_temperature(platform_api_conn, psu_id) if self.expect( temperature is not None, "Failed to retrieve temperature of PSU {}".format(psu_id)): self.expect( isinstance(temperature, float), "PSU {} temperature appears incorrect".format(psu_id)) temp_threshold = psu.get_temperature_high_threshold( platform_api_conn, psu_id) if self.expect( temp_threshold is not None, "Failed to retrieve temperature threshold of PSU {}". format(psu_id)): if self.expect( isinstance(temp_threshold, float), "PSU {} temperature high threshold appears incorrect". format(psu_id)): self.expect( temperature < temp_threshold, "Temperature {} of PSU {} is over the threshold {}". format(temperature, psu_id, temp_threshold)) self.assert_expectations()
def test_temperature(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): ''' PSU temperature test ''' duthost = duthosts[enum_rand_one_per_hwsku_hostname] skip_release_for_platform(duthost, ["202012", "201911", "201811"], ["arista"]) psus_skipped = 0 for psu_id in range(self.num_psus): name = psu.get_name(platform_api_conn, psu_id) if name in self.psu_skip_list: logger.info("skipping check for {}".format(name)) else: temperature_supported = self.get_psu_facts( duthost, psu_id, True, "temperature") if not temperature_supported: logger.info( "test_set_fans_speed: Skipping chassis fan {} (speed not controllable)" .format(psu_id)) psus_skipped += 1 continue temperature = psu.get_temperature(platform_api_conn, psu_id) if self.expect( temperature is not None, "Failed to retrieve temperature of PSU {}".format( psu_id)): self.expect( isinstance(temperature, float), "PSU {} temperature appears incorrect".format(psu_id)) temp_threshold = psu.get_temperature_high_threshold( platform_api_conn, psu_id) if self.expect( temp_threshold is not None, "Failed to retrieve temperature threshold of PSU {}". format(psu_id)): if self.expect( isinstance(temp_threshold, float), "PSU {} temperature high threshold appears incorrect" .format(psu_id)): self.expect( temperature < temp_threshold, "Temperature {} of PSU {} is over the threshold {}" .format(temperature, psu_id, temp_threshold)) if psus_skipped == self.num_psus: pytest.skip( "skipped as all chassis psus' temperature sensor is not supported" ) self.assert_expectations()