Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
bingwang-ms committed Mar 8, 2023
1 parent 08b4583 commit 4039117
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
5 changes: 3 additions & 2 deletions orchagent/aclorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4345,22 +4345,22 @@ void AclOrch::doAclTableTask(Consumer &consumer)
{
SWSS_LOG_NOTICE("Successfully updated existing ACL table %s",
table_id.c_str());
// Mark ACL table as ACTIVE
setAclTableStatus(table_id, AclObjectStatus::ACTIVE);
it = consumer.m_toSync.erase(it);
}
else
{
SWSS_LOG_ERROR("Failed to update existing ACL table %s",
table_id.c_str());
// For now, updateAclTable always return true. So we should never reach here
setAclTableStatus(table_id, AclObjectStatus::INACTIVE);
it++;
}
}
else
{
if (addAclTable(newTable))
{
// Mark ACL table as ACTIVE
setAclTableStatus(table_id, AclObjectStatus::ACTIVE);
it = consumer.m_toSync.erase(it);
}
Expand All @@ -4384,6 +4384,7 @@ void AclOrch::doAclTableTask(Consumer &consumer)
{
if (removeAclTable(table_id))
{
// Remove ACL table status from STATE_DB
removeAclTableStatus(table_id);
it = consumer.m_toSync.erase(it);
}
Expand Down
23 changes: 23 additions & 0 deletions tests/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ def test_AclTableCreationDeletion(self, dvs_acl):
# Verify the STATE_DB entry is removed
dvs_acl.verify_acl_table_status(L3_TABLE_NAME, None)

def test_InvalidAclTableCreationDeletion(self, dvs_acl):
try:
dvs_acl.create_acl_table("INVALID_ACL_TABLE", L3_TABLE_TYPE, "dummy_port", "invalid_stage")
# Verify status is written into STATE_DB
dvs_acl.verify_acl_table_status("INVALID_ACL_TABLE", "Inactive")
finally:
dvs_acl.remove_acl_table("INVALID_ACL_TABLE")
dvs_acl.verify_acl_table_count(0)
# Verify the STATE_DB entry is removed
dvs_acl.verify_acl_table_status("INVALID_ACL_TABLE", None)

def test_InvalidAclRuleCreation(self, dvs_acl, l3_acl_table):
config_qualifiers = {"INVALID_QUALIFIER": "TEST"}

dvs_acl.create_acl_rule(L3_TABLE_NAME, "INVALID_RULE", config_qualifiers)
# Verify status is written into STATE_DB
dvs_acl.verify_acl_rule_status(L3_TABLE_NAME, "INVALID_RULE", "Inactive")

dvs_acl.remove_acl_rule(L3_TABLE_NAME, "INVALID_RULE")
# Verify the STATE_DB entry is removed
dvs_acl.verify_acl_rule_status(L3_TABLE_NAME, "INVALID_RULE", None)
dvs_acl.verify_no_acl_rules()

def test_AclRuleL4SrcPort(self, dvs_acl, l3_acl_table):
config_qualifiers = {"L4_SRC_PORT": "65000"}
expected_sai_qualifiers = {
Expand Down

0 comments on commit 4039117

Please sign in to comment.