def test_thermals(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): duthost = duthosts[enum_rand_one_per_hwsku_hostname] try: num_thermals = int(chassis.get_num_thermals(platform_api_conn)) except: pytest.fail("num_thermals is not an integer") else: if num_thermals == 0: pytest.skip("No thermals found on device") if duthost.facts.get("chassis"): expected_num_thermals = len( duthost.facts.get("chassis").get('thermals')) pytest_assert( num_thermals == expected_num_thermals, "Number of thermals ({}) does not match expected number ({})". format(num_thermals, expected_num_thermals)) thermal_list = chassis.get_all_thermals(platform_api_conn) pytest_assert(thermal_list is not None, "Failed to retrieve thermals") pytest_assert( isinstance(thermal_list, list) and len(thermal_list) == num_thermals, "Thermals appear to be incorrect") for i in range(num_thermals): thermal = chassis.get_thermal(platform_api_conn, i) self.expect(thermal and thermal == thermal_list[i], "Thermal {} is incorrect".format(i)) self.assert_expectations()
def test_thermals(self, duthost, localhost, platform_api_conn): try: num_thermals = int(chassis.get_num_thermals(platform_api_conn)) except: pytest.fail("num_thermals is not an integer") if self.chassis_facts: expected_num_thermals = len(self.chassis_facts.get('thermals')) pytest_assert( num_thermals == expected_num_thermals, "Number of thermals ({}) does not match expected number ({})". format(num_thermals, expected_num_thermals)) thermal_list = chassis.get_all_thermals(platform_api_conn) pytest_assert(thermal_list is not None, "Failed to retrieve thermals") pytest_assert( isinstance(thermal_list, list) and len(thermal_list) == num_thermals, "Thermals appear to be incorrect") for i in range(num_thermals): thermal = chassis.get_thermal(platform_api_conn, i) self.expect(thermal and thermal == thermal_list[i], "Thermal {} is incorrect".format(i)) self.assert_expectations()
def test_thermals(self, duthost, localhost, platform_api_conn): # TODO: Ensure the number of thermals and that the returned list is correct for this platform try: num_thermals = int(chassis.get_num_thermals(platform_api_conn)) except: pytest.fail("num_thermals is not an integer") thermal_list = chassis.get_all_thermals(platform_api_conn) pytest_assert(thermal_list is not None, "Failed to retrieve thermals") pytest_assert( isinstance(thermal_list, list) and len(thermal_list) == num_thermals, "Thermals appear to be incorrect") for i in range(num_thermals): thermal = chassis.get_thermal(platform_api_conn, i) self.expect(thermal and thermal == thermal_list[i], "Thermal {} is incorrect".format(i)) self.assert_expectations()