Skip to content

Commit 1b916c3

Browse files
authored
[acl] Add regression test for config acl CLI command (sonic-net#1694)
Add a new test case to catch the bug where calling "config acl add table" multiple times causes the "ports" field to be deleted from config DB. Signed-off-by: Danny Allen <daall@microsoft.com>
1 parent 8bc7aee commit 1b916c3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tests/test_acl_cli.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
class TestAclCli:
2+
def test_AddTableMultipleTimes(self, dvs, dvs_acl):
3+
dvs.runcmd("config acl add table TEST L3 -p Ethernet0")
4+
5+
cdb = dvs.get_config_db()
6+
cdb.wait_for_field_match(
7+
"ACL_TABLE",
8+
"TEST",
9+
{"ports": "Ethernet0"}
10+
)
11+
12+
# Verify that subsequent updates don't delete "ports" from config DB
13+
dvs.runcmd("config acl add table TEST L3 -p Ethernet4")
14+
cdb.wait_for_field_match(
15+
"ACL_TABLE",
16+
"TEST",
17+
{"ports": "Ethernet4"}
18+
)
19+
20+
# Verify that subsequent updates propagate to ASIC DB
21+
L3_BIND_PORTS = ["Ethernet0", "Ethernet4", "Ethernet8", "Ethernet12"]
22+
dvs.runcmd(f"config acl add table TEST L3 -p {','.join(L3_BIND_PORTS)}")
23+
acl_table_id = dvs_acl.get_acl_table_ids(1)[0]
24+
acl_table_group_ids = dvs_acl.get_acl_table_group_ids(len(L3_BIND_PORTS))
25+
26+
dvs_acl.verify_acl_table_group_members(acl_table_id, acl_table_group_ids, 1)
27+
dvs_acl.verify_acl_table_port_binding(acl_table_id, L3_BIND_PORTS, 1)
28+
29+
30+
# Add Dummy always-pass test at end as workaroud
31+
# for issue when Flaky fail on final test it invokes module tear-down before retrying
32+
def test_nonflaky_dummy():
33+
pass

0 commit comments

Comments
 (0)