Skip to content
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

[pretest] Testcase to validate backend acl load #12510

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tests/test_pretest.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,22 @@ def prepare_autonegtest_params(duthosts, fanouthosts):
"""


def test_backend_acl_load(duthosts, enum_dut_hostname, tbinfo):
duthost = duthosts[enum_dut_hostname]
pytest_require("t0-backend" in tbinfo["topo"]["name"],
"Skip 'test_backend_acl_load' on non t0-backend testbeds.")
out = duthost.command("systemctl restart backend-acl.service")
pytest_assert(out["rc"] == 0, "Failed to load backend acl: {}".format(out["stderr"]))
rules = duthost.show_and_parse("show acl rule DATAACL")
for rule in rules:
if "DATAACL" not in rule["table"]:
continue
if ((rule["rule"].startswith("RULE") and rule["action"] != "FORWARD")
or (rule["rule"].startswith("DEFAULT") and rule["action"] != "DROP")
or rule["status"] != "Active"):
pytest.fail("Backend acl not installed succesfully: {}".format(rule))


# This one is special. It is public, but we need to ensure that it is the last one executed in pre-test.
def test_generate_running_golden_config(duthosts):
"""
Expand Down
Loading