[sfputil] Use host lane mask as part of rx-output enable/disable#3911
Merged
prgeor merged 7 commits intosonic-net:masterfrom Jun 13, 2025
Merged
[sfputil] Use host lane mask as part of rx-output enable/disable#3911prgeor merged 7 commits intosonic-net:masterfrom
prgeor merged 7 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Mihir Patel <[email protected]>
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR updates the sfputil debug commands to use the correct host lane mask for RX output and adds robust failure detection, status verification, and a default subport fallback.
- Handle empty string values when retrieving host/media lane counts
- Enhance
set_outputto verify TX/RX output status after enable/disable, restore on failure, and exit on errors - Default missing
subportin CONFIG_DB to 1 and refactor tests into a parameterized suite
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| utilities_common/platform_sfputil_helper.py | Added checks for empty lane count values and improved error handling when a field is missing |
| sfputil/debug.py | Switched to host lane counts for RX, implemented post-action status checks, and error recovery |
| tests/sfputil_test.py | Consolidated TX/RX output tests into a single parameterized test covering enable/disable scenarios |
Comments suppressed due to low confidence (3)
utilities_common/platform_sfputil_helper.py:193
- Fix the spelling of 'retreive' to 'retrieve'.
click.echo(f"{port_name}: unable to retreive correct host lane count")
utilities_common/platform_sfputil_helper.py:205
- Fix the spelling of 'retreive' to 'retrieve'.
click.echo(f"{port_name}: unable to retreive correct media lane count")
tests/sfputil_test.py:1824
- Add a test case for when
sfp.get_xcvr_api()raisesNotImplementedErrorto verify the CLI exits withERROR_NOT_IMPLEMENTEDand prints the expected message.
@pytest.mark.parametrize(
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
mihirpat1
commented
Jun 10, 2025
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Collaborator
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
prgeor
approved these changes
Jun 13, 2025
Collaborator
|
Cherry-pick PR to msft-202412: Azure/sonic-utilities.msft#185 |
nmoray
pushed a commit
to nmoray/sonic-utilities
that referenced
this pull request
Jun 25, 2025
…ic-net#3911) * [sfputil] Use host lane mask as part of rx-output enable/disable Signed-off-by: Mihir Patel <[email protected]> * Fixed pre-commit failures * Fixed pre-commit failure * Modified the state restore logic in case of failure * Removed output restoration in case of an error * Modified get_subport to return 0 if subport field does not exists * Returning integer in get_subport --------- Signed-off-by: Mihir Patel <[email protected]>
Collaborator
|
Cherry-pick PR to 202505: #4018 |
YairRaviv
pushed a commit
to YairRaviv/sonic-utilities
that referenced
this pull request
Jan 12, 2026
…ic-net#3911) * [sfputil] Use host lane mask as part of rx-output enable/disable Signed-off-by: Mihir Patel <[email protected]> * Fixed pre-commit failures * Fixed pre-commit failure * Modified the state restore logic in case of failure * Removed output restoration in case of an error * Modified get_subport to return 0 if subport field does not exists * Returning integer in get_subport --------- Signed-off-by: Mihir Patel <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
We need to use host lane mask instead of media lane mask as part of sfputil debug rx-output EthernetXX enable/disable CLI.
In addition to the above, following needs to be enhanced
How I did it
Addressed the above issues in
What I didsectionHow to verify it
PORTtable inCONFIG_DBPrevious command output (if the output of a command-line utility has changed)
The CLI used to fail if subport field is not defined in the PORT table of CONFIG_DB
New command output (if the output of a command-line utility has changed)
With the new changes, the CLI is now supported