Skip to content

Add str conversion for numeric xcvr info fields to xcvrd#200

Merged
lguohan merged 1 commit into
sonic-net:masterfrom
andywongarista:xcvrd-sfp-info-str
Jul 19, 2021
Merged

Add str conversion for numeric xcvr info fields to xcvrd#200
lguohan merged 1 commit into
sonic-net:masterfrom
andywongarista:xcvrd-sfp-info-str

Conversation

@andywongarista
Copy link
Copy Markdown
Contributor

Description

Converted nominal_bit_rate and cable_length fields from the sfp transceiver info dict into str in post_port_sfp_info_to_db

Motivation and Context

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.

How Has This Been Tested?

Tested on an Arista platform that xcvrd runs without errors when nominal_bit_rate and cable_length are integers.

Additional Information (Optional)

@lguohan lguohan requested a review from prgeor July 13, 2021 20:42
@lguohan
Copy link
Copy Markdown
Contributor

lguohan commented Jul 13, 2021

is this a bug fix?

@andywongarista
Copy link
Copy Markdown
Contributor Author

is this a bug fix?

Yes. I believe it's gone unnoticed because most platforms end up returning these fields as string (rather than int) and the tests don't verify the types of these fields.

@lguohan lguohan merged commit 53e1532 into sonic-net:master Jul 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants