From dc52015ca5effac21ba6946ae6aacc7aabd7aafa Mon Sep 17 00:00:00 2001 From: Prem Prakash Date: Tue, 25 Jun 2019 12:21:30 -0700 Subject: [PATCH] [Sonic-utilities]: Added commands to view acl and port running configs (#557) [show] Add commands to view acl and port running configs --- doc/Command-Reference.md | 34 +++++++++++++++++++++++++++++++++- show/main.py | 23 +++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/doc/Command-Reference.md b/doc/Command-Reference.md index 6e396502890d..6e8830573150 100644 --- a/doc/Command-Reference.md +++ b/doc/Command-Reference.md @@ -2785,6 +2785,8 @@ This sub-section explains the show commands for displaying the running configura 3) ntp 4) snmp 5) all +6) acl +7) interface **show runningconfiguration all** @@ -2851,6 +2853,36 @@ This command displays the running configuration of the snmp module. admin@sonic:~$ show runningconfiguration snmp ``` +**show runningconfiguration acl** + +This command displays the running configuration of the acls + + - Usage: + show runningconfiguration acl + + +- Example: + ``` + admin@sonic:~$ show runningconfiguration acl + ``` + +**show runningconfiguration interface ** + +This command displays the running configuration of the ports + + - Usage: + show runningconfiguration interface + + +- Example: + ``` + admin@sonic:~$ show runningconfiguration interface + ``` + + ``` + admin@sonic:~$ show runningconfiguration interface + ``` + Go Back To [Beginning of the document](#SONiC-COMMAND-LINE-INTERFACE-GUIDE) or [Beginning of this section](#Startup--Running-Configuration) @@ -3677,4 +3709,4 @@ Once if users go to "vtysh", they can use the routing stack specific commands as Refer the routing stack [Quagga Command Reference](https://www.quagga.net/docs/quagga.pdf) or [FRR Command Reference](https://buildmedia.readthedocs.org/media/pdf/frrouting/latest/frrouting.pdf) to know more about about the routing stack configuration. -Go Back To [Beginning of the document](#SONiC-COMMAND-LINE-INTERFACE-GUIDE) \ No newline at end of file +Go Back To [Beginning of the document](#SONiC-COMMAND-LINE-INTERFACE-GUIDE) diff --git a/show/main.py b/show/main.py index b55184fe9e74..402a6b7641a7 100755 --- a/show/main.py +++ b/show/main.py @@ -1329,6 +1329,29 @@ def all(verbose): run_command(cmd, display_cmd=verbose) +# 'acl' subcommand ("show runningconfiguration acl") +@runningconfiguration.command() +@click.option('--verbose', is_flag=True, help="Enable verbose output") +def acl(verbose): + """Show acl running configuration""" + cmd = "sonic-cfggen -d --var-json ACL_RULE" + run_command(cmd, display_cmd=verbose) + + +# 'interface' subcommand ("show runningconfiguration interface ") +@runningconfiguration.command() +@click.argument('interfacename', required=False) +@click.option('--verbose', is_flag=True, help="Enable verbose output") +def interface(interfacename, verbose): + """Show port running configuration""" + cmd = "sonic-cfggen -d --var-json PORT" + + if interfacename is not None: + cmd += " {0} {1}".format("--interface", interfacename) + + run_command(cmd, display_cmd=verbose) + + # 'bgp' subcommand ("show runningconfiguration bgp") @runningconfiguration.command() @click.option('--verbose', is_flag=True, help="Enable verbose output")