From 9590339d69c7b83e409a4cfd513e21f88d85ea77 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox <57339448+Junchao-Mellanox@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:57:48 +0800 Subject: [PATCH] [Mellanox] Remove TODO comments which are no longer needed (#13023) - 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 --- .../sonic_platform/module.py | 10 +++---- .../mlnx-platform-api/sonic_platform/psu.py | 30 +++++++++---------- 2 files changed, 19 insertions(+), 21 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/module.py b/platform/mellanox/mlnx-platform-api/sonic_platform/module.py index 8cd6ffa9b8db..765314d7baf0 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/module.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/module.py @@ -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: @@ -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() @@ -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): """ @@ -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 @@ -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): """ diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py index 9ad97a688f83..413eaee9bc5f 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/psu.py @@ -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 @@ -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. """ @@ -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 @@ -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 @@ -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 @@ -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 @@ -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) @@ -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) @@ -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 " 4. Wait for it to take effect - + This issue is found on 3700, 3700c, 3800, 4600c """