Merge remote-tracking branch 'azure/master' into bf-master
This commit is contained in:
commit
a10b06f012
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
try:
|
||||
import time
|
||||
from sonic_sfp.sfputilbase import SfpUtilBase
|
||||
except ImportError, e:
|
||||
raise ImportError (str(e) + "- required module not found")
|
||||
@ -59,14 +60,33 @@ class SfpUtil(SfpUtilBase):
|
||||
SfpUtilBase.__init__(self)
|
||||
|
||||
def reset(self, port_num):
|
||||
return True
|
||||
def set_low_power_mode(self, port_nuM, lpmode):
|
||||
return True
|
||||
def get_low_power_mode(self, port_num):
|
||||
return True
|
||||
# Check for invalid port_num
|
||||
if port_num < self._port_start or port_num > self._port_end:
|
||||
return False
|
||||
|
||||
# def get_presence(self, port_num):
|
||||
# return True
|
||||
path = "/sys/bus/i2c/devices/{0}-0050/sfp_port_reset"
|
||||
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):
|
||||
# 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"
|
||||
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