Skip to content

Commit 53e1532

Browse files
Add str conversion for numeric xcvr info fields to xcvrd (sonic-net#200)
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.
1 parent 03a4add commit 53e1532

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sonic-xcvrd/xcvrd/xcvrd.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,9 @@ def post_port_sfp_info_to_db(logical_port_name, table, transceiver_dict,
323323
('ext_identifier', port_info_dict['ext_identifier']),
324324
('ext_rateselect_compliance', port_info_dict['ext_rateselect_compliance']),
325325
('cable_type', port_info_dict['cable_type']),
326-
('cable_length', port_info_dict['cable_length']),
326+
('cable_length', str(port_info_dict['cable_length'])),
327327
('specification_compliance', port_info_dict['specification_compliance']),
328-
('nominal_bit_rate', port_info_dict['nominal_bit_rate']),
328+
('nominal_bit_rate', str(port_info_dict['nominal_bit_rate'])),
329329
('application_advertisement', port_info_dict['application_advertisement']
330330
if 'application_advertisement' in port_info_dict else 'N/A'),
331331
('is_replaceable', str(is_replaceable)),

0 commit comments

Comments
 (0)