Merge remote-tracking branch 'azure/master' into bf-master
This commit is contained in:
commit
a10b06f012
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
import time
|
||||||
from sonic_sfp.sfputilbase import SfpUtilBase
|
from sonic_sfp.sfputilbase import SfpUtilBase
|
||||||
except ImportError, e:
|
except ImportError, e:
|
||||||
raise ImportError (str(e) + "- required module not found")
|
raise ImportError (str(e) + "- required module not found")
|
||||||
@ -59,14 +60,33 @@ class SfpUtil(SfpUtilBase):
|
|||||||
SfpUtilBase.__init__(self)
|
SfpUtilBase.__init__(self)
|
||||||
|
|
||||||
def reset(self, port_num):
|
def reset(self, port_num):
|
||||||
return True
|
# Check for invalid port_num
|
||||||
def set_low_power_mode(self, port_nuM, lpmode):
|
if port_num < self._port_start or port_num > self._port_end:
|
||||||
return True
|
return False
|
||||||
def get_low_power_mode(self, port_num):
|
|
||||||
return True
|
|
||||||
|
|
||||||
# def get_presence(self, port_num):
|
path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset"
|
||||||
# return True
|
port_ps = path.format(self.port_to_i2c_mapping[port_num+1])
|
||||||
|
|
||||||
|
try:
|
||||||
|
reg_file = open(port_ps, 'w')
|
||||||
|
except IOError as e:
|
||||||
|
print "Error: unable to open file: %s" % str(e)
|
||||||
|
return False
|
||||||
|
|
||||||
|
#toggle reset
|
||||||
|
reg_file.seek(0)
|
||||||
|
reg_file.write('1')
|
||||||
|
time.sleep(1)
|
||||||
|
reg_file.seek(0)
|
||||||
|
reg_file.write('0')
|
||||||
|
reg_file.close()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def set_low_power_mode(self, port_nuM, lpmode):
|
||||||
|
raise NotImplementedErro
|
||||||
|
|
||||||
|
def get_low_power_mode(self, port_num):
|
||||||
|
raise NotImplementedErro
|
||||||
|
|
||||||
def get_presence(self, port_num):
|
def get_presence(self, port_num):
|
||||||
# Check for invalid port_num
|
# Check for invalid port_num
|
||||||
|
@ -21,3 +21,13 @@ class board(eeprom_tlvinfo.TlvInfoDecoder):
|
|||||||
self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom"
|
self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom"
|
||||||
super(board, self).__init__(self.eeprom_path, 0, '', True)
|
super(board, self).__init__(self.eeprom_path, 0, '', True)
|
||||||
|
|
||||||
|
def serial_number_str(self, e):
|
||||||
|
"""Return service tag instead of serial number"""
|
||||||
|
|
||||||
|
(is_valid, results) = self.get_tlv_field(e, self._TLV_CODE_SERVICE_TAG)
|
||||||
|
if is_valid == False:
|
||||||
|
return "Bad service tag"
|
||||||
|
|
||||||
|
# 'results' is a list containing 3 elements, type (int), length (int),
|
||||||
|
# and value (string) of the requested TLV
|
||||||
|
return results[2]
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit edfb5b2c1285cbfd30d8a662ab738aee53a80439
|
Subproject commit 7ba26ec403c7f0d0acb958f794311ac3fd1af9a1
|
Loading…
Reference in New Issue
Block a user