forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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>
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
class TestAclCli: | ||
def test_AddTableMultipleTimes(self, dvs, dvs_acl): | ||
dvs.runcmd("config acl add table TEST L3 -p Ethernet0") | ||
|
||
cdb = dvs.get_config_db() | ||
cdb.wait_for_field_match( | ||
"ACL_TABLE", | ||
"TEST", | ||
{"ports": "Ethernet0"} | ||
) | ||
|
||
# Verify that subsequent updates don't delete "ports" from config DB | ||
dvs.runcmd("config acl add table TEST L3 -p Ethernet4") | ||
cdb.wait_for_field_match( | ||
"ACL_TABLE", | ||
"TEST", | ||
{"ports": "Ethernet4"} | ||
) | ||
|
||
# Verify that subsequent updates propagate to ASIC DB | ||
L3_BIND_PORTS = ["Ethernet0", "Ethernet4", "Ethernet8", "Ethernet12"] | ||
dvs.runcmd(f"config acl add table TEST L3 -p {','.join(L3_BIND_PORTS)}") | ||
acl_table_id = dvs_acl.get_acl_table_ids(1)[0] | ||
acl_table_group_ids = dvs_acl.get_acl_table_group_ids(len(L3_BIND_PORTS)) | ||
|
||
dvs_acl.verify_acl_table_group_members(acl_table_id, acl_table_group_ids, 1) | ||
dvs_acl.verify_acl_table_port_binding(acl_table_id, L3_BIND_PORTS, 1) | ||
|
||
|
||
# Add Dummy always-pass test at end as workaroud | ||
# for issue when Flaky fail on final test it invokes module tear-down before retrying | ||
def test_nonflaky_dummy(): | ||
pass |