Skip to content

[sfp] Fix issue: Application Advertisement is not well formatted #2491

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

Merged
merged 7 commits into from
Nov 19, 2022

Conversation

Junchao-Mellanox
Copy link
Collaborator

@Junchao-Mellanox Junchao-Mellanox commented Nov 10, 2022

What I did

Currently, the value of "Application Advertisement" is a python dict to string which is not well formatted.
This PR re-format the output of "Application Advertisement" to a human readable string

How I did it

Set the output to similar to 202012

How to verify it

Unit test
Manual test

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

Ethernet200: SFP EEPROM detected
        Application Advertisement: {1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400GBASE-DR4 (Cl 124)', 'media_lane_count': 4, 'host_lane_count': 8, 'host_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '100GBASE-DR (Cl 140)', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85}}

...

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

Ethernet200: SFP EEPROM detected
        Application Advertisement: 400GAUI-8 C2M (Annex 120E) - 400GBASE-DR4 (Cl 124) - 0x1
                                   100GAUI-2 C2M (Annex 135G) - 100GBASE-DR (Cl 140) - 0x55
...

keboliu
keboliu previously approved these changes Nov 10, 2022
@@ -38,25 +40,6 @@ from utilities_common import multi_asic as multi_asic_util
from utilities_common.platform_sfputil_helper import is_rj45_port, RJ45_PORT_TYPE

# TODO: We should share these maps and the formatting functions between sfputil and sfpshow
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this TODO is still valid? what is missing to close it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it is still valid. Now show interface transceiver eeprom and sfputil show eeprom have very similar output. However, these two commands have their own implementation. I suppose they shall share the same implementation, but I did not do it in this PR because it would be a big change.

@@ -45,25 +47,6 @@
MAX_LPL_FIRMWARE_BLOCK_SIZE = 116 #Bytes

# TODO: We should share these maps and the formatting functions between sfputil and sfpshow
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

@liat-grozovik
Copy link
Collaborator

LGTM beside of the comment which is more like a question than a suggestion

@liat-grozovik
Copy link
Collaborator

/azp run Azure.sonic-utilities

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@@ -45,25 +47,6 @@
MAX_LPL_FIRMWARE_BLOCK_SIZE = 116 #Bytes

# TODO: We should share these maps and the formatting functions between sfputil and sfpshow
QSFP_DATA_MAP = {
Copy link
Contributor

Choose a reason for hiding this comment

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

this is still used by QSFP28/and QSFP+

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I did not remove it. I just move it to a common place. See sfp_helper.py.

@prgeor
Copy link
Contributor

prgeor commented Nov 10, 2022

@Junchao-Mellanox can you add lane assignment mask also in hex?

@prgeor prgeor self-assigned this Nov 10, 2022
@lgtm-com
Copy link

lgtm-com bot commented Nov 11, 2022

This pull request introduces 2 alerts when merging 52d6c81 into a5eb26b - view on LGTM.com

new alerts:

  • 2 for Variable defined multiple times

@Junchao-Mellanox
Copy link
Collaborator Author

Hi prgeor, would you please review again?

@@ -0,0 +1,53 @@
import ast

QSFP_DATA_MAP = {
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we then keeping QSFP_DD_DATA_MAP {} in sfputil? can we move that also here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hi @prgeor , QSFP_DD_DATA_MAP is not related to my change. This PR is aimed to fix the format of Application Advertisement. Moving QSFP_DD_DATA_MAP is part of refactoring sfputi/main.py and sfpshow, I suppose it is out of the scope of this PR.

Moving similar logic of sfputil/main.py and sfpshow to a common place is a good idea, we shall do it in another PR.

@prgeor
Copy link
Contributor

prgeor commented Nov 17, 2022

@Junchao-Mellanox can you check the build failure

@Junchao-Mellanox
Copy link
Collaborator Author

/azpw run Azure.sonic-utilities

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-utilities

@qiluo-msft qiluo-msft closed this Nov 19, 2022
@qiluo-msft qiluo-msft reopened this Nov 19, 2022
@qiluo-msft
Copy link
Contributor

LGTM check is stuck. Will override.

@qiluo-msft qiluo-msft merged commit ba9b628 into sonic-net:master Nov 19, 2022
@Junchao-Mellanox Junchao-Mellanox deleted the format-app-adv branch November 20, 2022 01:46
@Junchao-Mellanox
Copy link
Collaborator Author

Hi @yxieca , could you please help cherry-pick to 202205?

mdanish-kh pushed a commit to mdanish-kh/sonic-utilities that referenced this pull request Nov 23, 2022
…ic-net#2491)

#### What I did

Currently, the value of "Application Advertisement" is a python dict to string which is not well formatted.
This PR re-format the output of "Application Advertisement" to a human readable string

#### How I did it

Set the output to similar to 202012 

#### How to verify it

Unit test
Manual test

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

```
Ethernet200: SFP EEPROM detected
        Application Advertisement: {1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400GBASE-DR4 (Cl 124)', 'media_lane_count': 4, 'host_lane_count': 8, 'host_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '100GBASE-DR (Cl 140)', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85}}

...
```

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

```
Ethernet200: SFP EEPROM detected
        Application Advertisement: 400GAUI-8 C2M (Annex 120E) - 400GBASE-DR4 (Cl 124) - 0x1
                                   100GAUI-2 C2M (Annex 135G) - 100GBASE-DR (Cl 140) - 0x55
...
```
yxieca pushed a commit that referenced this pull request Nov 29, 2022
#### What I did

Currently, the value of "Application Advertisement" is a python dict to string which is not well formatted.
This PR re-format the output of "Application Advertisement" to a human readable string

#### How I did it

Set the output to similar to 202012 

#### How to verify it

Unit test
Manual test

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

```
Ethernet200: SFP EEPROM detected
        Application Advertisement: {1: {'host_electrical_interface_id': '400GAUI-8 C2M (Annex 120E)', 'module_media_interface_id': '400GBASE-DR4 (Cl 124)', 'media_lane_count': 4, 'host_lane_count': 8, 'host_lane_assignment_options': 1}, 2: {'host_electrical_interface_id': '100GAUI-2 C2M (Annex 135G)', 'module_media_interface_id': '100GBASE-DR (Cl 140)', 'media_lane_count': 1, 'host_lane_count': 2, 'host_lane_assignment_options': 85}}

...
```

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

```
Ethernet200: SFP EEPROM detected
        Application Advertisement: 400GAUI-8 C2M (Annex 120E) - 400GBASE-DR4 (Cl 124) - 0x1
                                   100GAUI-2 C2M (Annex 135G) - 100GBASE-DR (Cl 140) - 0x55
...
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants