[YANG SONIC-ACL] Fix Yang definition of ACL_TABLE_TYPE (#16247)

How I did it
Update Yang definition of ACL_TABLE_TYPE.
Update existing testcase.
Add new testcase to cover lowercase key scenario.

How to verify it
Verified by building sonic_yang_models-1.0-py3-none-any.whl. While building the target package, unit tests were run and passed.
This commit is contained in:
Zhijian Li 2023-08-28 23:40:01 +08:00 committed by mssonicbld
parent 638cded2f6
commit 763f846e23
5 changed files with 69 additions and 15 deletions

View File

@ -2084,16 +2084,16 @@
},
"ACL_TABLE_TYPE": {
"CUSTOM_L3": {
"matches": [
"MATCHES": [
"IN_PORTS",
"OUT_PORTS",
"SRC_IP"
],
"actions": [
"ACTIONS": [
"PACKET_ACTION",
"MIRROR_INGRESS_ACTION"
],
"bind_points": [
"BIND_POINTS": [
"PORT",
"LAG"
]

View File

@ -48,6 +48,7 @@ class Test_yang_models:
'Range': ['does not satisfy', 'range'],
'MinElements': ['Too few'],
'MaxElements': ['Too many'],
'UnknownElement': ['Unknown element'],
'None': []
}

View File

@ -98,14 +98,18 @@
"eStrKey": "MinElements"
},
"ACL_TABLE_CUSTOM_TABLE_TYPE_NO_ACTIONS": {
"desc": "ACL_TABLE LOAD TABLE TYPE SUCCESSFULLY WITH NO ACTIONS.",
"desc": "ACL_TABLE LOAD TABLE TYPE WITH NO ACTIONS.",
"eStrKey" : "Verify",
"verify": {
"xpath": "/sonic-acl:sonic-acl/ACL_TABLE_TYPE/ACL_TABLE_TYPE_LIST[ACL_TABLE_TYPE_NAME='CUSTOM_L3']/ACL_TABLE_TYPE_NAME",
"key": "sonic-acl:actions",
"key": "sonic-acl:ACTIONS",
"value": [""]
}
},
"ACL_TABLE_CUSTOM_TABLE_TYPE_LOWERCASE_KEY": {
"desc": "ACL_TABLE LOAD TABLE TYPE WITH KEY ACTIONS/BIND_POINTS/MATCHES WRITTEN IN LOWERCASE.",
"eStrKey": "UnknownElement"
},
"ACL_TABLE_L2_ACL_FIELDS": {
"desc": "Configure L2 ACL with proper rule fields"
},

View File

@ -723,14 +723,14 @@
"ACL_TABLE_TYPE_LIST": [
{
"ACL_TABLE_TYPE_NAME": "CUSTOM_L3",
"matches": [
"MATCHES": [
"SRC_IP",
"IN_PORTS"
],
"actions": [
"ACTIONS": [
"PACKET_ACTION"
],
"bind_points": [
"BIND_POINTS": [
"PORT"
]
}
@ -772,10 +772,10 @@
"ACL_TABLE_TYPE_LIST": [
{
"ACL_TABLE_TYPE_NAME": "CUSTOM_L3",
"actions": [
"ACTIONS": [
"PACKET_ACTION"
],
"bind_points": [
"BIND_POINTS": [
"PORT"
]
}
@ -817,11 +817,11 @@
"ACL_TABLE_TYPE_LIST": [
{
"ACL_TABLE_TYPE_NAME": "CUSTOM_L3",
"matches": [
"MATCHES": [
"SRC_IP",
"IN_PORTS"
],
"actions": [
"ACTIONS": [
"PACKET_ACTION"
]
}
@ -845,6 +845,52 @@
}
},
"ACL_TABLE_CUSTOM_TABLE_TYPE_NO_ACTIONS": {
"sonic-acl:sonic-acl": {
"sonic-acl:ACL_TABLE": {
"ACL_TABLE_LIST": [
{
"ACL_TABLE_NAME": "NO-NSW-PACL-V6",
"policy_desc": "Filter IPv6",
"ports": [
"Ethernet0"
],
"stage": "EGRESS",
"type": "CUSTOM_L3"
}
]
},
"sonic-acl:ACL_TABLE_TYPE": {
"ACL_TABLE_TYPE_LIST": [
{
"ACL_TABLE_TYPE_NAME": "CUSTOM_L3",
"MATCHES": [
"SRC_IP",
"IN_PORTS"
],
"BIND_POINTS": [
"PORT"
]
}
]
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"lanes": "0,1,2,3",
"mtu": 9000,
"name": "Ethernet0",
"speed": 25000
}
]
}
}
},
"ACL_TABLE_CUSTOM_TABLE_TYPE_LOWERCASE_KEY": {
"sonic-acl:sonic-acl": {
"sonic-acl:ACL_TABLE": {
"ACL_TABLE_LIST": [
@ -867,6 +913,9 @@
"SRC_IP",
"IN_PORTS"
],
"actions": [
"PACKET_ACTION"
],
"bind_points": [
"PORT"
]

View File

@ -281,17 +281,17 @@ module sonic-acl {
type string;
}
leaf-list matches {
leaf-list MATCHES {
type string;
min-elements 1;
}
leaf-list actions {
leaf-list ACTIONS {
type string;
default "";
}
leaf-list bind_points {
leaf-list BIND_POINTS {
type enumeration {
enum PORT;
enum LAG;