Skip to content

Commit

Permalink
[Mellanox] Add x86_64-mlnx_msn2700-r0 A1 support (sonic-net#9111)
Browse files Browse the repository at this point in the history
- What I did?
Add x86_64-mlnx_msn2700-r0 A1 support

- How I did?
Add sensor test for x86_64-mlnx_msn2700-r0 A1 version
Make test framework load the A1 platform.json
Make mock test load the A1 thermal profile

- How I test it?
Run regression on Mellanox platforms: 4700/4600C/3700/3700C/2700/2700 A1
  • Loading branch information
Junchao-Mellanox authored Dec 10, 2023
1 parent 1e8d71a commit a337ffa
Show file tree
Hide file tree
Showing 3 changed files with 300 additions and 35 deletions.
188 changes: 188 additions & 0 deletions ansible/group_vars/sonic/sku-sensors-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,194 @@ sensors_checks:
psu_skips: {}
sensor_skip_per_version: {}

x86_64-mlnx_msn2700a1-r0:
alarms:
fan:

- dps460-i2c-10-59/PSU-1(L) Fan 1/fan1_alarm
- dps460-i2c-10-59/PSU-1(L) Fan 1/fan1_fault

- dps460-i2c-10-58/PSU-2(R) Fan 1/fan1_alarm
- dps460-i2c-10-58/PSU-2(R) Fan 1/fan1_fault

- mlxreg_fan-isa-0000/Chassis Drawer-1 Fan-1/fan1_fault
- mlxreg_fan-isa-0000/Chassis Drawer-1 Fan-2/fan2_fault
- mlxreg_fan-isa-0000/Chassis Drawer-2 Fan-1/fan3_fault
- mlxreg_fan-isa-0000/Chassis Drawer-2 Fan-2/fan4_fault
- mlxreg_fan-isa-0000/Chassis Drawer-3 Fan-1/fan5_fault
- mlxreg_fan-isa-0000/Chassis Drawer-3 Fan-2/fan6_fault
- mlxreg_fan-isa-0000/Chassis Drawer-4 Fan-1/fan7_fault
- mlxreg_fan-isa-0000/Chassis Drawer-4 Fan-2/fan8_fault

power:

- pmbus-i2c-5-27/PMB-2 PSU 12V Rail (in)/in1_min_alarm
- pmbus-i2c-5-27/PMB-2 PSU 12V Rail (in)/in1_max_alarm
- pmbus-i2c-5-27/PMB-2 PSU 12V Rail (in)/in1_lcrit_alarm
- pmbus-i2c-5-27/PMB-2 PSU 12V Rail (in)/in1_crit_alarm
- pmbus-i2c-5-27/PMB-2 3.3V Rail (out)/in2_min_alarm
- pmbus-i2c-5-27/PMB-2 3.3V Rail (out)/in2_max_alarm
- pmbus-i2c-5-27/PMB-2 3.3V Rail (out)/in2_lcrit_alarm
- pmbus-i2c-5-27/PMB-2 3.3V Rail (out)/in2_crit_alarm
- pmbus-i2c-5-27/PMB-2 1.2V Rail (out)/in3_min_alarm
- pmbus-i2c-5-27/PMB-2 1.2V Rail (out)/in3_max_alarm
- pmbus-i2c-5-27/PMB-2 1.2V Rail (out)/in3_lcrit_alarm
- pmbus-i2c-5-27/PMB-2 1.2V Rail (out)/in3_crit_alarm
- pmbus-i2c-5-27/PMB-2 3.3V Rail Curr (out)/curr2_max_alarm
- pmbus-i2c-5-27/PMB-2 3.3V Rail Curr (out)/curr2_crit_alarm
- pmbus-i2c-5-27/PMB-2 1.2V Rail Curr (out)/curr3_max_alarm
- pmbus-i2c-5-27/PMB-2 1.2V Rail Curr (out)/curr3_crit_alarm

- mp2975-i2c-23-61/PMIC-4 PSU 12V Rail (in1)/in1_crit_alarm
- mp2975-i2c-23-61/PMIC-4 COMEX 1.2V Rail (out)/in2_lcrit_alarm
- mp2975-i2c-23-61/PMIC-4 COMEX 1.2V Rail (out)/in2_crit_alarm
- mp2975-i2c-23-61/PMIC-4 COMEX 12V Rail Pwr (in)/power1_alarm
- mp2975-i2c-23-61/PMIC-4 COMEX 12V Rail Curr (in)/curr1_alarm
- mp2975-i2c-23-61/PMIC-4 COMEX 1.2V Rail Curr (out)/curr2_alarm

- dps460-i2c-10-59/PSU-1(L) 12V Rail (out)/in2_lcrit_alarm
- dps460-i2c-10-59/PSU-1(L) 220V Rail Pwr (in)/power1_alarm
- dps460-i2c-10-59/PSU-1(L) 12V Rail Pwr (out)/power2_max_alarm
- dps460-i2c-10-59/PSU-1(L) 220V Rail Curr (in)/curr1_max_alarm
- dps460-i2c-10-59/PSU-1(L) 220V Rail Curr (in)/curr1_crit_alarm
- dps460-i2c-10-59/PSU-1(L) 12V Rail Curr (out)/curr2_max_alarm
- dps460-i2c-10-59/PSU-1(L) 12V Rail Curr (out)/curr2_crit_alarm

- pmbus-i2c-5-41/PMB-1 PSU 12V Rail (in)/in1_min_alarm
- pmbus-i2c-5-41/PMB-1 PSU 12V Rail (in)/in1_max_alarm
- pmbus-i2c-5-41/PMB-1 PSU 12V Rail (in)/in1_lcrit_alarm
- pmbus-i2c-5-41/PMB-1 PSU 12V Rail (in)/in1_crit_alarm
- pmbus-i2c-5-41/PMB-1 0.9V VCORE Rail (out)/in2_min_alarm
- pmbus-i2c-5-41/PMB-1 0.9V VCORE Rail (out)/in2_max_alarm
- pmbus-i2c-5-41/PMB-1 0.9V VCORE Rail (out)/in2_lcrit_alarm
- pmbus-i2c-5-41/PMB-1 0.9V VCORE Rail (out)/in2_crit_alarm
- pmbus-i2c-5-41/PMB-1 0.9V VCORE Rail Curr (out)/curr2_max_alarm
- pmbus-i2c-5-41/PMB-1 0.9V VCORE Rail Curr (out)/curr2_crit_alarm

- mp2975-i2c-23-6a/PMIC-3 PSU 12V Rail (in1)/in1_crit_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 1.8V Rail (out)/in2_lcrit_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 1.8V Rail (out)/in2_crit_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 1.05V Rail (out)/in3_lcrit_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 1.05V Rail (out)/in3_crit_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 12V Rail Pwr (in)/power1_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 12V Rail Curr (in)/curr1_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 1.8V Rail Curr (out)/curr2_alarm
- mp2975-i2c-23-6a/PMIC-3 COMEX 1.05V Rail Curr (out)/curr5_alarm

- dps460-i2c-10-58/PSU-2(R) 12V Rail (out)/in2_lcrit_alarm
- dps460-i2c-10-58/PSU-2(R) 220V Rail Pwr (in)/power1_alarm
- dps460-i2c-10-58/PSU-2(R) 12V Rail Pwr (out)/power2_max_alarm
- dps460-i2c-10-58/PSU-2(R) 220V Rail Curr (in)/curr1_max_alarm
- dps460-i2c-10-58/PSU-2(R) 220V Rail Curr (in)/curr1_crit_alarm
- dps460-i2c-10-58/PSU-2(R) 12V Rail Curr (out)/curr2_max_alarm
- dps460-i2c-10-58/PSU-2(R) 12V Rail Curr (out)/curr2_crit_alarm


temp:

- mlxsw-i2c-2-48/front panel 001/temp2_crit_alarm
- mlxsw-i2c-2-48/front panel 001/temp2_fault
- mlxsw-i2c-2-48/front panel 002/temp3_crit_alarm
- mlxsw-i2c-2-48/front panel 002/temp3_fault
- mlxsw-i2c-2-48/front panel 003/temp4_crit_alarm
- mlxsw-i2c-2-48/front panel 003/temp4_fault
- mlxsw-i2c-2-48/front panel 004/temp5_crit_alarm
- mlxsw-i2c-2-48/front panel 004/temp5_fault
- mlxsw-i2c-2-48/front panel 005/temp6_crit_alarm
- mlxsw-i2c-2-48/front panel 005/temp6_fault
- mlxsw-i2c-2-48/front panel 006/temp7_crit_alarm
- mlxsw-i2c-2-48/front panel 006/temp7_fault
- mlxsw-i2c-2-48/front panel 007/temp8_crit_alarm
- mlxsw-i2c-2-48/front panel 007/temp8_fault
- mlxsw-i2c-2-48/front panel 008/temp9_crit_alarm
- mlxsw-i2c-2-48/front panel 008/temp9_fault

- pmbus-i2c-5-27/PMB-2 Temp 1/temp1_max_alarm
- pmbus-i2c-5-27/PMB-2 Temp 1/temp1_crit_alarm
- pmbus-i2c-5-27/PMB-2 Temp 2/temp2_max_alarm
- pmbus-i2c-5-27/PMB-2 Temp 2/temp2_crit_alarm

- mp2975-i2c-23-61/PMIC-4 Temp 1/temp1_max_alarm
- mp2975-i2c-23-61/PMIC-4 Temp 1/temp1_crit_alarm

- dps460-i2c-10-59/PSU-1(L) Temp 1/temp1_max_alarm
- dps460-i2c-10-59/PSU-1(L) Temp 2/temp2_max_alarm

- coretemp-isa-0000/\P[a-z]*\ id 0/temp1_crit_alarm
- coretemp-isa-0000/Core 0/temp2_crit_alarm
- coretemp-isa-0000/Core 1/temp3_crit_alarm

- pmbus-i2c-5-41/PMB-1 Temp 1/temp1_max_alarm
- pmbus-i2c-5-41/PMB-1 Temp 1/temp1_crit_alarm
- pmbus-i2c-5-41/PMB-1 Temp 2/temp2_max_alarm
- pmbus-i2c-5-41/PMB-1 Temp 2/temp2_crit_alarm

- mp2975-i2c-23-6a/PMIC-3 Temp 1/temp1_max_alarm
- mp2975-i2c-23-6a/PMIC-3 Temp 1/temp1_crit_alarm

- dps460-i2c-10-58/PSU-2(R) Temp 1/temp1_max_alarm
- dps460-i2c-10-58/PSU-2(R) Temp 2/temp2_max_alarm


compares:
power: [ ]
temp:
- - pmbus-i2c-5-27/PMB-2 Temp 1/temp1_input
- pmbus-i2c-5-27/PMB-2 Temp 1/temp1_crit

- - pmbus-i2c-5-27/PMB-2 Temp 2/temp2_input
- pmbus-i2c-5-27/PMB-2 Temp 2/temp2_crit

- - mp2975-i2c-23-61/PMIC-4 Temp 1/temp1_input
- mp2975-i2c-23-61/PMIC-4 Temp 1/temp1_crit

- - lm75-i2c-7-4a/Ambient Port Temp/temp1_input
- lm75-i2c-7-4a/Ambient Port Temp/temp1_max

- - dps460-i2c-10-59/PSU-1(L) Temp 1/temp1_input
- dps460-i2c-10-59/PSU-1(L) Temp 1/temp1_max

- - dps460-i2c-10-59/PSU-1(L) Temp 2/temp2_input
- dps460-i2c-10-59/PSU-1(L) Temp 2/temp2_max

- - coretemp-isa-0000/\P[a-z]*\ id 0/temp1_input
- coretemp-isa-0000/\P[a-z]*\ id 0/temp1_crit

- - coretemp-isa-0000/Core 0/temp2_input
- coretemp-isa-0000/Core 0/temp2_crit

- - coretemp-isa-0000/Core 1/temp3_input
- coretemp-isa-0000/Core 1/temp3_crit

- - pmbus-i2c-5-41/PMB-1 Temp 1/temp1_input
- pmbus-i2c-5-41/PMB-1 Temp 1/temp1_crit

- - pmbus-i2c-5-41/PMB-1 Temp 2/temp2_input
- pmbus-i2c-5-41/PMB-1 Temp 2/temp2_crit

- - mp2975-i2c-23-6a/PMIC-3 Temp 1/temp1_input
- mp2975-i2c-23-6a/PMIC-3 Temp 1/temp1_crit

- - lm75-i2c-17-49/Ambient Board Temp/temp1_input
- lm75-i2c-17-49/Ambient Board Temp/temp1_max

- - tmp102-i2c-23-49/Ambient COMEX Temp/temp1_input
- tmp102-i2c-23-49/Ambient COMEX Temp/temp1_max

- - dps460-i2c-10-58/PSU-2(R) Temp 1/temp1_input
- dps460-i2c-10-58/PSU-2(R) Temp 1/temp1_max

- - dps460-i2c-10-58/PSU-2(R) Temp 2/temp2_input
- dps460-i2c-10-58/PSU-2(R) Temp 2/temp2_max


non_zero:
fan: [ ]
power: [ ]
temp: [ ]
psu_skips: { }
sensor_skip_per_version: { }

x86_64-mlnx_msn2740-r0:
alarms:
fan:
Expand Down
124 changes: 107 additions & 17 deletions tests/common/mellanox_data.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import functools


SPC1_HWSKUS = ["ACS-MSN2700", "Mellanox-SN2700", "Mellanox-SN2700-D48C8", "ACS-MSN2740", "ACS-MSN2100", "ACS-MSN2410",
"ACS-MSN2010", "ACS-SN2201"]
SPC2_HWSKUS = ["ACS-MSN3700", "ACS-MSN3700C", "ACS-MSN3800", "Mellanox-SN3800-D112C8", "ACS-MSN3420"]
Expand All @@ -13,6 +13,11 @@
['psu{}_curr', 'psu{}_curr_in', 'psu{}_power', 'psu{}_power_in', 'psu{}_volt', 'psu{}_volt_in', 'psu{}_volt_out'],
['psu{}_curr', 'psu{}_curr_in', 'psu{}_power', 'psu{}_power_in', 'psu{}_volt', 'psu{}_volt_in', 'psu{}_volt_out2']
]
MULTI_HARDWARE_TYPE_PLATFORMS = ['x86_64-mlnx_msn4700-r0',
'x86_64-mlnx_msn4410-r0',
'x86_64-mlnx_msn4600c-r0',
'x86_64-mlnx_msn3700-r0',
'x86_64-mlnx_msn3700c-r0']
SWITCH_MODELS = {
"x86_64-nvidia_sn5600-r0": {
"chip_type": "spectrum4",
Expand Down Expand Up @@ -191,6 +196,61 @@
}
}
},
"x86_64-mlnx_msn2700a1-r0": {
"chip_type": "spectrum1",
"reboot": {
"cold_reboot": True,
"fast_reboot": True,
"warm_reboot": True
},
"fans": {
"number": 4,
"hot_swappable": True
},
"psus": {
"number": 2,
"hot_swappable": True,
"capabilities": PSU_CAPABILITIES[0]
},
"cpu_pack": {
"number": 1
},
"cpu_cores": {
"number": 2
},
"ports": {
"number": 32
},
"thermals": {
"cpu_core": {
"start": 0,
"number": 2
},
"module": {
"start": 1,
"number": 32
},
"psu": {
"start": 1,
"number": 2
},
"cpu_pack": {
"number": 1
},
"asic_ambient": {
"number": 1
},
"port_ambient": {
"number": 1
},
"fan_ambient": {
"number": 1
},
"comex_ambient": {
"number": 1
}
}
},
"x86_64-mlnx_msn2740-r0": {
"chip_type": "spectrum1",
"reboot": {
Expand Down Expand Up @@ -886,10 +946,30 @@
}


def read_only_cache():
"""Decorator to cache return value for a method/function once.
This decorator should be used for method/function when:
1. Executing the method/function takes time. e.g. reading sysfs.
2. The return value of this method/function never changes.
"""
def decorator(method):
method.return_value = None

@functools.wraps(method)
def _impl(*args, **kwargs):
if not method.return_value:
method.return_value = method(*args, **kwargs)
return method.return_value
return _impl
return decorator


@read_only_cache()
def is_mellanox_device(dut):
return dut.facts["asic_type"] == "mellanox"


@read_only_cache()
def get_platform_data(dut):
"""
Get the platform physical data for the given dut object
Expand All @@ -905,22 +985,32 @@ def get_chip_type(dut):
return platform_data.get("chip_type")


def read_only_cache():
"""Decorator to cache return value for a method/function once.
This decorator should be used for method/function when:
1. Executing the method/function takes time. e.g. reading sysfs.
2. The return value of this method/function never changes.
"""
def decorator(method):
method.return_value = None

@functools.wraps(method)
def _impl(*args, **kwargs):
if not method.return_value:
method.return_value = method(*args, **kwargs)
return method.return_value
return _impl
return decorator
@read_only_cache()
def get_hardware_version(duthost, platform):
if platform in MULTI_HARDWARE_TYPE_PLATFORMS:
config1 = duthost.command('cat /run/hw-management/system/config1', module_ignore_errors=True)
config3 = duthost.command('cat /run/hw-management/system/config3', module_ignore_errors=True)
if platform in ('x86_64-mlnx_msn4700-r0', 'x86_64-mlnx_msn4410-r0'):
return 'a1' if config1['rc'] == 0 and config1['stdout'] == '1' else ''
elif platform == 'x86_64-mlnx_msn4600c-r0':
if config1['rc'] == 0:
if config1['stdout'] == '1':
if config3['rc'] == 0 and config3['stdout'] == '1':
return 'a1-respined'
else:
return 'a1'
else:
if config3['rc'] == 0 and config3['stdout'] == '1':
return 'respined'
return ''
elif platform in ('x86_64-mlnx_msn3700-r0', 'x86_64-mlnx_msn3700c-r0'):
if config1['rc'] == 0 and (config1['stdout'] == '2' or config1['stdout'] == '6'):
return 'swb-respined'
if config3['rc'] == 0 and config3['stdout'] == '1':
return 'respined'
return ''
else:
return ''


@read_only_cache()
Expand Down
23 changes: 5 additions & 18 deletions tests/platform_tests/test_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import yaml

from tests.common.helpers.assertions import pytest_assert
from tests.common import mellanox_data

pytestmark = [
pytest.mark.topology('any')
Expand All @@ -28,24 +29,10 @@ def test_sensors(duthosts, rand_one_dut_hostname, sensors_data):
# Get platform name
platform = duthost.facts['platform']

# Special treatment for Mellanox platforms which have two different A0 and A1 types
if platform in ['x86_64-mlnx_msn4700-r0', 'x86_64-mlnx_msn4410-r0', 'x86_64-mlnx_msn4600c-r0']:
# Check the hardware version and choose sensor conf data accordingly
output = duthost.command('cat /run/hw-management/system/config1', module_ignore_errors=True)
if output["rc"] == 0 and output["stdout"] == '1':
platform = platform + '-a1'

# Special treatment for Mellanox platforms which have multiple hardware sensors on the same platform
if platform in ['x86_64-mlnx_msn3700-r0', 'x86_64-mlnx_msn3700c-r0', 'x86_64-mlnx_msn4600c-r0',
'x86_64-mlnx_msn4600c-r0-a1']:
# Check the hardware version and choose sensor conf data accordingly
output = duthost.command('cat /run/hw-management/system/config3', module_ignore_errors=True)
if output["rc"] == 0 and output["stdout"] == '1':
platform = platform + '-respined'
if platform.strip('-respined') in ['x86_64-mlnx_msn3700-r0', 'x86_64-mlnx_msn3700c-r0']:
output = duthost.command('cat /run/hw-management/system/config1', module_ignore_errors=True)
if output["rc"] == 0 and (output["stdout"] == '2' or output["stdout"] == '6'):
platform = platform.strip('-respined') + '-swb-respined'
if mellanox_data.is_mellanox_device(duthost):
hardware_version = mellanox_data.get_hardware_version(duthost, platform)
if hardware_version:
platform = platform + '-' + hardware_version

# Prepare check list
sensors_checks = sensors_data['sensors_checks']
Expand Down

0 comments on commit a337ffa

Please sign in to comment.