-
Notifications
You must be signed in to change notification settings - Fork 709
[master] [show] Option to add subcommands to show techsupport #2974
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
base: master
Are you sure you want to change the base?
Conversation
* replace techsupport click command with click group to support subcommands * update plugins/cisco-8000.py to support vendor specific commands Signed-off-by: Geert Vlaemynck <[email protected]>
d0966ba
to
f30b50f
Compare
"""Gather information for troubleshooting""" | ||
if ctx.invoked_subcommand: | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why return here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We return here to run only the subcommand, e.g. "show techsupport npu" which can be defined in a vendor platform package, instead of the main "show techsupport".
Thanks @kevinskwang ! Please help to rerun the build pipeline. Thanks |
Signed-off-by: Geert Vlaemynck <[email protected]>
@kevinskwang Thanks for your previous review and approval. Merging was blocked because of a code coverage issue. This has been addressed in a test case in my latest commit. Could you review and approve if appropriate? |
show/plugins/cisco-8000.py
Outdated
from sonic_platform.cli import VENDOR_CLIS | ||
except ImportError: | ||
VENDOR_CLIS = {} | ||
|
||
|
||
def register(cli): | ||
version_info = device_info.get_sonic_version_info() | ||
if version_info and version_info.get("asic_type") == "cisco-8000": | ||
for c in PLATFORM_CLIS: | ||
cli.commands["platform"].add_command(c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for the two separate loops is to not break backward compatibility in cisco platform specific code which only uses the PLATFORM_CLIS list. New cisco platform specific code will use the VENDOR_CLIS dict, so until all cisco code has been migrated to using VENDOR_CLIS we really do need both for loops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @qiluo-msft , if @gvlaemyn's explanation is acceptable could you help with the approval?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @qiluo-msft , if Geert's explanation is acceptable, please help with the approval. Otherwise, we could arrange for a quick meeting to discuss. Thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @qiluo-msft and @kevinskwang , could you review and approve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the plan and ETA for "all cisco code has been migrated to using VENDOR_CLIS"? If I do not ask, will it happen finally?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading the VENDOR_CLIS dictionary in the cisco-8000 plugin was added in this PR just for being able to add the "show techsupport npu" command. My previous comment "until all cisco code has been migrated to using VENDOR_CLIS" may have given the impression that this PR is depending on a lot of internal cisco code to be modified: this is not the case. I should have commented the PLATFORM_CLIS list may not be required to be read anymore in the cisco-8000 plugin at some future time, but currently we need both PLATFORM_CLIS and VENDOR_CLIS to be read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiluo-msft @kevinskwang Does the updated code in plugins/cisco-8000.py address your concerns? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @qiluo-msft , please let us know if @gvlaemyn's comments addressed your concerns and if we can go ahead with this PR.
cc: @abdosi
Hi @abdosi , @kevinskwang Please help with review, approval, and merge if no concerns. We would like to have it included in 202405. |
Signed-off-by: Geert Vlaemynck <[email protected]>
Signed-off-by: Geert Vlaemynck <[email protected]>
What I did
Implement option to add subcommands to "show techsupport", e.g. "show techsupport npu"
to have to possibility of restricting the collected data to a subset of the full techsupport data.
How I did it
How to verify it
E.g. for the "show techsupport npu" command on a cisco-8000 platform:
root@sonic:~# show techsupport -h
Usage: show techsupport [OPTIONS] COMMAND [ARGS]...
Gather information for troubleshooting
Options:
--since TEXT Collect logs and core files since given date
-g, --global-timeout INTEGER Global timeout in minutes. WARN: Dump might be
incomplete if enforced
-c, --cmd-timeout INTEGER Individual command timeout in minutes. Default
5 mins
--verbose Enable verbose output
--allow-process-stop Dump additional data which may require system
interruption
--silent Run techsupport in silent mode
--debug-dump Collect Debug Dump Output
-r, --redirect-stderr Redirect an intermediate errors to STDERR
-?, -h, --help Show this message and exit.
Commands:
npu Gather platform npu information
root@sonic:~# show techsupport npu
. . .
/var/dump/sonic_npu_dump_hostname_20230828_105958.tar.gz
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)