Skip to content

Commit

Permalink
Revert "[202205][show] Add bgpraw to show run all (#2609)"
Browse files Browse the repository at this point in the history
This reverts commit 2419145.
  • Loading branch information
yxieca committed Jan 23, 2023
1 parent 2419145 commit 1e3f38d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 76 deletions.
28 changes: 3 additions & 25 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
import utilities_common.multi_asic as multi_asic_util
from importlib import reload
from natsort import natsorted
from sonic_py_common import device_info, multi_asic
from sonic_py_common import device_info
from swsscommon.swsscommon import SonicV2Connector, ConfigDBConnector
from tabulate import tabulate
from utilities_common import util_base
from utilities_common.db import Db
from datetime import datetime
import utilities_common.constants as constants
from utilities_common.general import load_db_config
from json.decoder import JSONDecodeError

# mock the redis for unit test purposes #
try:
Expand Down Expand Up @@ -128,10 +127,6 @@ def run_command(command, display_cmd=False, return_cmd=False):
if rc != 0:
sys.exit(rc)

def get_cmd_output(cmd):
proc = subprocess.Popen(cmd, text=True, stdout=subprocess.PIPE)
return proc.communicate()[0], proc.returncode

# Lazy global class instance for SONiC interface name to alias conversion
iface_alias_converter = lazy_object_proxy.Proxy(lambda: clicommon.InterfaceAliasConverter())

Expand Down Expand Up @@ -1234,25 +1229,8 @@ def runningconfiguration():
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def all(verbose):
"""Show full running configuration"""
cmd = ['sonic-cfggen', '-d', '--print-data']
stdout, rc = get_cmd_output(cmd)
if rc:
click.echo("Failed to get cmd output '{}':rc {}".format(cmd, rc))
raise click.Abort()

try:
output = json.loads(stdout)
except JSONDecodeError as e:
click.echo("Failed to load output '{}':{}".format(cmd, e))
raise click.Abort()

if not multi_asic.is_multi_asic():
bgpraw_cmd = [constants.RVTYSH_COMMAND, '-c', 'show running-config']
bgpraw, rc = get_cmd_output(bgpraw_cmd)
if rc:
bgpraw = ""
output['bgpraw'] = bgpraw
click.echo(json.dumps(output, indent=4))
cmd = "sonic-cfggen -d --print-data"
run_command(cmd, display_cmd=verbose)


# 'acl' subcommand ("show runningconfiguration acl")
Expand Down
51 changes: 0 additions & 51 deletions tests/show_test.py

This file was deleted.

0 comments on commit 1e3f38d

Please sign in to comment.