Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
76 changes: 72 additions & 4 deletions device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
},
}

FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R",
"FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R",
"FAN-5F", "FAN-5R"]

class Fan(FanBase):
"""Platform-specific Fan class"""
Expand All @@ -44,7 +47,7 @@ def __init__(self, fan_tray_index, fan_index=0, is_psu_fan=False, psu_index=0):
self.psu_hwmon_path = PSU_HWMON_I2C_PATH.format(
self.psu_i2c_num, self.psu_i2c_addr)

FanBase.__init__(self)
FanBase.__init__(self)


def get_direction(self):
Expand All @@ -57,10 +60,10 @@ def get_direction(self):


if not self.is_psu_fan:
dir_str = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index, '_direction')
dir_str = "{}{}{}".format(CPLD_I2C_PATH, self.fan_tray_index+1, '_direction')
val=self._api_helper.read_txt_file(dir_str)
if val is not None:
if val==0:
if int(val, 10)==0:
direction=self.FAN_DIRECTION_EXHAUST
else:
direction=self.FAN_DIRECTION_INTAKE
Expand All @@ -70,7 +73,7 @@ def get_direction(self):
dir_str = "{}{}".format(self.psu_hwmon_path,'psu_fan_dir')

val=self._api_helper.read_txt_file(dir_str)

if val is not None:
if val=='F2B':
direction=self.FAN_DIRECTION_EXHAUST
Expand Down Expand Up @@ -159,6 +162,33 @@ def set_status_led(self, color):
"""
return False #Not supported

def get_status_led(self):
"""
Gets the state of the fan status LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
status=self.get_presence()
if status is None:
return self.STATUS_LED_COLOR_OFF

return {
1: self.STATUS_LED_COLOR_GREEN,
0: self.STATUS_LED_COLOR_RED
}.get(status, self.STATUS_LED_COLOR_OFF)

def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
fan_name = FAN_NAME_LIST[self.fan_tray_index*2 + self.fan_index] \
if not self.is_psu_fan \
else "PSU-{} FAN-{}".format(self.psu_index+1, self.fan_index+1)

return fan_name

def get_presence(self):
"""
Retrieves the presence of the FAN
Expand All @@ -177,3 +207,41 @@ def get_presence(self):
else:
return True

def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
if self.is_psu_fan:
psu_fan_path= "{}{}".format(self.psu_hwmon_path, 'psu_fan1_fault')
val=self._api_helper.read_txt_file(psu_fan_path)
if val is not None:
return int(val, 10)==0
else:
return False
else:
path = "{}{}{}".format(CPLD_I2C_PATH, self.fan_index+1, '_fault')
val=self._api_helper.read_txt_file(path)
if val is not None:
return int(val, 10)==0
else:
return False


def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""

return "N/A"

def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return "N/A"
23 changes: 12 additions & 11 deletions device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/psu.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_power(self):
return float(val)/1000
else:
return 0

def get_powergood_status(self):
"""
Retrieves the powergood status of PSU
Expand All @@ -123,7 +123,7 @@ def set_status_led(self, color):
Returns:
bool: True if status LED state is set successfully, False if not
"""

return False #Controlled by HW

def get_status_led(self):
Expand All @@ -133,14 +133,13 @@ def get_status_led(self):
A string, one of the predefined STATUS_LED_COLOR_* strings above
"""
status=self.get_status()
if not status:
return self.STATUS_LED_COLOR_RED

if status==1:
return self.STATUS_LED_COLOR_GREEN
else:
return self.STATUS_LED_COLOR_RED
if status is None:
return self.STATUS_LED_COLOR_OFF

return {
1: self.STATUS_LED_COLOR_GREEN,
0: self.STATUS_LED_COLOR_RED
}.get(status, self.STATUS_LED_COLOR_OFF)

def get_temperature(self):
"""
Expand Down Expand Up @@ -235,7 +234,8 @@ def get_model(self):
"""
model_path="{}{}".format(self.cpld_path, 'psu_model_name')
model=self._api_helper.read_txt_file(model_path)
if not model:

if model is None:
return "N/A"
return model

Expand All @@ -247,6 +247,7 @@ def get_serial(self):
"""
serial_path="{}{}".format(self.cpld_path, 'psu_serial_numer')
serial=self._api_helper.read_txt_file(serial_path)
if not serial:

if serial is None:
return "N/A"
return serial
15 changes: 4 additions & 11 deletions device/accton/x86_64-accton_as5835_54x-r0/sonic_platform/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId
from sonic_platform_base.sonic_sfp.sff8472 import sff8472Dom
from sonic_platform_base.sonic_sfp.sff8472 import sff8472InterfaceId
#from sonic_platform_base.sonic_sfp.sff8472 import sffbase
from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper
from .helper import APIHelper
except ImportError as e:
Expand Down Expand Up @@ -241,14 +242,6 @@ def _convert_string_to_num(self, value_str):
else:
return 'N/A'

def __write_txt_file(self, file_path, value):
try:
with open(file_path, 'w') as fd:
fd.write(str(value))
except Exception:
return False
return True

def __is_host(self):
return os.system(self.HOST_CHK_CMD) == 0

Expand Down Expand Up @@ -1006,11 +999,11 @@ def reset(self):
cpld_i = self.__get_cpld_num(self.port_num)
cpld_path = self._cpld_mapping[cpld_i]
reset_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_reset_', self.port_num)
ret = self.__write_txt_file(reset_path, 1)
ret = self._api_helper.write_txt_file(reset_path, 1)

if ret is not True:
time.sleep(0.01)
ret = self.__write_txt_file(reset_path, 0)
ret = self.self._api_helper.write_txt_file(reset_path, 0)
time.sleep(0.2)
return ret
else:
Expand All @@ -1030,7 +1023,7 @@ def tx_disable(self, tx_disable):
cpld_i = self.__get_cpld_num(self.port_num)
cpld_path = self._cpld_mapping[cpld_i]
tx_path = "{}{}{}{}".format(CPLD_I2C_PATH, cpld_path, '/module_tx_disable_', self.port_num)
ret = self.__write_txt_file(tx_path, 1 if tx_disable else 0)
ret = self._api_helper.write_txt_file(tx_path, 1 if tx_disable else 0)

if ret is not None:
time.sleep(0.01)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, thermal_index=0):
self.ss_index = 1

def __read_txt_file(self, file_path):
for filename in glob.glob(file_path):
for filename in glob.glob(file_path):
try:
with open(filename, 'r') as fd:
data =fd.readline().rstrip()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# name lanes alias index speed admin_status
Ethernet1 1 twentyfiveGigE0/1 0 25000 up
Ethernet2 2 twentyfiveGigE0/2 1 25000 up
Ethernet3 3 twentyfiveGigE0/3 2 25000 up
Ethernet4 4 twentyfiveGigE0/4 3 25000 up
Ethernet5 5 twentyfiveGigE0/5 4 25000 up
Ethernet6 6 twentyfiveGigE0/6 5 25000 up
Ethernet7 7 twentyfiveGigE0/7 6 25000 up
Ethernet8 8 twentyfiveGigE0/8 7 25000 up
Ethernet9 13 twentyfiveGigE0/9 8 25000 up
Ethernet10 14 twentyfiveGigE0/10 9 25000 up
Ethernet11 15 twentyfiveGigE0/11 10 25000 up
Ethernet12 16 twentyfiveGigE0/12 11 25000 up
Ethernet13 21 twentyfiveGigE0/13 12 25000 up
Ethernet14 22 twentyfiveGigE0/14 13 25000 up
Ethernet15 23 twentyfiveGigE0/15 14 25000 up
Ethernet16 24 twentyfiveGigE0/16 15 25000 up
Ethernet17 29 twentyfiveGigE0/17 16 25000 up
Ethernet18 30 twentyfiveGigE0/18 17 25000 up
Ethernet19 31 twentyfiveGigE0/19 18 25000 up
Ethernet20 32 twentyfiveGigE0/20 19 25000 up
Ethernet21 33 twentyfiveGigE0/21 20 25000 up
Ethernet22 34 twentyfiveGigE0/22 21 25000 up
Ethernet23 35 twentyfiveGigE0/23 22 25000 up
Ethernet24 36 twentyfiveGigE0/24 23 25000 up
Ethernet25 41 twentyfiveGigE0/25 24 25000 up
Ethernet26 42 twentyfiveGigE0/26 25 25000 up
Ethernet27 43 twentyfiveGigE0/27 26 25000 up
Ethernet28 44 twentyfiveGigE0/28 27 25000 up
Ethernet29 49 twentyfiveGigE0/29 28 25000 up
Ethernet30 50 twentyfiveGigE0/30 29 25000 up
Ethernet31 51 twentyfiveGigE0/31 30 25000 up
Ethernet32 52 twentyfiveGigE0/32 31 25000 up
Ethernet33 57 twentyfiveGigE0/33 32 25000 up
Ethernet34 58 twentyfiveGigE0/34 33 25000 up
Ethernet35 59 twentyfiveGigE0/35 34 25000 up
Ethernet36 60 twentyfiveGigE0/36 35 25000 up
Ethernet37 61 twentyfiveGigE0/37 36 25000 up
Ethernet38 62 twentyfiveGigE0/38 37 25000 up
Ethernet39 63 twentyfiveGigE0/39 38 25000 up
Ethernet40 64 twentyfiveGigE0/40 39 25000 up
Ethernet41 65 twentyfiveGigE0/41 40 25000 up
Ethernet42 66 twentyfiveGigE0/42 41 25000 up
Ethernet43 67 twentyfiveGigE0/43 42 25000 up
Ethernet44 68 twentyfiveGigE0/44 43 25000 up
Ethernet45 69 twentyfiveGigE0/45 44 25000 up
Ethernet46 70 twentyfiveGigE0/46 45 25000 up
Ethernet47 71 twentyfiveGigE0/47 46 25000 up
Ethernet48 72 twentyfiveGigE0/48 47 25000 up
Ethernet49 85,86,87,88 hundredGigE0/1 48 100000 up
Ethernet50 77,78,79,80 hundredGigE0/2 49 100000 up
Ethernet51 97,98,99,100 hundredGigE0/3 50 100000 up
Ethernet52 93,94,95,96 hundredGigE0/4 51 100000 up
Ethernet53 113,114,115,116 hundredGigE0/5 52 100000 up
Ethernet54 105,106,107,108 hundredGigE0/6 53 100000 up
Ethernet55 121,122,123,124 hundredGigE0/7 54 100000 up
Ethernet56 125,126,127,128 hundredGigE0/8 55 100000 up
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/td3-b6510-48vs8cq-48x25G+8x100G.config.bcm
Loading