-
Notifications
You must be signed in to change notification settings - Fork 667
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
[show] Add bgpraw to show run all #2537
Changes from 3 commits
be4aa05
4bc7e7b
bcdfe21
80d63dc
ed1cce3
a69380d
f5fc969
1070c59
3c5b6f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1384,7 +1384,12 @@ def runningconfiguration(): | |
def all(verbose): | ||
"""Show full running configuration""" | ||
cmd = "sonic-cfggen -d --print-data" | ||
run_command(cmd, display_cmd=verbose) | ||
output = json.loads(run_command(cmd, display_cmd=verbose, return_cmd=True)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if not multi_asic.is_multi_asic(): | ||
bgpraw_cmd = "sudo {} -c 'show running-config'".format(constants.RVTYSH_COMMAND) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. I think if we use |
||
bgpraw = run_command(bgpraw_cmd, display_cmd=verbose, return_cmd=True) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if the bgp container is down, bgpraw will contain error messge. Do we want to store that or make There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty running-config value for bgp down is a good suggestion. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The run_command was calling subprocess. The output will be empty though subprocess calling is error. |
||
output['bgpraw'] = bgpraw | ||
wen587 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
click.echo(json.dumps(output, indent=4)) | ||
wen587 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
# 'acl' subcommand ("show runningconfiguration acl") | ||
|
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.
Should we check the output of run_command?
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.
You mean the format of output or bgpraw in output?
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.
geoffrey@vm-04:~$ python3
Python 3.6.9 (default, Nov 25 2022, 14:10:45)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
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.
Maybe that should be checked in sonic-cfggen?
sonic-cfggen guarantees that
--print-data
could be json.dump.