From 1b916c318e8cab26a363f6e951d1a41e90bb13ff Mon Sep 17 00:00:00 2001 From: Danny Allen Date: Mon, 19 Apr 2021 10:57:30 -0700 Subject: [PATCH] [acl] Add regression test for `config acl` CLI command (#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 --- tests/test_acl_cli.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/test_acl_cli.py diff --git a/tests/test_acl_cli.py b/tests/test_acl_cli.py new file mode 100644 index 000000000000..02785314d28a --- /dev/null +++ b/tests/test_acl_cli.py @@ -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