diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf index 92d742c1845..d3a0ab69b68 100644 --- a/device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn2010-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN2010 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf index 22b8e4dd8c7..bccc0854081 100644 --- a/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn2100-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN2100 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf index fa446832fef..47ed0e33b4f 100644 --- a/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn2410-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN2410 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors.json new file mode 100644 index 00000000000..983325f1e73 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors.json @@ -0,0 +1,418 @@ +{ + "platform": { + "MSN2410": { + "default": { + "bus": [ + "i2c-10", + "i2c-1-mux (chan_id 10)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN2700": { + "default": { + "bus": [ + "i2c-10", + "i2c-1-mux (chan_id 10)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN2700-A1": { + "default": { + "bus": [], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN2740": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN3420": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + } + }, + "MSN3700": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + }, + "respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + }, + "swb_respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + } + }, + "MSN3700C": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + }, + "respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + }, + "swb_respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1"], + "dps460-i2c-*-59": ["2"] + } + } + }, + "MSN3800": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2"], + "dps460-i2c-*-59": ["1"] + } + } + }, + "MSN4410": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + }, + "a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + } + }, + "MSN4600": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + } + }, + "MSN4600C": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + }, + "a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + }, + "respin": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["2", "R"], + "dps460-i2c-*-59": ["1", "L"] + } + }, + "respin_a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + } + }, + "MSN4700": { + "default": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + }, + "a1": { + "bus": [ + "i2c-4", + "i2c-1-mux (chan_id 3)" + ], + "chip": { + "dps460-i2c-*-58": ["1", "L"], + "dps460-i2c-*-59": ["2", "R"] + } + } + }, + "SN2201": { + "default": { + "bus": [ + "i2c-3", + "i2c-1-mux (chan_id 1)" + ], + "chip": { + "pmbus-i2c-3-58": ["1"], + "pmbus-i2c-4-58": ["2"] + } + } + }, + "SN5400": { + "default": { + "bus": [ + + ], + "chip": { + "dps460-i2c-*-59": ["1", "L"], + "dps460-i2c-*-5a": ["2", "R"] + } + } + }, + "SN5600": { + "default": { + "bus": [ + + ], + "chip": { + "dps460-i2c-*-59": ["1", "L"], + "dps460-i2c-*-5a": ["2", "R"] + } + } + } + }, + + "psu": { + "MTEF-AC-A": { + "label": [ + "in1 PSU 220V Rail (in)", + "in2 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ] + }, + "MTEF-AC-C": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2", + "fan2", + "fan3" + ], + "set": [ + "in3_lcrit in3_crit * 0.662", + "in3_min in3_crit * 0.745", + "in3_max in3_crit * 0.952" + ] + }, + "MTEF-AC-C-SS1": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2", + "fan2", + "fan3" + ], + "set": [ + "in3_lcrit in3_crit * 0.662", + "in3_min in3_crit * 0.745", + "in3_max in3_crit * 0.952" + ] + }, + "MTEF-AC-E": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ] + }, + "MTEF-AC-F": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "temp3 PSU Temp 3", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2" + ] + }, + "MTEF-AC-G-ACBEL": { + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ] + }, + "MTEF-AC-I": { + + }, + "MTEF-AC-M": { + "label": [ + "in1 PSU 220V Rail(in)", + "in2 PSU 12V Rail(out)", + "fan1 PSU Fan1", + "temp1 PSU Temp1", + "temp2 PSU Temp2", + "temp3 PSU Temp3", + "curr1 PSU 220V Rail Curr(in)", + "curr2 PSU 12V Rail Curr(out)", + "power1 PSU 220V Rail Pwr(in)", + "power2 PSU 12V Rail Pwr(out)" + ], + "ignore": [ + "in3", + "curr3", + "power3" + ] + }, + "930-9SPSU-00RA-00B" :{ + "label": [ + "in1 PSU 220V Rail (in)", + "in3 PSU 12V Rail (out)", + "fan1 PSU Fan 1", + "temp1 PSU Temp 1", + "temp2 PSU Temp 2", + "power1 PSU 220V Rail Pwr (in)", + "power2 PSU 12V Rail Pwr (out)", + "curr1 PSU 220V Rail Curr (in)", + "curr2 PSU 12V Rail Curr (out)" + ], + "ignore": [ + "in2" + ], + "set": [ + "power2_cap 0" + ] + } + } +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater new file mode 100644 index 00000000000..a548d7f985d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater @@ -0,0 +1,81 @@ +#!/bin/bash + +function update_psu_sensors_configuration() { + local SENSORS_CONFIG_FILE="/tmp/sensors.conf" + local PSU_SENSORS_CONFIG="/usr/share/sonic/platform/psu_sensors.json" + + if [ -f $SENSORS_CONFIG_FILE ]; then + rm $SENSORS_CONFIG_FILE + fi + + if [ -z "$1" ]; then + echo "psu_sensors_conf_updater ERROR: no sensors configuration file had been selected" + return + else + cp $1 $SENSORS_CONFIG_FILE + fi + + platform=$(jq -r '.chassis.name' /usr/share/sonic/platform/platform.json) + # built-in psu, no need for dynamic configruation + if [[ "$platform" == "MSN2100" || "$platform" == "MSN2010" ]]; then return; fi + # incase we don't have this platform's info + if [[ $(jq -r --arg platform "$platform" '.platform[$platform]' $PSU_SENSORS_CONFIG) == "null" ]]; then return; fi + + local rev=$(cat "$1" | grep "Hardware revision" | awk '{print $NF}') + # incase we don't find the revision number + if [ ! $rev ]; then return; fi + # incase we don't have that revision's data + if [[ $(jq -r --arg platform "$platform" --arg rev "$rev" '.platform[$platform][$rev]' $PSU_SENSORS_CONFIG) == "null" ]]; then return; fi + + start_marker_number=$(grep -n "Power supplies" $SENSORS_CONFIG_FILE | cut -f1 -d:) + end_marker_number=$(($(tail -n +$(($start_marker_number + 1)) $SENSORS_CONFIG_FILE | grep -n '^$' | head -n 1 | cut -d: -f1) + $start_marker_number)) + # In some cases, the PSU sensor section may be at the end of the file, + # so using grep alone may not match it. Let's set the end marker + # to the total number of lines in the file directly. + if [ "$end_marker_number" == "$start_marker_number" ]; then + end_marker_number=$(wc -l $SENSORS_CONFIG_FILE | cut -f1 -d' ') + fi + + sed -i "${start_marker_number},${end_marker_number}d" $SENSORS_CONFIG_FILE + + echo "" >> $SENSORS_CONFIG_FILE + echo "# Power supplies" >> $SENSORS_CONFIG_FILE + + bus=$(jq -r --arg platform "$platform" --arg rev "$rev" '.platform[$platform][$rev].bus | map("\"" + . + "\"") | join(" ")' $PSU_SENSORS_CONFIG) + if [ "$bus" ]; then echo "bus $bus" >> $SENSORS_CONFIG_FILE; fi + + mapfile -t chips < <(jq -r --arg platform "$platform" --arg rev "$rev" '.platform[$platform][$rev].chip | to_entries[] | .key' $PSU_SENSORS_CONFIG ) + + for chip in "${chips[@]}"; do + number=$(jq -r --arg platform "$platform" --arg rev "$rev" --arg chip "$chip" '.platform[$platform][$rev].chip[$chip] | to_entries | .[0].value' $PSU_SENSORS_CONFIG) + side=$(jq -r --arg platform "$platform" --arg rev "$rev" --arg chip "$chip" '.platform[$platform][$rev].chip[$chip] | to_entries | .[1].value' $PSU_SENSORS_CONFIG) + psu=$(cat /var/run/hw-management/eeprom/psu${number}_vpd | grep "PN_VPD_FIELD" | cut -d ' ' -f 2 2>&1) + if [ ! "$psu" ]; then + echo "psu_sensors_conf_updater ERROR: Failed to read from /var/run/hw-management/eeprom/psu${number}_vpd" + # keep looking for the rest psus + continue + else + if [ "$psu" == "MTEF-PSF-AC-G" ]; then + vendor=$(cat /var/run/hw-management/eeprom/psu${number}_vpd | grep "MFR_NAME:" | cut -d ' ' -f 2 2>&1) + psu="${psu}-${vendor}" + fi + psu=$(echo "$psu" | sed -r 's/-PSR|-PSF//g') + + echo " chip \""$chip"\"" >> $SENSORS_CONFIG_FILE + mapfile -t opers < <(jq -r --arg psu "$psu" '.psu[$psu] | keys[]' $PSU_SENSORS_CONFIG) + for oper in "${opers[@]}"; do + if [ "$oper" == "label" ]; then + section=$(jq -r --arg psu "$psu" --arg oper "$oper" '.psu[$psu][$oper] | map(" " + $oper + " " + . + "\"") | join("\n")' $PSU_SENSORS_CONFIG) + if [[ ! "$side" || "$side" == "null" ]]; then + echo "$section" | sed "s/PSU/\"PSU-$number/g" >> $SENSORS_CONFIG_FILE + else + echo "$section" | sed "s/PSU/\"PSU-$number($side)/g" >> $SENSORS_CONFIG_FILE + fi + else + jq -r --arg psu "$psu" --arg oper "$oper" '.psu[$psu][$oper] | map(" " + $oper + " " + .) | join("\n")' $PSU_SENSORS_CONFIG >> $SENSORS_CONFIG_FILE + fi + done + fi + done + +} diff --git a/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf index 8197e191b46..c04f4328dc2 100644 --- a/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn2700-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN2700 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 2)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2700a1-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2700a1-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2700a1-r0/sensors.conf index e8f5e156810..495627c1b38 100644 --- a/device/mellanox/x86_64-mlnx_msn2700a1-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn2700a1-r0/sensors.conf @@ -15,6 +15,8 @@ # limitations under the License. # +# Hardware revision default + # Bus names bus "i2c-17" "i2c-1-mux (chan_id 8)" diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf index 2e60f6b451e..80382cb836e 100644 --- a/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn2740-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN2740 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf index 83a5c7ce4c7..6880f21b101 100644 --- a/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3420-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN3420 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf index 37446268ada..e0a847aa350 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN3700 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_respin.conf b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_respin.conf index db5cd300929..81e22d59cc2 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_respin.conf +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_respin.conf @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision respin + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_swb_respin.conf b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_swb_respin.conf index 8c546c107cf..f5cf3d5df65 100644 --- a/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_swb_respin.conf +++ b/device/mellanox/x86_64-mlnx_msn3700-r0/sensors_swb_respin.conf @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision swb_respin + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf index ed6cebd1d10..b5105b871cf 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN3700C ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_respin.conf b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_respin.conf index fdc7bac3942..228c87fc1e1 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_respin.conf +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_respin.conf @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision respin + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_swb_respin.conf b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_swb_respin.conf index 2b0394f801f..ecc6ba13ccf 100644 --- a/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_swb_respin.conf +++ b/device/mellanox/x86_64-mlnx_msn3700c-r0/sensors_swb_respin.conf @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision swb_respin + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf index 5400269b32e..b40375a247d 100644 --- a/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn3800-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN3800 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4410-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn4600-r0/sensors.conf index 4c374a839be..a5b03ba372e 100644 --- a/device/mellanox/x86_64-mlnx_msn4600-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn4600-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN4600 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf index 4f60ceb0216..add442165a1 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN4600C ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 index 4200febc3d1..12f758a4334 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors.conf.a1 @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision a1 + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf index 0e346b31e28..b23cfc74bc5 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision respin + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf.a1 b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf.a1 index a959a7a2c3a..772cd455d14 100644 --- a/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf.a1 +++ b/device/mellanox/x86_64-mlnx_msn4600c-r0/sensors_respin.conf.a1 @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision respin_a1 + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors.json b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf index e4c6724b618..280118e43ef 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN4700 ################################################################################ +# Hardware revision default + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 index d609b4321ce..e85dca5aecb 100644 --- a/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 +++ b/device/mellanox/x86_64-mlnx_msn4700-r0/sensors.conf.a1 @@ -5,6 +5,8 @@ # Platform specific sensors config for SN4700 A0/A1 ################################################################################ +# Hardware revision a1 + # Temperature sensors bus "i2c-2" "i2c-1-mux (chan_id 1)" chip "mlxsw-i2c-*-48" diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors.json b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf b/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf index 5024abd7001..19624b1c92e 100644 --- a/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf +++ b/device/mellanox/x86_64-nvidia_sn2201-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN2201 ################################################################################ +# Hardware revision default + # Fan Controller emc2305. bus "i2c-7" "i2c-1-mux (chan_id 5)" chip "emc2305-i2c-7-4d" diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors.json b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn4800-r0/sensors.conf b/device/mellanox/x86_64-nvidia_sn4800-r0/sensors.conf index 3cf718641a8..669fbec4a89 100644 --- a/device/mellanox/x86_64-nvidia_sn4800-r0/sensors.conf +++ b/device/mellanox/x86_64-nvidia_sn4800-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN4800 ################################################################################ +# Hardware revision default + # Line card power manager devices (bus is variable) bus "i2c-59" "i2c-34-mux (chan_id 4)" chip "mp2975-i2c-59-62" diff --git a/device/mellanox/x86_64-nvidia_sn5400-r0/psu_sensors.json b/device/mellanox/x86_64-nvidia_sn5400-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5400-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5400-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-nvidia_sn5400-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5400-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5400-r0/sensors.conf b/device/mellanox/x86_64-nvidia_sn5400-r0/sensors.conf index e858a0311c0..0b2b7c9c7e4 100644 --- a/device/mellanox/x86_64-nvidia_sn5400-r0/sensors.conf +++ b/device/mellanox/x86_64-nvidia_sn5400-r0/sensors.conf @@ -15,6 +15,8 @@ ## limitations under the License. ## +# Hardware revision default + # Bus names bus "i2c-39" "i2c-1-mux (chan_id 6)" diff --git a/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors.json b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors.json new file mode 120000 index 00000000000..5816694317d --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors.json @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors.json \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors_conf_updater b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors_conf_updater new file mode 120000 index 00000000000..b9686d838e0 --- /dev/null +++ b/device/mellanox/x86_64-nvidia_sn5600-r0/psu_sensors_conf_updater @@ -0,0 +1 @@ +../x86_64-mlnx_msn2700-r0/psu_sensors_conf_updater \ No newline at end of file diff --git a/device/mellanox/x86_64-nvidia_sn5600-r0/sensors.conf b/device/mellanox/x86_64-nvidia_sn5600-r0/sensors.conf index e64aabae645..fdd642edc77 100644 --- a/device/mellanox/x86_64-nvidia_sn5600-r0/sensors.conf +++ b/device/mellanox/x86_64-nvidia_sn5600-r0/sensors.conf @@ -4,6 +4,8 @@ # Platform specific sensors config for SN5600 ################################################################################## +# Hardware revision default + # Bus names bus "i2c-39" "i2c-1-mux (chan_id 6)" diff --git a/dockers/docker-platform-monitor/docker_init.j2 b/dockers/docker-platform-monitor/docker_init.j2 index 46766b5fd17..0b344328cbb 100755 --- a/dockers/docker-platform-monitor/docker_init.j2 +++ b/dockers/docker-platform-monitor/docker_init.j2 @@ -94,6 +94,14 @@ fi if [ -e $SENSORS_CONF_FILE ]; then HAVE_SENSORS_CONF=1 mkdir -p /etc/sensors.d + PSU_SENSORS_CONF_UPDATER="/usr/share/sonic/platform/psu_sensors_conf_updater" + if [ -e $PSU_SENSORS_CONF_UPDATER ]; then + source $PSU_SENSORS_CONF_UPDATER + update_psu_sensors_configuration $SENSORS_CONF_FILE + if [ -f /tmp/sensors.conf ]; then + SENSORS_CONF_FILE="/tmp/sensors.conf" + fi + fi /bin/cp -f $SENSORS_CONF_FILE /etc/sensors.d/sensors.conf fi diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 7d4743879b9..b713b1a3c05 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -46,6 +46,7 @@ def __init__(self, psu_index): super(FixedPsu, self).__init__() self.index = psu_index + 1 self._name = "PSU {}".format(self.index) + self.model = 'N/A' self.psu_oper_status = os.path.join(PSU_PATH, "thermal/psu{}_pwr_status".format(self.index)) self._led = None @@ -256,6 +257,9 @@ def __init__(self, psu_index): from .thermal import initialize_psu_thermal self._thermal_list = initialize_psu_thermal(psu_index, self.get_power_available_status) + # initialize psu model + self.model = self.vpd_parser.get_model() + @property def psu_voltage(self): if not self._psu_voltage: @@ -304,7 +308,14 @@ def get_model(self): Returns: string: Model/part number of device """ - return self.vpd_parser.get_model() + current_model = self.vpd_parser.get_model() + if current_model != self.model and os.path.exists('/usr/share/sonic/platform/psu_sensors_conf_updater'): + utils.run_command(['cp', '-f', '/etc/sensors.d/sensors.conf', '/tmp/sensors.conf.orig']) + utils.run_command(['bash', '-c','source /usr/share/sonic/platform/psu_sensors_conf_updater && update_psu_sensors_configuration /tmp/sensors.conf.orig']) + utils.run_command(['cp', '-f', '/tmp/sensors.conf', '/etc/sensors.d/']) + utils.run_command(['service', 'sensord', 'restart']) + self.model = current_model + return current_model def get_serial(self): """