Skip to content

Commit

Permalink
[Nokia ixs7215] Add support for SFP eeprom type_abbrv_name attribute (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dflynn-Nokia authored Sep 16, 2021
1 parent 13ec43b commit 83e7876
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,25 @@ def get_direction(self):
return 'intake'

def set_status_led(self, color):
"""
Sets the state of the fan drawer status LED
Args:
color: A string representing the color with which to set the
fan drawer status LED
Returns:
bool: True if status LED state is set successfully, False if not
"""
return self._fan_list[0].set_status_led(color)

def get_status_led(self, color):
def get_status_led(self):
"""
Gets the state of the fan drawer LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings
"""
return self._fan_list[0].get_status_led()

def is_replaceable(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def __init__(self, index, sfp_type, eeprom_path, port_i2c_map):
'model', 'connector', 'encoding', 'ext_identifier',
'ext_rateselect_compliance', 'cable_type', 'cable_length',
'nominal_bit_rate', 'specification_compliance',
'vendor_date', 'vendor_oui']
'type_abbrv_name', 'vendor_date', 'vendor_oui']

self.dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', 'power_lpmode',
'tx_disable', 'tx_disable_channel', 'temperature',
Expand Down Expand Up @@ -274,6 +274,7 @@ def get_transceiver_info(self):
cable_length |INT |cable length in m
nominal_bit_rate |INT |nominal bit rate by 100Mbs
specification_compliance |1*255VCHAR |specification compliance
type_abbrv_name |1*255VCHAR |type of SFP (abbreviated)
vendor_date |1*255VCHAR |vendor date
vendor_oui |1*255VCHAR |vendor OUI
application_advertisement |1*255VCHAR |supported applications advertisement
Expand Down Expand Up @@ -338,33 +339,47 @@ def get_transceiver_info(self):
end = start + XCVR_VENDOR_DATE_WIDTH
sfp_vendor_date_data = sfpi_obj.parse_vendor_date(
sfp_interface_bulk_raw[start: end], 0)
transceiver_info_dict['type'] = sfp_interface_bulk_data['data']['type']['value']
transceiver_info_dict['manufacturer'] = sfp_vendor_name_data['data']['Vendor Name']['value']
transceiver_info_dict['model'] = sfp_vendor_pn_data['data']['Vendor PN']['value']
transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value']
transceiver_info_dict['serial'] = sfp_vendor_sn_data['data']['Vendor SN']['value']
transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data['data']['Vendor OUI']['value']
transceiver_info_dict['vendor_date'] = sfp_vendor_date_data[
'data']['VendorDataCode(YYYY-MM-DD Lot)']['value']
transceiver_info_dict['connector'] = sfp_interface_bulk_data['data']['Connector']['value']
transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value']
transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value']
transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value']

transceiver_info_dict['type'] = sfp_interface_bulk_data \
['data']['type']['value']
transceiver_info_dict['manufacturer'] = sfp_vendor_name_data \
['data']['Vendor Name']['value']
transceiver_info_dict['model'] = sfp_vendor_pn_data \
['data']['Vendor PN']['value']
transceiver_info_dict['hardware_rev'] = sfp_vendor_rev_data \
['data']['Vendor Rev']['value']
transceiver_info_dict['serial'] = sfp_vendor_sn_data \
['data']['Vendor SN']['value']
transceiver_info_dict['vendor_oui'] = sfp_vendor_oui_data \
['data']['Vendor OUI']['value']
transceiver_info_dict['vendor_date'] = sfp_vendor_date_data \
['data']['VendorDataCode(YYYY-MM-DD Lot)']['value']
transceiver_info_dict['connector'] = sfp_interface_bulk_data \
['data']['Connector']['value']
transceiver_info_dict['encoding'] = sfp_interface_bulk_data \
['data']['EncodingCodes']['value']
transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data \
['data']['Extended Identifier']['value']
transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data \
['data']['RateIdentifier']['value']
transceiver_info_dict['type_abbrv_name'] = sfp_interface_bulk_data \
['data']['type_abbrv_name']['value']

for key in sfp_cable_length_tup:
if key in sfp_interface_bulk_data['data']:
transceiver_info_dict['cable_type'] = key
transceiver_info_dict['cable_length'] = str(
sfp_interface_bulk_data['data'][key]['value'])
transceiver_info_dict['cable_length'] = \
str(sfp_interface_bulk_data['data'][key]['value'])

for key in sfp_compliance_code_tup:
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)
compliance_code_dict[key] = sfp_interface_bulk_data \
['data']['Specification compliance']['value'][key]['value']

transceiver_info_dict['nominal_bit_rate'] = str(
sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value'])
transceiver_info_dict['specification_compliance'] = \
str(compliance_code_dict)
transceiver_info_dict['nominal_bit_rate'] = \
str(sfp_interface_bulk_data['data']['NominalSignallingRate(UnitsOf100Mbd)']['value'])
transceiver_info_dict['application_advertisement'] = 'N/A'

return transceiver_info_dict
Expand Down

0 comments on commit 83e7876

Please sign in to comment.