[yang] Fixing Ethertype field regex in acl rule yang to accept decimal values (#10108)
#### Why I did it Fixing issue https://github.com/Azure/sonic-buildimage/issues/9991 The ACL RULE table field ETHER_TYPE can accept both hex as well as decimal values. However yang model didn't allow decimal values. Fixed it to allow decimal values (same pattern as in hex (1536-65535) #### How I did it Updated yang model to handle decimal values #### How to verify it Added UT to verify it.
This commit is contained in:
parent
e1f57db818
commit
52c2a3ad23
@ -150,7 +150,8 @@
|
|||||||
"V4-ACL-TABLE|DEFAULT_DENY": {
|
"V4-ACL-TABLE|DEFAULT_DENY": {
|
||||||
"PACKET_ACTION": "DROP",
|
"PACKET_ACTION": "DROP",
|
||||||
"IP_TYPE": "IPv4ANY",
|
"IP_TYPE": "IPv4ANY",
|
||||||
"PRIORITY": "0"
|
"PRIORITY": "0",
|
||||||
|
"ETHER_TYPE": "2048"
|
||||||
},
|
},
|
||||||
"V4-ACL-TABLE|Rule_20": {
|
"V4-ACL-TABLE|Rule_20": {
|
||||||
"PACKET_ACTION": "FORWARD",
|
"PACKET_ACTION": "FORWARD",
|
||||||
|
@ -100,7 +100,14 @@
|
|||||||
"eStrKey" : "Pattern"
|
"eStrKey" : "Pattern"
|
||||||
},
|
},
|
||||||
"ACL_RULE_L2_INVALID_ETHER": {
|
"ACL_RULE_L2_INVALID_ETHER": {
|
||||||
"desc": "Configure invalid MAC address format.",
|
"desc": "Configure invalid ethertype.",
|
||||||
|
"eStrKey" : "Pattern"
|
||||||
|
},
|
||||||
|
"ACL_RULE_L2_VALID_ETHER_IN_DECIMAL": {
|
||||||
|
"desc": "Configure valid ethertype in decimal format."
|
||||||
|
},
|
||||||
|
"ACL_RULE_L2_INVALID_ETHER_IN_DECIMAL": {
|
||||||
|
"desc": "Configure invalid ethertype in decimal format.",
|
||||||
"eStrKey" : "Pattern"
|
"eStrKey" : "Pattern"
|
||||||
},
|
},
|
||||||
"ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": {
|
"ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": {
|
||||||
|
@ -768,8 +768,8 @@
|
|||||||
"ACL_RULE_LIST": [
|
"ACL_RULE_LIST": [
|
||||||
{
|
{
|
||||||
"ACL_TABLE_NAME": "L2ACL_INVALID_ETHER",
|
"ACL_TABLE_NAME": "L2ACL_INVALID_ETHER",
|
||||||
"SRC_MAC": "00.00.AB.CD.EF.00/FF.FF.FF.00.00.00",
|
"SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00",
|
||||||
"DST_MAC": "00.00.AB.CD.EF.FF/FF.FF.FF.FF.FF.FF",
|
"DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF",
|
||||||
"ETHER_TYPE": "64",
|
"ETHER_TYPE": "64",
|
||||||
"PACKET_ACTION": "FORWARD",
|
"PACKET_ACTION": "FORWARD",
|
||||||
"PRIORITY": 999980,
|
"PRIORITY": 999980,
|
||||||
@ -790,6 +790,62 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ACL_RULE_L2_VALID_ETHER_IN_DECIMAL": {
|
||||||
|
"sonic-acl:sonic-acl": {
|
||||||
|
"sonic-acl:ACL_RULE": {
|
||||||
|
"ACL_RULE_LIST": [
|
||||||
|
{
|
||||||
|
"ACL_TABLE_NAME": "L2ACL_VALID_ETHER_DECIMAL",
|
||||||
|
"SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00",
|
||||||
|
"DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF",
|
||||||
|
"ETHER_TYPE": "2048",
|
||||||
|
"PACKET_ACTION": "FORWARD",
|
||||||
|
"PRIORITY": 999980,
|
||||||
|
"RULE_NAME": "Rule_20"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sonic-acl:ACL_TABLE": {
|
||||||
|
"ACL_TABLE_LIST": [
|
||||||
|
{
|
||||||
|
"ACL_TABLE_NAME": "L2ACL_VALID_ETHER_DECIMAL",
|
||||||
|
"policy_desc": "L2ACL Test",
|
||||||
|
"ports": [ "" ],
|
||||||
|
"stage": "INGRESS",
|
||||||
|
"type": "L2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ACL_RULE_L2_INVALID_ETHER_IN_DECIMAL": {
|
||||||
|
"sonic-acl:sonic-acl": {
|
||||||
|
"sonic-acl:ACL_RULE": {
|
||||||
|
"ACL_RULE_LIST": [
|
||||||
|
{
|
||||||
|
"ACL_TABLE_NAME": "L2ACL_INVALID_ETHER_DECIMAL",
|
||||||
|
"SRC_MAC": "00:00:AB:CD:EF:00/FF:FF:FF:00:00:00",
|
||||||
|
"DST_MAC": "00:00:AB:CD:EF:FF/FF:FF:FF:FF:FF:FF",
|
||||||
|
"ETHER_TYPE": "66789",
|
||||||
|
"PACKET_ACTION": "FORWARD",
|
||||||
|
"PRIORITY": 999980,
|
||||||
|
"RULE_NAME": "Rule_20"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sonic-acl:ACL_TABLE": {
|
||||||
|
"ACL_TABLE_LIST": [
|
||||||
|
{
|
||||||
|
"ACL_TABLE_NAME": "L2ACL_INVALID_ETHER_DECIMAL",
|
||||||
|
"policy_desc": "L2ACL Test",
|
||||||
|
"ports": [ "" ],
|
||||||
|
"stage": "INGRESS",
|
||||||
|
"type": "L2"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": {
|
"ACL_PACKET_ACTION_VALIDATE_VALUE_ACCEPT": {
|
||||||
"sonic-acl:sonic-acl": {
|
"sonic-acl:sonic-acl": {
|
||||||
"sonic-acl:ACL_RULE": {
|
"sonic-acl:ACL_RULE": {
|
||||||
|
@ -168,7 +168,7 @@ module sonic-acl {
|
|||||||
|
|
||||||
leaf ETHER_TYPE {
|
leaf ETHER_TYPE {
|
||||||
type string {
|
type string {
|
||||||
pattern "0x0[6-9a-fA-F][0-9a-fA-F]{2}|0x[1-9a-fA-F][0-9a-fA-F]{3}";
|
pattern "0x0[6-9a-fA-F][0-9a-fA-F]{2}|0x[1-9a-fA-F][0-9a-fA-F]{3}|153[6-9]|15[4-9][0-9]|1[6-9][0-9][0-9]|[2-9][0-9]{3}|[1-5][0-9]{4}|6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user