Skip to content

Commit

Permalink
Add str conversion for numeric xcvr info fields to xcvrd (#200)
Browse files Browse the repository at this point in the history
Converted nominal_bit_rate and cable_length fields from the sfp transceiver info dict into str in post_port_sfp_info_to_db.

The documentation for get_transceiver_info in SfpBase indicates that these field values should be integers. However, only string values can be passed into swsscommon.FieldValuePairs. Therefore, a string conversion is needed.
  • Loading branch information
andywongarista authored Jul 19, 2021
1 parent 03a4add commit 53e1532
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@ def post_port_sfp_info_to_db(logical_port_name, table, transceiver_dict,
('ext_identifier', port_info_dict['ext_identifier']),
('ext_rateselect_compliance', port_info_dict['ext_rateselect_compliance']),
('cable_type', port_info_dict['cable_type']),
('cable_length', port_info_dict['cable_length']),
('cable_length', str(port_info_dict['cable_length'])),
('specification_compliance', port_info_dict['specification_compliance']),
('nominal_bit_rate', port_info_dict['nominal_bit_rate']),
('nominal_bit_rate', str(port_info_dict['nominal_bit_rate'])),
('application_advertisement', port_info_dict['application_advertisement']
if 'application_advertisement' in port_info_dict else 'N/A'),
('is_replaceable', str(is_replaceable)),
Expand Down

0 comments on commit 53e1532

Please sign in to comment.