-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Showtech sonic mgmt framework: Add Management Framework functionality for "show tech-support" #7816
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
qiluo-msft
merged 9 commits into
sonic-net:master
from
kerry-meyer:showtech_sonic_mgmt_framework
Jan 10, 2022
Merged
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
70f6746
Provide initial files for SONiC Community mgmt-framework Showtech
60963f8
Merge remote-tracking branch 'origin/master' into showtech_sonic_mgmt…
kerry-meyer 63b2ed0
Showtech for SONiC Community Management Framework: Fix incompatibilities
kerry-meyer 2a07cd8
Showtech sonic mgmt framework: Code review changes
kerry-meyer aa13f70
Showtech sonic mgmt framework: Additional code review and REST fixes
kerry-meyer f7f7836
Merge remote-tracking branch 'origin' into showtech_sonic_mgmt_framework
kerry-meyer 852c67a
Resolve merge conflicts for merge to latest on 06/18/2021
kerry-meyer 5fd9292
Remove incorrect submodules from the PR
kerry-meyer f9bf1bf
Revert the proposed change in the rules/config file
kerry-meyer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """Show techsupport command handler""" | ||
|
|
||
| import host_service | ||
| import subprocess | ||
| import re | ||
|
|
||
| MOD_NAME = 'showtech' | ||
|
|
||
| class Showtech(host_service.HostModule): | ||
| """DBus endpoint that executes the "show techsupport" command | ||
| """ | ||
| @host_service.method(host_service.bus_name(MOD_NAME), in_signature='s', out_signature='is') | ||
| def info(self, date): | ||
|
|
||
| ERROR_TAR_FAILED = 5 | ||
| ERROR_PROCFS_SAVE_FAILED = 6 | ||
| ERROR_INVALID_ARGUMENT = 10 | ||
|
|
||
| err_dict = {ERROR_INVALID_ARGUMENT: 'Invalid input: Incorrect DateTime format', | ||
| ERROR_TAR_FAILED: 'Failure saving information into compressed output file', | ||
| ERROR_PROCFS_SAVE_FAILED: 'Saving of process information failed'} | ||
|
|
||
| cmd = ['/usr/local/bin/generate_dump'] | ||
| if date: | ||
| cmd.append("-s") | ||
| cmd.append(date) | ||
|
|
||
| try: | ||
| rc = 0 | ||
| output = subprocess.check_output(cmd) | ||
|
kerry-meyer marked this conversation as resolved.
Outdated
kerry-meyer marked this conversation as resolved.
Outdated
|
||
|
|
||
| except subprocess.CalledProcessError as err: | ||
| rc = err.returncode | ||
| errmsg = err_dict.get(rc) | ||
|
|
||
| if errmsg is None: | ||
| output = 'Error: Failure code {:-5}'.format(rc) | ||
| else: | ||
| output = errmsg | ||
|
|
||
| print("%Error: Host side: Failed: " + str(rc)) | ||
| return rc, output | ||
|
|
||
| output_string = output.decode("utf-8") | ||
|
kerry-meyer marked this conversation as resolved.
Outdated
|
||
| output_file_match = re.search('\/var\/.*dump.*\.gz', output_string) | ||
| if output_file_match is not None: | ||
|
kerry-meyer marked this conversation as resolved.
Outdated
|
||
| output_filename = output_file_match.group() | ||
| else: | ||
| output_filename = "" | ||
| return rc, output_filename | ||
|
|
||
| def register(): | ||
| """Return the class name""" | ||
| return Showtech, MOD_NAME | ||
|
|
||
Submodule sonic-mgmt-common
updated
from 86c110 to 6f643d
Submodule sonic-mgmt-framework
updated
from 3c3384 to 8e7133
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.
Uh oh!
There was an error while loading. Please reload this page.