145aa4ff70
* 1. Fixed delta ag5648 PSU modules. 2. Enable build ag5648. Signed-off-by: neal tai <neal.tai@deltaww.com> * 1. Modified the kernel depends for ag5648. 2. Modified platform-modules-ag5648.service for install ag5648. Signed-off-by: neal tai <neal.tai@deltaww.com> * Enable the ag9064. Signed-off-by: Stanley Chi <stanley.chi@deltaww.com> * Add Delta platform et-6248brb Signed-off-by: neal tai <neal.tai@deltaww.com>
89 lines
2.2 KiB
Python
89 lines
2.2 KiB
Python
# sfputil.py
|
|
#
|
|
# Platform-specific SFP transceiver interface for SONiC
|
|
#
|
|
|
|
try:
|
|
import time
|
|
from sonic_sfp.sfputilbase import SfpUtilBase
|
|
except ImportError as e:
|
|
raise ImportError("%s - required module not found" % str(e))
|
|
|
|
|
|
class SfpUtil(SfpUtilBase):
|
|
"""Platform-specific SfpUtil class"""
|
|
|
|
PORT_START = 48
|
|
PORT_END = 49
|
|
PORTS_IN_BLOCK = 1
|
|
|
|
EEPROM_OFFSET = 44
|
|
|
|
_port_to_eeprom_mapping = {}
|
|
|
|
@property
|
|
def port_start(self):
|
|
return self.PORT_START
|
|
|
|
@property
|
|
def port_end(self):
|
|
return self.PORT_END
|
|
|
|
@property
|
|
def qsfp_ports(self):
|
|
return range(0)
|
|
|
|
@property
|
|
def port_to_eeprom_mapping(self):
|
|
return self._port_to_eeprom_mapping
|
|
|
|
def __init__(self):
|
|
eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom"
|
|
|
|
for x in range(0, self.port_end + 1):
|
|
if x >= self.port_start and x <= self.port_end:
|
|
self._port_to_eeprom_mapping[x] = eeprom_path.format(x - self.EEPROM_OFFSET)
|
|
else:
|
|
self._port_to_eeprom_mapping[x] = eeprom_path.format(x - x)
|
|
|
|
SfpUtilBase.__init__(self)
|
|
|
|
def get_presence(self, port_num):
|
|
# Check for invalid port_num
|
|
if port_num < self.port_start or port_num > self.port_end:
|
|
return False
|
|
|
|
presence_path = "/sys/devices/platform/delta-et6248brb-gpio.0/SFP/sfp_mod_p{}"
|
|
|
|
try:
|
|
reg_file = open(presence_path.format(port_num - 47))
|
|
except IOError as e:
|
|
print "Error: unable to open file: %s" % str(e)
|
|
return False
|
|
|
|
if int(reg_file.readline()) == 0:
|
|
return True
|
|
|
|
return False
|
|
|
|
def get_low_power_mode(self, port_num):
|
|
# Check for invalid port_num
|
|
if port_num < self.port_start or port_num > self.port_end:
|
|
return False
|
|
|
|
return False
|
|
|
|
def set_low_power_mode(self, port_num, lpmode):
|
|
# Check for invalid port_num
|
|
if port_num < self.port_start or port_num > self.port_end:
|
|
return False
|
|
|
|
return False
|
|
|
|
def reset(self, port_num):
|
|
# Check for invalid port_num
|
|
if port_num < self.port_start or port_num > self.port_end:
|
|
return False
|
|
|
|
return False
|