Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[intfutil]Let speed 100M/2.5G can be correct displayed. #1742

Closed
wants to merge 1 commit into from
Closed

[intfutil]Let speed 100M/2.5G can be correct displayed. #1742

wants to merge 1 commit into from

Conversation

PJHsieh
Copy link
Contributor

@PJHsieh PJHsieh commented Aug 5, 2021

Parse the speed string:
The speed string length < len('1000'), display speed by unit 'M'
else display speed by unit 'G'

What I did

Let speed 100M/2.5G can be correct displayed

How I did it

Parse the speed string:
The speed string length < len('1000'), display speed by unit 'M'
else display speed by 'G'

How to verify it

Real device verification.

Verify by the CLI cmd 'show interfaces status' output on the port which is configure with speed 100M
100M shall be shown in the Speed field

Verify by the CLI cmd 'show interfaces status' output on the port which is configured with speed 2.5G
2.5G shall be shown in the Speed field.

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

Parse the speed string:
The speed string length < len('1000'), display speed by unit 'M'
else display speed by unit 'G'
@PJHsieh
Copy link
Contributor Author

PJHsieh commented Aug 5, 2021

retest

@@ -138,12 +138,28 @@ def appl_db_port_status_get(appl_db, intf_name, status_type):
if status is None:
return "N/A"
if status_type == PORT_SPEED and status != "N/A":
status = '{}G'.format(status[:-3])
if (len(status) < len('1000')):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be great if you can extract these lines to a new methods and reuse it
And it might be better to convert to numbers than manipulate text

@Blueve
Copy link
Contributor

Blueve commented Jul 29, 2022

This issue has been addressed in another PR: #2110

@Blueve Blueve closed this Jul 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants