Skip to content

Commit e5165b7

Browse files
authored
[xcvrd] Fix crash: If 'dom_capability' not in port_info_dict, insert '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.
1 parent 30d09be commit e5165b7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

sonic-xcvrd/xcvrd/xcvrd.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,8 @@ def post_port_sfp_info_to_db(logical_port_name, table, transceiver_dict,
299299
('application_advertisement', port_info_dict['application_advertisement']
300300
if 'application_advertisement' in port_info_dict else 'N/A'),
301301
('is_replaceable', str(is_replaceable)),
302-
('dom_capability',port_info_dict['dom_capability']),
302+
('dom_capability', port_info_dict['dom_capability']
303+
if 'dom_capability' in port_info_dict else 'N/A'),
303304
])
304305
table.set(port_name, fvs)
305306
else:

0 commit comments

Comments
 (0)