-
Notifications
You must be signed in to change notification settings - Fork 216
Description
Hi,
We notice the following issue in Dell Z9100 where xcvrd exits in API 2.0 with the following trace.
This issue may occur for other platforms also.
root@sonic:/# xcvrd
Traceback (most recent call last):
File "/usr/bin/xcvrd", line 1077, in
main()
File "/usr/bin/xcvrd", line 1074, in main
xcvrd.run()
File "/usr/bin/xcvrd", line 1038, in run
self.init()
File "/usr/bin/xcvrd", line 1022, in init
post_port_sfp_dom_info_to_db(is_warm_start, self.stop_event)
File "/usr/bin/xcvrd", line 391, in post_port_sfp_dom_info_to_db
notify_media_setting(logical_port_name, transceiver_dict, app_port_tbl)
File "/usr/bin/xcvrd", line 613, in notify_media_setting
key = get_media_settings_key(physical_port, transceiver_dict)
File "/usr/bin/xcvrd", line 520, in get_media_settings_key
media_compliance_dict = ast.literal_eval(media_compliance_dict_str)
File "/usr/lib/python2.7/ast.py", line 80, in literal_eval
return _convert(node_or_string)
File "/usr/lib/python2.7/ast.py", line 79, in _convert
raise ValueError('malformed string')
ValueError: malformed string
root@sonic:/#
This is due to the fact where one of the EEPROM is not readable(optic issue).
If EEPROM is not readable, currently we return dictionary that has ‘N/A’ fields in sfp.py.
XCVRD doesn’t handle ‘N/A’ and because of this, xcvrd exits.
As per definition added in sfp_base.py, it says that we need to return dictionary.
def get_transceiver_info(self):
"""
Retrieves transceiver info of this SFP
Returns:
A dict which contains following keys/values :
--Fix:
Returning “None” for unreadable EEPROM, fixes this issue as None type is handled in xcvrd.
def get_transceiver_info(self):
"""
Retrieves transceiver info of this SFP
"""
transceiver_info_dict = {}
compliance_code_dict = {}
transceiver_info_dict = dict.fromkeys(info_dict_keys, 'N/A')
# BaseInformation
iface_data = self._get_eeprom_data('type')
if (iface_data is not None):
connector = iface_data['data']['Connector']['value']
encoding = iface_data['data']['EncodingCodes']['value']
ext_id = iface_data['data']['Extended Identifier']['value']
rate_identifier = iface_data['data']['RateIdentifier']['value']
identifier = iface_data['data']['type']['value']
bit_rate = str(
iface_data['data']['Nominal Bit Rate(100Mbs)']['value'])
type_abbrv_name=iface_data['data']['type_abbrv_name']['value']
for key in compliance_code_tup:
if key in iface_data['data']['Specification compliance']['value']:
compliance_code_dict[key] = iface_data['data']['Specification compliance']['value'][key]['value']
for key in cable_length_tup:
if key in iface_data['data']:
cable_type = key
cable_length = str(iface_data['data'][key]['value'])
else:
return transceiver_info_dict ====>changing return type to “None” fixes the issue
Query:
- Incase if we’re returning the dictionary itself, can community handle xcvrd on the dictionary part that has ‘N/A’ value or we need to return “None” in sfp.py?.
- We need to get clear definition from your side on the return type (documentation needs to be corrected in sfp_base.py on the return type).
- ‘type_abbrv_name’ key also needs to be documented in sfp_base.py