diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 413eaee9bc5f..521183ca1f19 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -220,7 +220,7 @@ class Psu(FixedPsu): FAN_AMBIENT_TEMP = os.path.join(PSU_PATH, "thermal/fan_amb") AMBIENT_TEMP_CRITICAL_THRESHOLD = os.path.join(PSU_PATH, "config/amb_tmp_crit_limit") AMBIENT_TEMP_WARNING_THRESHOLD = os.path.join(PSU_PATH, "config/amb_tmp_warn_limit") - PSU_POWER_SLOPE = os.path.join(PSU_PATH, "config/psu_power_slope") + PSU_POWER_SLOPE = os.path.join(PSU_PATH, "config/psu{}_power_slope") shared_led = None @@ -245,6 +245,8 @@ def __init__(self, psu_index): self.psu_temp = os.path.join(PSU_PATH, 'thermal/psu{}_temp'.format(self.index)) self.psu_temp_threshold = os.path.join(PSU_PATH, 'thermal/psu{}_temp_max'.format(self.index)) + self.psu_power_slope = os.path.join(PSU_PATH, self.PSU_POWER_SLOPE.format(self.index)) + from .fan import PsuFan self._fan_list.append(PsuFan(psu_index, 1, self)) @@ -529,7 +531,7 @@ def _get_psu_power_threshold(self, temp_threshold_path): if ambient_temp < temp_threshold: power_threshold = power_max_capacity else: - slope = utils.read_int_from_file(Psu.PSU_POWER_SLOPE) + slope = utils.read_int_from_file(self.psu_power_slope) power_threshold = power_max_capacity - (ambient_temp - temp_threshold) * slope if power_threshold <= 0: logger.log_warning('Got negative PSU power threshold {} for {}'.format(power_threshold, self.get_name())) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_psu.py b/platform/mellanox/mlnx-platform-api/tests/test_psu.py index 7fff0d548216..00c3bc8623a7 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_psu.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_psu.py @@ -172,7 +172,7 @@ def test_psu_power_threshold(self, mock_read_int_from_file): psu.psu_power_max_capacity: 100000000, psu.AMBIENT_TEMP_CRITICAL_THRESHOLD: 65000, psu.AMBIENT_TEMP_WARNING_THRESHOLD: 55000, - psu.PSU_POWER_SLOPE: 2000 + psu.psu_power_slope: 2000 } normal_data = { psu.PORT_AMBIENT_TEMP: 55000,