[Mellanox] Include CPU board and switch board sensors only on SN2201 system (#9644)
Why I did it Recently additional sensors that were needed only for specific system added to all systems and caused errors. How I did it * Include CPU board and switch board sensors only on SN2201 system * Fix issue in test_chassis_thermal, now it skips non existing thermals. How to verify it Run show platform temperature Signed-off-by: liora <liora@nvidia.com>
This commit is contained in:
parent
3c5438de0b
commit
be065ff1cb
@ -157,7 +157,9 @@ DEVICE_DATA = {
|
||||
'x86_64-nvidia_sn2201-r0': {
|
||||
'thermal': {
|
||||
"capability": {
|
||||
"comex_amb": False
|
||||
"comex_amb": False,
|
||||
"cpu_amb": True,
|
||||
"swb_amb": True
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -112,11 +112,13 @@ THERMAL_NAMING_RULE = {
|
||||
},
|
||||
{
|
||||
"name": "Ambient CPU Board Temp",
|
||||
"temperature": "cpu_amb"
|
||||
"temperature": "cpu_amb",
|
||||
"default_present": False
|
||||
},
|
||||
{
|
||||
"name": "Ambient Switch Board Temp",
|
||||
"temperature": "swb_amb"
|
||||
"temperature": "swb_amb",
|
||||
"default_present": False
|
||||
}
|
||||
],
|
||||
'linecard thermals': {
|
||||
@ -226,10 +228,14 @@ def create_indexable_thermal(rule, index, sysfs_folder, position, presence_cb=No
|
||||
|
||||
def create_single_thermal(rule, sysfs_folder, position, presence_cb=None):
|
||||
temp_file = rule['temperature']
|
||||
default_present = rule.get('default_present', True)
|
||||
thermal_capability = DeviceDataManager.get_thermal_capability()
|
||||
|
||||
if thermal_capability:
|
||||
if not thermal_capability.get(temp_file, True):
|
||||
if not thermal_capability.get(temp_file, default_present):
|
||||
return None
|
||||
elif not default_present:
|
||||
return None
|
||||
|
||||
temp_file = os.path.join(sysfs_folder, temp_file)
|
||||
_check_thermal_sysfs_existence(temp_file)
|
||||
|
@ -51,6 +51,10 @@ class TestThermal:
|
||||
if rule['temperature'] == 'comex_amb':
|
||||
assert thermal_name not in thermal_dict
|
||||
continue
|
||||
default_present = rule.get('default_present', True)
|
||||
if not default_present:
|
||||
assert thermal_name not in thermal_dict
|
||||
continue
|
||||
assert thermal_name in thermal_dict
|
||||
thermal = thermal_dict[thermal_name]
|
||||
assert rule['temperature'] in thermal.temperature
|
||||
@ -85,6 +89,20 @@ class TestThermal:
|
||||
assert gearbox_thermal_count == 2
|
||||
assert cpu_thermal_count == 2
|
||||
|
||||
def test_chassis_thermal_includes(self):
|
||||
from sonic_platform.thermal import THERMAL_NAMING_RULE
|
||||
DeviceDataManager.get_platform_name = mock.MagicMock(return_value='x86_64-nvidia_sn2201-r0')
|
||||
DeviceDataManager.get_thermal_capability = mock.MagicMock(return_value={'comex_amb': False, 'cpu_amb': True, 'swb_amb': True})
|
||||
chassis = Chassis()
|
||||
thermal_list = chassis.get_all_thermals()
|
||||
assert thermal_list
|
||||
thermal_dict = {thermal.get_name(): thermal for thermal in thermal_list}
|
||||
for rule in THERMAL_NAMING_RULE['chassis thermals']:
|
||||
default_present = rule.get('default_present', True)
|
||||
if not default_present:
|
||||
thermal_name = rule['name']
|
||||
assert thermal_name in thermal_dict
|
||||
|
||||
def test_psu_thermal(self):
|
||||
from sonic_platform.thermal import initialize_psu_thermal, THERMAL_NAMING_RULE
|
||||
os.path.exists = mock.MagicMock(return_value=True)
|
||||
|
Loading…
Reference in New Issue
Block a user