Add lpmode show and firmware show commands as aliases for show#4517
Add lpmode show and firmware show commands as aliases for show#4517maheeppartap-nexthop wants to merge 2 commits into
Conversation
Signed-off-by: maheeppartap-nexthop <maheeppartap@nexthop.ai>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR improves sfputil CLI discoverability by adding show aliases under the existing mutating command groups, so users can inspect LPMode and firmware versions via sfputil lpmode show and sfputil firmware show (reusing the existing sfputil show lpmode / sfputil show fwversion implementations).
Changes:
- Add
sfputil lpmode showas an alias ofsfputil show lpmode. - Add
sfputil firmware showas an alias ofsfputil show fwversion. - Add unit tests covering the new alias commands (including RJ45 behavior for firmware).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
sfputil/main.py |
Registers show aliases under lpmode and firmware Click groups by reusing existing show subcommands. |
tests/sfputil_test.py |
Adds pytest coverage to ensure the new alias commands execute and match existing behaviors. |
|
@maheeppartap-nexthop can you update the CLI doc? https://github.com/sonic-net/sonic-utilities/blob/master/doc/Command-Reference.md
|
Signed-off-by: Maheeppartap Singh <maheeppartap@nexthop.ai>
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
@prgeor I have updated the docs. The docs did not have any lpmode related docs ( |
|
@maheeppartap-nexthop Can you please attach the output of |
|
|
||
| - Usage: | ||
| ``` | ||
| sfputil firmware show PORT_NAME |
There was a problem hiding this comment.
| sfputil firmware show PORT_NAME | |
| sfputil lpmode show [-p <port_name>] |
There was a problem hiding this comment.
Did you mean sfputil firmware show [-p <port_name>]?
If so, this command is just meant to be an alias command, and meant to mirror exactly what the sfputil show firmware command's API says by design, so we don't have to change the sfputil firmware show if sfputil show fwversion changes.

closes #4518
What I did
To view the LPMode state of a xcvr (or all xcvrs), the user has to run "sfputil show lpmode", all while "sfputil lpmode" is already existing as a subcommand. Same for firmware. This is very unintuitive.
This PR adds a new subcommand under both
lpmodeandfirmwareto view the respective fields. Internally, it just reroutes toshow lpmode/fwversion.Note that the help commands are also updated. The
sfputil showcommand will still be the single source of truth. If for whatever reason, a new flag/param is added to thesfputil show lpmode/fwversioncommand, it will be picked up automatically bysfputil lpmode/firmware show.How I did it
I added 2 new subcommands, linking them to the objects for
show fwversionandshow lpmode.How to verify it
and
Previous command output (if the output of a command-line utility has changed)
and
New command output (if the output of a command-line utility has changed)
and