Skip to content

Commit

Permalink
[sonic_sfp] Fix global name about sfp module is not defined (#53)
Browse files Browse the repository at this point in the history
Signed-off-by: wangzhui <wangzhui@asterfusion.com>
  • Loading branch information
wangzhui authored and jleveque committed Aug 15, 2019
1 parent 0caf265 commit 04014b6
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions sonic_platform_base/sonic_sfp/sfputilbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,19 @@
SFP_VOLT_WIDTH = 2
SFP_CHANNL_MON_OFFSET = 100
SFP_CHANNL_MON_WIDTH = 6
SFP_MODULE_THRESHOLD_OFFSET = 0
SFP_MODULE_THRESHOLD_WIDTH = 56

qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)',

qsfp_cable_length_tup = ('Length(km)', 'Length OM3(2m)',
'Length OM2(m)', 'Length OM1(m)',
'Length Cable Assembly(m)')

sfp_cable_length_tup = ('LengthSMFkm-UnitsOfKm', 'LengthSMF(UnitsOf100m)',
'Length50um(UnitsOf10m)', 'Length62.5um(UnitsOfm)',
'LengthCable(UnitsOfm)', 'LengthOM3(UnitsOf10m)')

sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode',
sfp_compliance_code_tup = ('10GEthernetComplianceCode', 'InfinibandComplianceCode',
'ESCONComplianceCodes', 'SONETComplianceCodes',
'EthernetComplianceCodes','FibreChannelLinkLength',
'FibreChannelTechnology', 'SFP+CableTechnology',
Expand Down Expand Up @@ -883,7 +886,7 @@ def get_transceiver_info_dict(self, port_num):
if key in sfp_interface_bulk_data['data']['Specification compliance']['value']:
compliance_code_dict[key] = sfp_interface_bulk_data['data']['Specification compliance']['value'][key]['value']
transceiver_info_dict['specification_compliance'] = str(compliance_code_dict)

transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data['data']['Nominal Bit Rate(100Mbs)']['value'])
else:
for key in sfp_cable_length_tup:
Expand All @@ -897,7 +900,7 @@ def get_transceiver_info_dict(self, port_num):
transceiver_info_dict['specification_compliance'] = str(compliance_code_dict)

transceiver_info_dict['nominal_bit_rate'] = str(sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value'])

return transceiver_info_dict

def get_transceiver_dom_info_dict(self, port_num):
Expand Down Expand Up @@ -1256,12 +1259,12 @@ def reset(self, port_num):
@abc.abstractmethod
def get_transceiver_change_event(self, timeout=0):
"""
:param timeout in milliseconds. The method is a blocking call. When timeout is
:param timeout in milliseconds. The method is a blocking call. When timeout is
zero, it only returns when there is change event, i.e., transceiver plug-in/out
event. When timeout is non-zero, the function can also return when the timer expires.
When timer expires, the return status is True and events is empty.
:returns: (status, events)
:status: Boolean, True if call successful and no system level event/error occurred,
:status: Boolean, True if call successful and no system level event/error occurred,
False if call not success or system level event/error occurred.
:events: dictionary for physical port index and the SFP status,
status='1' represent plug in, '0' represent plug out like {'0': '1', '31':'0'}
Expand Down

0 comments on commit 04014b6

Please sign in to comment.