[Mellanox] Add new thermal sensors for SN5600 (#12671)
- Why I did it Add new thermal sensors for SN5600 - How I did it Add new thermal sensors for SN5600: PCH and SODIMM - How to verify it Manual test
This commit is contained in:
parent
39ebf80f1b
commit
20d885dbc2
@ -167,6 +167,12 @@ DEVICE_DATA = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'x86_64-nvidia_sn5600-r0': {
|
'x86_64-nvidia_sn5600-r0': {
|
||||||
|
'thermal': {
|
||||||
|
"capability": {
|
||||||
|
"comex_amb": False,
|
||||||
|
"pch_temp": True
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,6 +231,11 @@ class DeviceDataManager:
|
|||||||
def get_cpu_thermal_count(cls):
|
def get_cpu_thermal_count(cls):
|
||||||
return len(glob.glob('run/hw-management/thermal/cpu_core[!_]'))
|
return len(glob.glob('run/hw-management/thermal/cpu_core[!_]'))
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@utils.read_only_cache()
|
||||||
|
def get_sodimm_thermal_count(cls):
|
||||||
|
return len(glob.glob('/run/hw-management/thermal/sodimm*_temp_input'))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@utils.read_only_cache()
|
@utils.read_only_cache()
|
||||||
def get_minimum_table(cls):
|
def get_minimum_table(cls):
|
||||||
|
@ -119,6 +119,18 @@ THERMAL_NAMING_RULE = {
|
|||||||
"name": "Ambient Switch Board Temp",
|
"name": "Ambient Switch Board Temp",
|
||||||
"temperature": "swb_amb",
|
"temperature": "swb_amb",
|
||||||
"default_present": False
|
"default_present": False
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "PCH Temp",
|
||||||
|
"temperature": "pch_temp",
|
||||||
|
"default_present": False
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "SODIMM {} Temp",
|
||||||
|
"temperature": "sodimm{}_temp_input",
|
||||||
|
"high_threshold": "sodimm{}_temp_max",
|
||||||
|
"high_critical_threshold": "sodimm{}_temp_crit",
|
||||||
|
"type": "indexable",
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
'linecard thermals': {
|
'linecard thermals': {
|
||||||
@ -161,6 +173,8 @@ def initialize_chassis_thermals():
|
|||||||
count = DeviceDataManager.get_gearbox_count('/run/hw-management/config')
|
count = DeviceDataManager.get_gearbox_count('/run/hw-management/config')
|
||||||
elif 'CPU Core' in rule['name']:
|
elif 'CPU Core' in rule['name']:
|
||||||
count = DeviceDataManager.get_cpu_thermal_count()
|
count = DeviceDataManager.get_cpu_thermal_count()
|
||||||
|
elif 'SODIMM' in rule['name']:
|
||||||
|
count = DeviceDataManager.get_sodimm_thermal_count()
|
||||||
if count == 0:
|
if count == 0:
|
||||||
logger.log_debug('Failed to get thermal object count for {}'.format(rule['name']))
|
logger.log_debug('Failed to get thermal object count for {}'.format(rule['name']))
|
||||||
continue
|
continue
|
||||||
@ -524,7 +538,7 @@ class Thermal(ThermalBase):
|
|||||||
else:
|
else:
|
||||||
cls.expect_cooling_state = None
|
cls.expect_cooling_state = None
|
||||||
|
|
||||||
|
|
||||||
class RemovableThermal(Thermal):
|
class RemovableThermal(Thermal):
|
||||||
def __init__(self, name, temp_file, high_th_file, high_crit_th_file, position, presence_cb):
|
def __init__(self, name, temp_file, high_th_file, high_crit_th_file, position, presence_cb):
|
||||||
super(RemovableThermal, self).__init__(name, temp_file, high_th_file, high_crit_th_file, position)
|
super(RemovableThermal, self).__init__(name, temp_file, high_th_file, high_crit_th_file, position)
|
||||||
|
@ -38,6 +38,7 @@ class TestThermal:
|
|||||||
@mock.patch('os.path.exists', mock.MagicMock(return_value=True))
|
@mock.patch('os.path.exists', mock.MagicMock(return_value=True))
|
||||||
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_gearbox_count', mock.MagicMock(return_value=2))
|
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_gearbox_count', mock.MagicMock(return_value=2))
|
||||||
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_cpu_thermal_count', mock.MagicMock(return_value=2))
|
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_cpu_thermal_count', mock.MagicMock(return_value=2))
|
||||||
|
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_sodimm_thermal_count', mock.MagicMock(return_value=2))
|
||||||
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_platform_name', mock.MagicMock(return_value='x86_64-mlnx_msn2700-r0'))
|
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_platform_name', mock.MagicMock(return_value='x86_64-mlnx_msn2700-r0'))
|
||||||
def test_chassis_thermal(self):
|
def test_chassis_thermal(self):
|
||||||
from sonic_platform.thermal import THERMAL_NAMING_RULE
|
from sonic_platform.thermal import THERMAL_NAMING_RULE
|
||||||
@ -48,6 +49,7 @@ class TestThermal:
|
|||||||
thermal_dict = {thermal.get_name(): thermal for thermal in thermal_list}
|
thermal_dict = {thermal.get_name(): thermal for thermal in thermal_list}
|
||||||
gearbox_thermal_rule = None
|
gearbox_thermal_rule = None
|
||||||
cpu_thermal_rule = None
|
cpu_thermal_rule = None
|
||||||
|
sodimm_thermal_rule = None
|
||||||
for rule in THERMAL_NAMING_RULE['chassis thermals']:
|
for rule in THERMAL_NAMING_RULE['chassis thermals']:
|
||||||
thermal_type = rule.get('type', 'single')
|
thermal_type = rule.get('type', 'single')
|
||||||
if thermal_type == 'single':
|
if thermal_type == 'single':
|
||||||
@ -69,9 +71,12 @@ class TestThermal:
|
|||||||
gearbox_thermal_rule = rule
|
gearbox_thermal_rule = rule
|
||||||
elif 'CPU Core' in rule['name']:
|
elif 'CPU Core' in rule['name']:
|
||||||
cpu_thermal_rule = rule
|
cpu_thermal_rule = rule
|
||||||
|
elif 'SODIMM' in rule['name']:
|
||||||
|
sodimm_thermal_rule = rule
|
||||||
|
|
||||||
gearbox_thermal_count = 0
|
gearbox_thermal_count = 0
|
||||||
cpu_thermal_count = 0
|
cpu_thermal_count = 0
|
||||||
|
sodimm_thermal_count = 0
|
||||||
for thermal in thermal_list:
|
for thermal in thermal_list:
|
||||||
if 'Gearbox' in thermal.get_name():
|
if 'Gearbox' in thermal.get_name():
|
||||||
start_index = gearbox_thermal_rule.get('start_index', 1)
|
start_index = gearbox_thermal_rule.get('start_index', 1)
|
||||||
@ -89,21 +94,32 @@ class TestThermal:
|
|||||||
assert cpu_thermal_rule['high_threshold'].format(start_index) in thermal.high_threshold
|
assert cpu_thermal_rule['high_threshold'].format(start_index) in thermal.high_threshold
|
||||||
assert cpu_thermal_rule['high_critical_threshold'].format(start_index) in thermal.high_critical_threshold
|
assert cpu_thermal_rule['high_critical_threshold'].format(start_index) in thermal.high_critical_threshold
|
||||||
cpu_thermal_count += 1
|
cpu_thermal_count += 1
|
||||||
|
elif 'SODIMM' in thermal.get_name():
|
||||||
|
start_index = sodimm_thermal_rule.get('start_index', 1)
|
||||||
|
start_index += sodimm_thermal_count
|
||||||
|
assert thermal.get_name() == sodimm_thermal_rule['name'].format(start_index)
|
||||||
|
assert sodimm_thermal_rule['temperature'].format(start_index) in thermal.temperature
|
||||||
|
assert sodimm_thermal_rule['high_threshold'].format(start_index) in thermal.high_threshold
|
||||||
|
assert sodimm_thermal_rule['high_critical_threshold'].format(start_index) in thermal.high_critical_threshold
|
||||||
|
sodimm_thermal_count += 1
|
||||||
|
|
||||||
assert gearbox_thermal_count == 2
|
assert gearbox_thermal_count == 2
|
||||||
assert cpu_thermal_count == 2
|
assert cpu_thermal_count == 2
|
||||||
|
assert sodimm_thermal_count == 2
|
||||||
|
|
||||||
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_platform_name', mock.MagicMock(return_value='x86_64-nvidia_sn2201-r0'))
|
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_platform_name', mock.MagicMock(return_value='x86_64-nvidia_sn2201-r0'))
|
||||||
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_thermal_capability', mock.MagicMock(return_value={'comex_amb': False, 'cpu_amb': True, 'swb_amb': True}))
|
@mock.patch('sonic_platform.device_data.DeviceDataManager.get_thermal_capability')
|
||||||
def test_chassis_thermal_includes(self):
|
def test_chassis_thermal_includes(self, mock_capability):
|
||||||
from sonic_platform.thermal import THERMAL_NAMING_RULE
|
from sonic_platform.thermal import THERMAL_NAMING_RULE
|
||||||
|
thermal_capability = {'comex_amb': False, 'cpu_amb': True, 'swb_amb': True}
|
||||||
|
mock_capability.return_value = thermal_capability
|
||||||
chassis = Chassis()
|
chassis = Chassis()
|
||||||
thermal_list = chassis.get_all_thermals()
|
thermal_list = chassis.get_all_thermals()
|
||||||
assert thermal_list
|
assert thermal_list
|
||||||
thermal_dict = {thermal.get_name(): thermal for thermal in thermal_list}
|
thermal_dict = {thermal.get_name(): thermal for thermal in thermal_list}
|
||||||
for rule in THERMAL_NAMING_RULE['chassis thermals']:
|
for rule in THERMAL_NAMING_RULE['chassis thermals']:
|
||||||
default_present = rule.get('default_present', True)
|
default_present = rule.get('default_present', True)
|
||||||
if not default_present:
|
if not default_present and thermal_capability.get(rule['temperature']):
|
||||||
thermal_name = rule['name']
|
thermal_name = rule['name']
|
||||||
assert thermal_name in thermal_dict
|
assert thermal_name in thermal_dict
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user