From ae59be02cbaccd0cd40b9c42025dad7c0c6e4722 Mon Sep 17 00:00:00 2001 From: Andrew Sapronov Date: Tue, 23 Nov 2021 15:21:24 +0300 Subject: [PATCH] [Netberg][nb-inno] Removed some spaces, unused imports and variables --- .../aurora-615/sonic_platform/chassis.py | 6 +- .../aurora-615/sonic_platform/fan_drawer.py | 1 - .../aurora-615/sonic_platform/platDev.py | 76 +++++++++---------- .../aurora-615/sonic_platform/psu.py | 14 ++-- .../aurora-715/sonic_platform/chassis.py | 5 +- .../aurora-715/sonic_platform/fan_drawer.py | 1 - .../aurora-715/sonic_platform/platDev.py | 3 - .../aurora-715/sonic_platform/psu.py | 14 ++-- 8 files changed, 56 insertions(+), 64 deletions(-) diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/chassis.py b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/chassis.py index 141707cd62c9..f618860832e8 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/chassis.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/chassis.py @@ -11,7 +11,6 @@ import subprocess from sonic_platform_base.chassis_base import ChassisBase from sonic_platform.platDev import PlatDev - from sonic_platform.fan import Fan from sonic_platform.fan_drawer import FanDrawer from sonic_platform.psu import Psu from sonic_platform.sfp import Sfp @@ -61,7 +60,8 @@ def __init__(self): fanlist = self.platdev.get_fan_list() for index in range(0, len(fanlist)): fan_name = fanlist[index] - fandrawer = FanDrawer(index,self.platdev.get_fan_num_by_name(fan_name),[self.platdev.get_fan_sysfile_path_by_name(fan_name),'']) + fandrawer = FanDrawer(index, self.platdev.get_fan_num_by_name(fan_name), [ + self.platdev.get_fan_sysfile_path_by_name(fan_name), '']) self._fan_drawer_list.append(fandrawer) self._fan_list.extend(fandrawer._fan_list) @@ -74,7 +74,7 @@ def __init__(self): # init thermal list thermal_info_list = self.platdev.get_thermal_dev_info_all() - + for index in range(0, len(thermal_info_list)): if len(self.platdev.get_thermal_dev_tempidx_by_idx(index)) > 1: for idx in self.platdev.get_thermal_dev_tempidx_by_idx(index): diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/fan_drawer.py b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/fan_drawer.py index 49778ae96d48..9138a472100f 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/fan_drawer.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/fan_drawer.py @@ -9,7 +9,6 @@ class FanDrawer(FanDrawerBase): """ Platform-specific Fan class""" def __init__(self, fantray_index, nums, attr_path): - FanDrawerBase.__init__(self) self.fantrayindex = fantray_index for i in range(nums): diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/platDev.py b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/platDev.py index d39fe66860f1..f092b3999460 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/platDev.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/platDev.py @@ -6,9 +6,7 @@ except ImportError as e: raise ImportError(str(e) + "- required module not found") -logger = Logger("paltDev") -PLATFORM_INSTALL_INFO_FILE = "/etc/sonic/platform_install.json" -PLATFORM_NAME = "aurora_615" +logger = Logger("platDev") MAX_FAN_MODULE = 5 MAX_FAN = 2 @@ -149,104 +147,103 @@ # SFP-eeprom paths /sys/bus/i2c/devices/XX-0050 SFP_GROUPS = { - 'SFP-G01' :{ + 'SFP-G01': { "type": "SFP+", 'number': 8, - 'parent':'PCA9548_0x71_1', - 'channels':[0,1,2,3,4,5,6,7], - 'driver':'optoe2', + 'parent': 'PCA9548_0x71_1', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe2', 'i2caddr': '0x50', 'paths': ["/sys/bus/i2c/devices/9-0050", "/sys/bus/i2c/devices/10-0050", "/sys/bus/i2c/devices/11-0050", "/sys/bus/i2c/devices/12-0050", "/sys/bus/i2c/devices/13-0050", "/sys/bus/i2c/devices/14-0050", "/sys/bus/i2c/devices/15-0050", "/sys/bus/i2c/devices/16-0050"], - 'status':'NOTINST' + 'status': 'NOTINST' }, - 'SFP-G02' :{ + 'SFP-G02': { "type": "SFP+", 'number': 8, - 'parent':'PCA9548_0x71_2', - 'channels':[0,1,2,3,4,5,6,7], - 'driver':'optoe2', + 'parent': 'PCA9548_0x71_2', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe2', 'i2caddr': '0x50', 'paths': ["/sys/bus/i2c/devices/17-0050", "/sys/bus/i2c/devices/18-0050", "/sys/bus/i2c/devices/19-0050", "/sys/bus/i2c/devices/20-0050", "/sys/bus/i2c/devices/21-0050", "/sys/bus/i2c/devices/22-0050", "/sys/bus/i2c/devices/23-0050", "/sys/bus/i2c/devices/24-0050"], - 'status':'NOTINST' + 'status': 'NOTINST' }, - 'SFP-G03' :{ + 'SFP-G03': { "type": "SFP+", 'number': 8, - 'parent':'PCA9548_0x71_3', - 'channels':[0,1,2,3,4,5,6,7], - 'driver':'optoe2', + 'parent': 'PCA9548_0x71_3', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe2', 'i2caddr': '0x50', 'paths': ["/sys/bus/i2c/devices/25-0050", "/sys/bus/i2c/devices/26-0050", "/sys/bus/i2c/devices/27-0050", "/sys/bus/i2c/devices/28-0050", "/sys/bus/i2c/devices/29-0050", "/sys/bus/i2c/devices/30-0050", "/sys/bus/i2c/devices/31-0050", "/sys/bus/i2c/devices/32-0050"], - 'status':'NOTINST' + 'status': 'NOTINST' }, - 'SFP-G04' :{ + 'SFP-G04': { "type": "SFP+", 'number': 8, - 'parent':'PCA9548_0x71_4', - 'channels':[0,1,2,3,4,5,6,7], - 'driver':'optoe2', + 'parent': 'PCA9548_0x71_4', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe2', 'i2caddr': '0x50', 'paths': ["/sys/bus/i2c/devices/33-0050", "/sys/bus/i2c/devices/34-0050", "/sys/bus/i2c/devices/35-0050", "/sys/bus/i2c/devices/36-0050", "/sys/bus/i2c/devices/37-0050", "/sys/bus/i2c/devices/38-0050", "/sys/bus/i2c/devices/39-0050", "/sys/bus/i2c/devices/40-0050"], - 'status':'NOTINST' + 'status': 'NOTINST' }, - 'SFP-G05' :{ + 'SFP-G05': { "type": "SFP+", 'number': 8, - 'parent':'PCA9548_0x71_5', - 'channels':[0,1,2,3,4,5,6,7], - 'driver':'optoe2', + 'parent': 'PCA9548_0x71_5', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe2', 'i2caddr': '0x50', 'paths': ["/sys/bus/i2c/devices/41-0050", "/sys/bus/i2c/devices/42-0050", "/sys/bus/i2c/devices/43-0050", "/sys/bus/i2c/devices/44-0050", "/sys/bus/i2c/devices/45-0050", "/sys/bus/i2c/devices/46-0050", "/sys/bus/i2c/devices/47-0050", "/sys/bus/i2c/devices/48-0050"], - 'status':'NOTINST' + 'status': 'NOTINST' }, - 'SFP-G06' :{ + 'SFP-G06': { "type": "SFP+", 'number': 8, - 'parent':'PCA9548_0x71_6', - 'channels':[0,1,2,3,4,5,6,7], - 'driver':'optoe2', + 'parent': 'PCA9548_0x71_6', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe2', 'i2caddr': '0x50', 'paths': ["/sys/bus/i2c/devices/49-0050", "/sys/bus/i2c/devices/50-0050", "/sys/bus/i2c/devices/51-0050", "/sys/bus/i2c/devices/52-0050", "/sys/bus/i2c/devices/53-0050", "/sys/bus/i2c/devices/54-0050", "/sys/bus/i2c/devices/55-0050", "/sys/bus/i2c/devices/56-0050"], - 'status':'NOTINST' + 'status': 'NOTINST' }, - 'SFP-G07' :{ + 'SFP-G07': { "type": "QSFP28", 'number': 8, - 'parent':'PCA9548_0x71_7', - 'channels':[0,1,2,3,4,5,6,7], - 'driver':'optoe1', + 'parent': 'PCA9548_0x71_7', + 'channels': [0, 1, 2, 3, 4, 5, 6, 7], + 'driver': 'optoe1', 'i2caddr': '0x50', 'paths': ["/sys/bus/i2c/devices/57-0050", "/sys/bus/i2c/devices/58-0050", "/sys/bus/i2c/devices/59-0050", "/sys/bus/i2c/devices/60-0050", "/sys/bus/i2c/devices/61-0050", "/sys/bus/i2c/devices/62-0050", "/sys/bus/i2c/devices/63-0050", "/sys/bus/i2c/devices/64-0050"], - 'status':'NOTINST' + 'status': 'NOTINST' } } -# # Component # ["Master-CPLD", ("Used for managing Fan, PSU, system LEDs, QSFP " # "modules (1-16)")], @@ -261,7 +258,6 @@ class PlatDev(): def __init__(self): - self.plat_name = PLATFORM_NAME self.psu_info = copy.deepcopy(PSU_INFO) self.fan_info = copy.deepcopy(FAN_INFO) self.sfp_info = copy.deepcopy(SFP_GROUPS) diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/psu.py b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/psu.py index e2a636266664..2fe7235817d5 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/psu.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-615/sonic_platform/psu.py @@ -81,8 +81,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 """ path = self.attr_path + 'psu{}_vout'.format(self.index+1) @@ -141,7 +141,7 @@ def get_temperature(self): Retrieves current temperature reading from PSU 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 """ path = self.attr_path+'psu{}_temp'.format(self.index+1) temperature = self.__read_attr_file(path, 0) @@ -163,8 +163,8 @@ def get_voltage_high_threshold(self): """ Retrieves the high threshold PSU voltage output Returns: - A float number, the high threshold output voltage in volts, - e.g. 12.1 + A float number, the high threshold output voltage in volts, + e.g. 12.1 """ return PSU_MAX_VOUT @@ -172,7 +172,7 @@ def get_voltage_low_threshold(self): """ Retrieves the low threshold PSU voltage output Returns: - A float number, the low threshold output voltage in volts, - e.g. 12.1 + A float number, the low threshold output voltage in volts, + e.g. 12.1 """ return PSU_MIN_VOUT diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/chassis.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/chassis.py index 141707cd62c9..4df422a2b015 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/chassis.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/chassis.py @@ -61,7 +61,8 @@ def __init__(self): fanlist = self.platdev.get_fan_list() for index in range(0, len(fanlist)): fan_name = fanlist[index] - fandrawer = FanDrawer(index,self.platdev.get_fan_num_by_name(fan_name),[self.platdev.get_fan_sysfile_path_by_name(fan_name),'']) + fandrawer = FanDrawer(index, self.platdev.get_fan_num_by_name(fan_name), [ + self.platdev.get_fan_sysfile_path_by_name(fan_name), '']) self._fan_drawer_list.append(fandrawer) self._fan_list.extend(fandrawer._fan_list) @@ -74,7 +75,7 @@ def __init__(self): # init thermal list thermal_info_list = self.platdev.get_thermal_dev_info_all() - + for index in range(0, len(thermal_info_list)): if len(self.platdev.get_thermal_dev_tempidx_by_idx(index)) > 1: for idx in self.platdev.get_thermal_dev_tempidx_by_idx(index): diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/fan_drawer.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/fan_drawer.py index 49778ae96d48..9138a472100f 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/fan_drawer.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/fan_drawer.py @@ -9,7 +9,6 @@ class FanDrawer(FanDrawerBase): """ Platform-specific Fan class""" def __init__(self, fantray_index, nums, attr_path): - FanDrawerBase.__init__(self) self.fantrayindex = fantray_index for i in range(nums): diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platDev.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platDev.py index a7886861a94a..5e72199cb096 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platDev.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/platDev.py @@ -1,14 +1,12 @@ #!/usr/bin/env python try: - import os import copy from sonic_py_common.logger import Logger except ImportError as e: raise ImportError(str(e) + "- required module not found") logger = Logger("platDev") -PLATFORM_NAME = "aurora-715" MAX_FAN_MODULE = 5 MAX_FAN = 2 @@ -216,7 +214,6 @@ class PlatDev(): def __init__(self): - self.plat_name = PLATFORM_NAME self.psu_info = copy.deepcopy(PSU_INFO) self.fan_info = copy.deepcopy(FAN_INFO) self.sfp_info = copy.deepcopy(SFP_GROUPS) diff --git a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/psu.py b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/psu.py index e2a636266664..2fe7235817d5 100644 --- a/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/psu.py +++ b/platform/innovium/sonic-platform-modules-netberg/aurora-715/sonic_platform/psu.py @@ -81,8 +81,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 """ path = self.attr_path + 'psu{}_vout'.format(self.index+1) @@ -141,7 +141,7 @@ def get_temperature(self): Retrieves current temperature reading from PSU 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 """ path = self.attr_path+'psu{}_temp'.format(self.index+1) temperature = self.__read_attr_file(path, 0) @@ -163,8 +163,8 @@ def get_voltage_high_threshold(self): """ Retrieves the high threshold PSU voltage output Returns: - A float number, the high threshold output voltage in volts, - e.g. 12.1 + A float number, the high threshold output voltage in volts, + e.g. 12.1 """ return PSU_MAX_VOUT @@ -172,7 +172,7 @@ def get_voltage_low_threshold(self): """ Retrieves the low threshold PSU voltage output Returns: - A float number, the low threshold output voltage in volts, - e.g. 12.1 + A float number, the low threshold output voltage in volts, + e.g. 12.1 """ return PSU_MIN_VOUT