Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thermal policy #2

Closed
wants to merge 14 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[sonic_platform]add get_name for fan and psu
Stephen Sun committed Nov 28, 2019
commit 25a3aef9dd32f0baaf739596eb7203fa77bcf27b
7 changes: 6 additions & 1 deletion platform/mellanox/mlnx-platform-api/sonic_platform/fan.py
Original file line number Diff line number Diff line change
@@ -38,17 +38,22 @@ def __init__(self, fan_index, drawer_index = 1, psu_fan = False):
self.fan_speed_set_path = "fan{}_speed_set".format(self.index)
self.fan_presence_path = "fan{}_status".format(self.drawer_index)
self.fan_max_speed_path = "fan{}_max".format(self.index)
self._name = "fan{}".format(fan_index + 1)
else:
self.fan_speed_get_path = "psu{}_fan1_speed_get".format(self.index)
self.fan_presence_path = "psu{}_fan1_speed_get".format(self.index)
self.fan_max_speed_path = "psu{}_max".format(self.index)
self._name = "fan(PSU{})".format(fan_index)
self.fan_status_path = "fan{}_fault".format(self.index)
self.fan_green_led_path = "led_fan{}_green".format(self.drawer_index)
self.fan_red_led_path = "led_fan{}_red".format(self.drawer_index)
self.fan_orange_led_path = "led_fan{}_orange".format(self.drawer_index)
self.fan_pwm_path = "pwm1"
self.fan_led_cap_path = "led_fan{}_capability".format(self.drawer_index)

def get_name(self):
return self._name

def get_status(self):
"""
Retrieves the operational status of fan
@@ -243,4 +248,4 @@ def get_speed_tolerance(self):
considered tolerable
"""
# The tolerance value is fixed as 20% for all the Mellanox platform
return 20
return 20
4 changes: 4 additions & 0 deletions platform/mellanox/mlnx-platform-api/sonic_platform/psu.py
Original file line number Diff line number Diff line change
@@ -60,6 +60,7 @@ def __init__(self, psu_index, sku):
psu_oper_status = "thermal/psu{}_pwr_status".format(self.index)
#psu_oper_status should always be present for all SKUs
self.psu_oper_status = os.path.join(self.psu_path, psu_oper_status)
self._name = "PSU{}".format(psu_index + 1)

if sku in hwsku_dict_psu:
filemap = psu_profile_list[hwsku_dict_psu[sku]]
@@ -94,6 +95,9 @@ def __init__(self, psu_index, sku):
if fan.get_presence():
self._fan_list.append(fan)

def get_name(self):
return self._name

def _read_generic_file(self, filename, len):
"""
Read a generic file, returns the contents of the file