Skip to content

Commit

Permalink
Fix acl match ip_type_non_ipv4 and ip_type_non_ipv6.
Browse files Browse the repository at this point in the history
Signed-off-by: LTeng <[email protected]>
  • Loading branch information
LGH-12 committed Jul 3, 2023
1 parent ffce926 commit d00b158
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions orchagent/aclorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
#define IP_TYPE_IP "IP"
#define IP_TYPE_NON_IP "NON_IP"
#define IP_TYPE_IPv4ANY "IPV4ANY"
#define IP_TYPE_NON_IPv4 "NON_IPv4"
#define IP_TYPE_NON_IPv4 "NON_IPV4"
#define IP_TYPE_IPv6ANY "IPV6ANY"
#define IP_TYPE_NON_IPv6 "NON_IPv6"
#define IP_TYPE_NON_IPv6 "NON_IPV6"
#define IP_TYPE_ARP "ARP"
#define IP_TYPE_ARP_REQUEST "ARP_REQUEST"
#define IP_TYPE_ARP_REPLY "ARP_REPLY"
Expand Down
32 changes: 32 additions & 0 deletions tests/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,22 @@ def test_AclRuleVlanId(self, dvs_acl, l3_acl_table):
dvs_acl.verify_acl_rule_status(L3_TABLE_NAME, L3_RULE_NAME, None)
dvs_acl.verify_no_acl_rules()

def test_AclRuleIPTypeNonIpv4(self, dvs_acl, l3_acl_table):
config_qualifiers = {"IP_TYPE": "NON_IPv4"}
expected_sai_qualifiers = {
"SAI_ACL_ENTRY_ATTR_FIELD_ACL_IP_TYPE": dvs_acl.get_simple_qualifier_comparator("SAI_ACL_IP_TYPE_NON_IPV4&mask:0xffffffffffffffff")
}

dvs_acl.create_acl_rule(L3_TABLE_NAME, L3_RULE_NAME, config_qualifiers)
# Verify status is written into STATE_DB
dvs_acl.verify_acl_rule_status(L3_TABLE_NAME, L3_RULE_NAME, "Active")
dvs_acl.verify_acl_rule(expected_sai_qualifiers)

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

def test_V6AclTableCreationDeletion(self, dvs_acl):
try:
dvs_acl.create_acl_table(L3V6_TABLE_NAME,
Expand All @@ -332,6 +348,22 @@ def test_V6AclTableCreationDeletion(self, dvs_acl):
dvs_acl.verify_acl_table_status(L3V6_TABLE_NAME, None)
dvs_acl.verify_acl_table_count(0)

def test_V6AclRuleIPTypeNonIpv6(self, dvs_acl, l3v6_acl_table):
config_qualifiers = {"IP_TYPE": "NON_IPv6"}
expected_sai_qualifiers = {
"SAI_ACL_ENTRY_ATTR_FIELD_ACL_IP_TYPE": dvs_acl.get_simple_qualifier_comparator("SAI_ACL_IP_TYPE_NON_IPV6&mask:0xffffffffffffffff")
}

dvs_acl.create_acl_rule(L3V6_TABLE_NAME, L3V6_RULE_NAME, config_qualifiers)
# Verify status is written into STATE_DB
dvs_acl.verify_acl_rule_status(L3V6_TABLE_NAME, L3V6_RULE_NAME, "Active")
dvs_acl.verify_acl_rule(expected_sai_qualifiers)

dvs_acl.remove_acl_rule(L3V6_TABLE_NAME, L3V6_RULE_NAME)
# Verify the STATE_DB entry is removed
dvs_acl.verify_acl_rule_status(L3V6_TABLE_NAME, L3V6_RULE_NAME, None)
dvs_acl.verify_no_acl_rules()

def test_V6AclRuleIPv6Any(self, dvs_acl, l3v6_acl_table):
config_qualifiers = {"IP_TYPE": "IPv6ANY"}
expected_sai_qualifiers = {
Expand Down

0 comments on commit d00b158

Please sign in to comment.