From 53e15329322a10f3cae3e8c8d8b1e3941c958384 Mon Sep 17 00:00:00 2001 From: andywongarista <78833093+andywongarista@users.noreply.github.com> Date: Mon, 19 Jul 2021 11:17:11 -0700 Subject: [PATCH] Add str conversion for numeric xcvr info fields to xcvrd (#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. --- sonic-xcvrd/xcvrd/xcvrd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sonic-xcvrd/xcvrd/xcvrd.py b/sonic-xcvrd/xcvrd/xcvrd.py index 384a75d37ae6..9b1eade740c9 100644 --- a/sonic-xcvrd/xcvrd/xcvrd.py +++ b/sonic-xcvrd/xcvrd/xcvrd.py @@ -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)),