Skip to content

Commit

Permalink
[Mellanox] Remove TODO comments which are no longer needed (#13023)
Browse files Browse the repository at this point in the history
- Why I did it
Remove TODO comments which are no longer needed

- How I did it
Remove TODO comments which are no longer needed

- How to verify it
Only comment change
  • Loading branch information
Junchao-Mellanox authored Dec 14, 2022
1 parent dfc73fc commit 9590339
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
10 changes: 5 additions & 5 deletions platform/mellanox/mlnx-platform-api/sonic_platform/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def get_position_in_parent(self):
def is_replaceable(self):
return True

def get_oper_status(self): # TODO: read from DB?
def get_oper_status(self):
if utils.read_int_from_file('/run/hw-management/system/lc{}_active'.format(self.slot_id)) == 1:
return ModuleBase.MODULE_STATUS_ONLINE
elif utils.read_int_from_file('/run/hw-management/system/lc{}_present'.format(self.slot_id)) == 1:
Expand All @@ -105,7 +105,7 @@ def get_oper_status(self): # TODO: read from DB?

def _check_state(self):
"""Check Module status change:
1. If status sysfs file value has been changed TODO: read from DB?
1. If status sysfs file value has been changed
2. If sequence NO has been changed which means line card has been removed and inserted again.
"""
seq_no = self._get_seq_no()
Expand Down Expand Up @@ -140,7 +140,7 @@ def initialize_thermals(self):
self._check_state()
if self.current_state == Module.STATE_ACTIVATED and not self._thermal_list:
from .thermal import initialize_linecard_thermals
self._thermal_list = initialize_linecard_thermals(self.get_name(), self.slot_id) # TODO: add presence_cb?
self._thermal_list = initialize_linecard_thermals(self.get_name(), self.slot_id)

def get_num_thermals(self):
"""
Expand Down Expand Up @@ -192,7 +192,7 @@ def initialize_single_sfp(self, index):
if index < sfp_count:
if not self._sfp_list:
self._sfp_list = [None] * sfp_count

if not self._sfp_list[index]:
self._sfp_list[index] = self._create_sfp_object(index)
self.sfp_initialized_count += 1
Expand Down Expand Up @@ -220,7 +220,7 @@ def get_num_sfps(self):
"""
if self.sfp_count == 0:
self.sfp_count = DeviceDataManager.get_linecard_sfp_count(self.slot_id)
return self.sfp_count
return self.sfp_count

def get_all_sfps(self):
"""
Expand Down
30 changes: 14 additions & 16 deletions platform/mellanox/mlnx-platform-api/sonic_platform/psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ def get_voltage(self):
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
A float number, the output voltage in volts,
e.g. 12.1
"""
return None

Expand Down Expand Up @@ -143,7 +143,7 @@ def get_power_available_status(self):
Gets the power available status
Returns:
True if power is present and power on.
True if power is present and power on.
False and "absence of PSU" if power is not present.
False and "absence of power" if power is present but not power on.
"""
Expand Down Expand Up @@ -176,7 +176,7 @@ def get_temperature(self):
Returns:
A float number of current temperature in Celsius up to nearest thousandth
of one degree Celsius, e.g. 30.125
of one degree Celsius, e.g. 30.125
"""
return None

Expand All @@ -195,8 +195,8 @@ def get_input_voltage(self):
Retrieves current PSU voltage input
Returns:
A float number, the input voltage in volts,
e.g. 12.1
A float number, the input voltage in volts,
e.g. 12.1
"""
return None

Expand Down Expand Up @@ -264,7 +264,7 @@ def psu_voltage(self):
psu_voltage_out = os.path.join(PSU_PATH, "power/psu{}_volt".format(self.index))
if os.path.exists(psu_voltage_out):
self._psu_voltage = psu_voltage_out

return self._psu_voltage

@property
Expand Down Expand Up @@ -336,12 +336,10 @@ def get_voltage(self):
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
A float number, the output voltage in volts,
e.g. 12.1
"""
if self.get_powergood_status() and self.psu_voltage:
# TODO: should we put log_func=None here? If not do this, when a PSU is back to power, some PSU related
# sysfs may not ready, read_int_from_file would encounter exception and log an error.
voltage = utils.read_int_from_file(self.psu_voltage, log_func=logger.log_info)
return float(voltage) / 1000
return None
Expand Down Expand Up @@ -405,7 +403,7 @@ def get_temperature(self):
Returns:
A float number of current temperature in Celsius up to nearest thousandth
of one degree Celsius, e.g. 30.125
of one degree Celsius, e.g. 30.125
"""
if self.get_powergood_status():
temp = utils.read_int_from_file(self.psu_temp, log_func=logger.log_info)
Expand Down Expand Up @@ -492,8 +490,8 @@ def get_input_voltage(self):
Retrieves current PSU voltage input
Returns:
A float number, the input voltage in volts,
e.g. 12.1
A float number, the input voltage in volts,
e.g. 12.1
"""
if self.get_powergood_status():
voltage = utils.read_int_from_file(self.psu_voltage_in, log_func=logger.log_info)
Expand Down Expand Up @@ -563,13 +561,13 @@ def get_psu_power_critical_threshold(self):


class InvalidPsuVolWA:
"""This class is created as a workaround for a known hardware issue that the PSU voltage threshold could be a
"""This class is created as a workaround for a known hardware issue that the PSU voltage threshold could be a
invalid value 127998. Once we read a voltage threshold value equal to 127998, we should do following:
1. Check the PSU vendor, it should be Delta
2. Generate a temp sensor configuration file which contains a few set commands. Those set commands are the WA provided by low level team.
3. Call "sensors -s -c <tmp_conf_file>"
4. Wait for it to take effect
This issue is found on 3700, 3700c, 3800, 4600c
"""

Expand Down

0 comments on commit 9590339

Please sign in to comment.