Skip to content

Commit

Permalink
[xcvrd] Fix crash: If 'dom_capability' not in port_info_dict, insert …
Browse files Browse the repository at this point in the history
…'N/A' (sonic-net#162)

Currently, some vendors are using custom transceiver info parsers which do not yet provide the `dom_capability` field in the results of `get_transceiver_info()`. However, PR sonic-net/sonic-platform-daemons#72 introduced storing this value to State DB under the assumption that it would always be present. On platforms where this value is not present, it would cause xcvrd to crash (see issue: sonic-net#6978).

This change will prevent a crash if it is not present, and will in turn save `'N/A'` as the `dom_capability` value in State DB.
  • Loading branch information
jleveque authored Mar 9, 2021
1 parent 30d09be commit e5165b7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def post_port_sfp_info_to_db(logical_port_name, table, transceiver_dict,
('application_advertisement', port_info_dict['application_advertisement']
if 'application_advertisement' in port_info_dict else 'N/A'),
('is_replaceable', str(is_replaceable)),
('dom_capability',port_info_dict['dom_capability']),
('dom_capability', port_info_dict['dom_capability']
if 'dom_capability' in port_info_dict else 'N/A'),
])
table.set(port_name, fvs)
else:
Expand Down

0 comments on commit e5165b7

Please sign in to comment.