2017-08-25 12:55:11 -05:00
|
|
|
# sfputil.py
|
|
|
|
#
|
|
|
|
# Platform-specific SFP transceiver interface for SONiC
|
|
|
|
#
|
2017-04-10 16:36:36 -05:00
|
|
|
|
|
|
|
try:
|
2017-08-25 12:55:11 -05:00
|
|
|
import time
|
|
|
|
from sonic_sfp.sfputilbase import SfpUtilBase
|
|
|
|
except ImportError as e:
|
|
|
|
raise ImportError("%s - required module not found" % str(e))
|
2017-04-10 16:36:36 -05:00
|
|
|
|
|
|
|
|
2017-08-25 12:55:11 -05:00
|
|
|
class SfpUtil(SfpUtilBase):
|
|
|
|
"""Platform-specific SfpUtil class"""
|
2017-04-10 16:36:36 -05:00
|
|
|
|
2017-08-25 12:55:11 -05:00
|
|
|
PORT_START = 0
|
|
|
|
PORT_END = 55
|
|
|
|
PORTS_IN_BLOCK = 56
|
2017-04-10 16:36:36 -05:00
|
|
|
|
2017-08-25 12:55:11 -05:00
|
|
|
EEPROM_OFFSET = 1
|
2017-04-10 16:36:36 -05:00
|
|
|
|
2017-08-25 12:55:11 -05:00
|
|
|
_port_to_eeprom_mapping = {}
|
2017-04-10 16:36:36 -05:00
|
|
|
|
2017-08-25 12:55:11 -05:00
|
|
|
@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, self.PORTS_IN_BLOCK + 1)
|
|
|
|
|
|
|
|
@property
|
|
|
|
def port_to_eeprom_mapping(self):
|
|
|
|
return self._port_to_eeprom_mapping
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
eeprom_path = "/bsp/qsfp/qsfp{0}"
|
2017-04-10 16:36:36 -05:00
|
|
|
|
|
|
|
for x in range(0, self.port_end + 1):
|
2017-08-25 12:55:11 -05:00
|
|
|
self._port_to_eeprom_mapping[x] = eeprom_path.format(x + self.EEPROM_OFFSET)
|
|
|
|
|
|
|
|
SfpUtilBase.__init__(self)
|
|
|
|
|
|
|
|
def get_presence(self, port_num):
|
|
|
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def get_low_power_mode(self, port_num):
|
|
|
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def set_low_power_mode(self, port_num, lpmode):
|
|
|
|
|
|
|
|
raise NotImplementedError
|
|
|
|
|
|
|
|
def reset(self, port_num):
|
|
|
|
|
|
|
|
raise NotImplementedError
|