Skip to content

Commit

Permalink
[Netberg][nb-inno] Removed some spaces, unused imports and variables
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewsapronov committed Nov 23, 2021
1 parent 8ebe13c commit ae59be0
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)")],
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -163,16 +163,16 @@ 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

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
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -163,16 +163,16 @@ 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

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

0 comments on commit ae59be0

Please sign in to comment.