Skip to content

Commit b59f388

Browse files
[sonic-acl.yang] Add new ACL key BTH_OPCODE and AETH_SYNDROME (#13340)
- Why I did it Add new ACL key BTH_OPCODE and AETH_SYNDROME - How I did it Add new ACL key BTH_OPCODE and AETH_SYNDROME - How to verify it manual test unit test
1 parent fdfb359 commit b59f388

File tree

4 files changed

+87
-1
lines changed

4 files changed

+87
-1
lines changed

src/sonic-yang-models/tests/files/sample_config_db.json

+11-1
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@
314314
"PACKET_ACTION": "DROP",
315315
"IP_TYPE": "IPv4ANY",
316316
"SRC_IP": "1.1.1.1/32"
317+
},
318+
"DATAACL|RULE1": {
319+
"PRIORITY": "999",
320+
"PACKET_ACTION": "FORWARD",
321+
"IP_TYPE": "IPv4ANY",
322+
"SRC_IP": "1.1.1.1/32",
323+
"BTH_OPCODE": "0x11/0xbf",
324+
"AETH_SYNDROME": "0x60/0x60"
317325
}
318326
},
319327
"DEVICE_METADATA": {
@@ -2076,7 +2084,9 @@
20762084
"matches": [
20772085
"IN_PORTS",
20782086
"OUT_PORTS",
2079-
"SRC_IP"
2087+
"SRC_IP",
2088+
"BTH_OPCODE",
2089+
"AETH_SYNDROME"
20802090
],
20812091
"actions": [
20822092
"PACKET_ACTION",

src/sonic-yang-models/tests/yang_model_tests/tests/acl.json

+8
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,13 @@
132132
},
133133
"ACL_RULE_VALID_TCP_FLAGS": {
134134
"desc": "Configure ACL_RULE with valid TCP_FLAGS."
135+
},
136+
"ACL_RULE_WRONG_BTH_OPCODE": {
137+
"desc": "Configure invalid BTH_OPCODE in decimal format.",
138+
"eStrKey" : "Pattern"
139+
},
140+
"ACL_RULE_WRONG_AETH_SYNDROME": {
141+
"desc": "Configure invalid AETH_SYNDROME in decimal format.",
142+
"eStrKey" : "Pattern"
135143
}
136144
}

src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json

+54
Original file line numberDiff line numberDiff line change
@@ -1039,5 +1039,59 @@
10391039
]
10401040
}
10411041
}
1042+
},
1043+
"ACL_RULE_WRONG_BTH_OPCODE": {
1044+
"sonic-acl:sonic-acl": {
1045+
"sonic-acl:ACL_RULE": {
1046+
"ACL_RULE_LIST": [
1047+
{
1048+
"ACL_TABLE_NAME": "BTH_OPCODE_TEST",
1049+
"ETHER_TYPE": "2048",
1050+
"PACKET_ACTION": "DROP",
1051+
"PRIORITY": 9981,
1052+
"BTH_OPCODE": "0x24",
1053+
"RULE_NAME": "Rule_19"
1054+
}
1055+
]
1056+
},
1057+
"sonic-acl:ACL_TABLE": {
1058+
"ACL_TABLE_LIST": [
1059+
{
1060+
"ACL_TABLE_NAME": "BTH_OPCODE_TEST",
1061+
"policy_desc": "BTH_OPCODE_TEST",
1062+
"ports": [ "" ],
1063+
"stage": "INGRESS",
1064+
"type": "L3"
1065+
}
1066+
]
1067+
}
1068+
}
1069+
},
1070+
"ACL_RULE_WRONG_AETH_SYNDROME": {
1071+
"sonic-acl:sonic-acl": {
1072+
"sonic-acl:ACL_RULE": {
1073+
"ACL_RULE_LIST": [
1074+
{
1075+
"ACL_TABLE_NAME": "AETH_SYNDROME_TEST",
1076+
"ETHER_TYPE": "2048",
1077+
"PACKET_ACTION": "DROP",
1078+
"PRIORITY": 9981,
1079+
"AETH_SYNDROME": "0x24",
1080+
"RULE_NAME": "Rule_19"
1081+
}
1082+
]
1083+
},
1084+
"sonic-acl:ACL_TABLE": {
1085+
"ACL_TABLE_LIST": [
1086+
{
1087+
"ACL_TABLE_NAME": "AETH_SYNDROME_TEST",
1088+
"policy_desc": "AETH_SYNDROME_TEST",
1089+
"ports": [ "" ],
1090+
"stage": "INGRESS",
1091+
"type": "L3"
1092+
}
1093+
]
1094+
}
1095+
}
10421096
}
10431097
}

src/sonic-yang-models/yang-templates/sonic-acl.yang.j2

+14
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,20 @@ module sonic-acl {
268268
range "0..1";
269269
}
270270
}
271+
272+
leaf BTH_OPCODE {
273+
description "RoCEv2 BTH OPCODE field";
274+
type string {
275+
pattern '0[xX][0-9a-fA-F]{1,2}/0[xX][0-9a-fA-F]{1,2}';
276+
}
277+
}
278+
279+
leaf AETH_SYNDROME {
280+
description "RoCEv2 AETH SYNDROME field";
281+
type string {
282+
pattern '0[xX][0-9a-fA-F]{1,2}/0[xX][0-9a-fA-F]{1,2}';
283+
}
284+
}
271285
}
272286
/* end of ACL_RULE_LIST */
273287
}

0 commit comments

Comments
 (0)