Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/platform_tests/cli/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ def get_skip_mod_list(duthost, mod_key=None):
'psus':
- PSU4
- PSU5
'thermals':
- TEMPERATURE_INFO_2
@return a list of modules/peripherals to be skipped in check for platform test
"""

Expand Down
21 changes: 20 additions & 1 deletion tests/platform_tests/test_thermal_state_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import pytest
from tests.common.helpers.assertions import pytest_assert
from tests.platform_tests.cli.util import get_skip_mod_list

pytestmark = [
pytest.mark.topology('t2')
Expand Down Expand Up @@ -69,7 +70,8 @@ def test_thermal_state_db(duthosts, enum_rand_one_per_hwsku_hostname, tbinfo):
num_thermals = get_expected_num_thermals(duthosts, enum_rand_one_per_hwsku_hostname)
thermal_out = duthost.command("redis-dump -d 6 -y -k \"TEMP*\"")
out_dict = json.loads(thermal_out['stdout'])
pytest_assert(len(out_dict.keys()) == num_thermals, "number of thermal sensors incorrect expected {} but got {}".format(num_thermals, len(out_dict.keys())))
pytest_assert(len(out_dict.keys()) == num_thermals,
"num of thermal sensors incorrect expected {} but got {}".format(num_thermals, len(out_dict.keys())))
result = check_therm_data(out_dict)
pytest_assert(not result,
"Warning status incorrect for following thermal sensors:\n{}".format("\n".join(result)))
Expand All @@ -89,6 +91,23 @@ def test_thermal_global_state_db(duthosts, enum_supervisor_dut_hostname, tbinfo)
expected_num_thermals = get_expected_num_thermals(duthosts)
thermal_out = duthost.command("redis-dump -H {} -p 6380 -d 13 -y -k \"TEMP*\"".format(chassis_db_ip))
out_dict = json.loads(thermal_out['stdout'])
"""
For Logical Chassis we need to skip Thermal info from LCs that are physically there but logically
not part of this logical chassis. This can be found from the skip_module "thermals" list.
To handle logical chassis remove those known thermal info from the dictionary that was gathered from the
global state DB before continuing
"""
thermal_skip_list = get_skip_mod_list(duthost, ['thermals'])
for thermal in thermal_skip_list:
skip_thermal = duthost.command("redis-dump -H {} -p 6380 -d 13 -y -k \"{}|*\"".format(chassis_db_ip, thermal))
skip_dict = json.loads(skip_thermal['stdout'])
"""
delete all keys that we know should not be checked from the global dictionary
"""
for skip_sensor_key in skip_dict.keys():
if skip_sensor_key in out_dict.keys():
del out_dict[skip_sensor_key]

actual_num_thermal_sensors = len(out_dict.keys())
pytest_assert(actual_num_thermal_sensors == expected_num_thermals,
"got {} thermal sensors expected {}".format(actual_num_thermal_sensors, expected_num_thermals))
Expand Down