Skip to content

Add ACL_TABLE in show runningconfiguration acl #2339

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

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
2 changes: 2 additions & 0 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1363,6 +1363,8 @@ def all(verbose):
@click.option('--verbose', is_flag=True, help="Enable verbose output")
def acl(verbose):
"""Show acl running configuration"""
cmd = "sonic-cfggen -d --var-json ACL_TABLE"
run_command(cmd, display_cmd=verbose)
cmd = "sonic-cfggen -d --var-json ACL_RULE"
run_command(cmd, display_cmd=verbose)

Expand Down
14 changes: 13 additions & 1 deletion tests/acl_config_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import pytest

import config.main as config
import show.main as show

from click.testing import CliRunner
from config.main import expand_vlan_ports, parse_acl_table_info

from utilities_common.db import Db

class TestConfigAcl(object):
def test_expand_vlan(self):
Expand Down Expand Up @@ -79,3 +80,14 @@ def test_acl_add_table_empty_vlan(self):

assert result.exit_code != 0
assert "Cannot bind empty VLAN Vlan3000" in result.output

def test_acl_show_runningconfiguration(self):
runner = CliRunner()
db = Db()
table_info = parse_acl_table_info("TEST", "L3", None, "Ethernet20", "ingress")
db.cfgdb.set_entry("ACL_TABLE", "TEST", table_info)
result = runner.invoke(show.cli.commands["runningconfiguration"].commands["acl"], [], obj=db)
print(result.exit_code)
print(result.output)
#assert result.exit_code == 0
#assert "TEST" in result.output