Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix yang model for ICMP and ICMPV6 #18311

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/acl.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
"ACL_RULE_WITH_VALID_OUT_PORTS": {
"desc": "Configure ACL_RULE with valid OUT_PORTS."
},
"ACL_RULE_WITH_VALID_ICMPV4_CODE": {
"desc": "Configure ACL_RULE with valid ICMPV4 type and code."
},
"ACL_RULE_WITH_VALID_ICMPV6_CODE": {
"desc": "Configure ACL_RULE with valid ICMPV6 type and code."
},
"ACL_TABLE_EMPTY_PORTS": {
"desc": "Configure ACL_TABLE with empty ports."
},
Expand Down
110 changes: 110 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/acl.json
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,116 @@
}
}
},
"ACL_RULE_WITH_VALID_ICMPV4_CODE": {
"sonic-acl:sonic-acl": {
"sonic-acl:ACL_RULE": {
"ACL_RULE_LIST": [
{
"ACL_TABLE_NAME": "NO-NSW-PACL-V4",
"ICMP_CODE": 0,
"ICMP_TYPE": 0,
"IP_TYPE": "IPV4",
"PACKET_ACTION": "FORWARD",
"PRIORITY": 999960,
"RULE_NAME": "Rule_40"
}
]
},
"sonic-acl:ACL_TABLE": {
"ACL_TABLE_LIST": [
{
"ACL_TABLE_NAME": "NO-NSW-PACL-V4",
"policy_desc": "Filter IPv4",
"ports": [
"Ethernet0",
"Ethernet1"
],
"stage": "EGRESS",
"type": "L3"
}
]
}
},
"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
},
{
"admin_status": "up",
"alias": "eth1",
"description": "Ethernet1",
"lanes": "4,5,6,7",
"mtu": 9000,
"name": "Ethernet1",
"speed": 25000
}
]
}
}
},
"ACL_RULE_WITH_VALID_ICMPV6_CODE": {
"sonic-acl:sonic-acl": {
"sonic-acl:ACL_RULE": {
"ACL_RULE_LIST": [
{
"ACL_TABLE_NAME": "NO-NSW-PACL-V6",
"ICMPV6_CODE": 0,
"ICMPV6_TYPE": 129,
"IP_TYPE": "IPV6",
"PACKET_ACTION": "FORWARD",
"PRIORITY": 999960,
"RULE_NAME": "Rule_40"
}
]
},
"sonic-acl:ACL_TABLE": {
"ACL_TABLE_LIST": [
{
"ACL_TABLE_NAME": "NO-NSW-PACL-V6",
"policy_desc": "Filter IPv6",
"ports": [
"Ethernet0",
"Ethernet1"
],
"stage": "EGRESS",
"type": "L3"
}
]
}
},
"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
},
{
"admin_status": "up",
"alias": "eth1",
"description": "Ethernet1",
"lanes": "4,5,6,7",
"mtu": 9000,
"name": "Ethernet1",
"speed": 25000
}
]
}
}
},
"ACL_TABLE_DEFAULT_VALUE_STAGE": {
"sonic-acl:sonic-acl": {
"sonic-acl:ACL_TABLE": {
Expand Down
8 changes: 4 additions & 4 deletions src/sonic-yang-models/yang-templates/sonic-acl.yang.j2
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ module sonic-acl {
when "not(IP_TYPE) or boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV4' or .='IPv4ANY' or .='ARP'])";
leaf ICMP_TYPE {
type uint8 {
range 1..44;
range 0..255;
}
}

leaf ICMP_CODE {
type uint8 {
range 1..16;
range 0..255;
}
}
}
Expand All @@ -217,13 +217,13 @@ module sonic-acl {
when "not(IP_TYPE) or boolean(IP_TYPE[.='ANY' or .='IP' or .='IPV6' or .='IPv6ANY'])";
leaf ICMPV6_TYPE {
type uint8 {
range 1..44;
range 0..255;
}
}

leaf ICMPV6_CODE {
type uint8 {
range 1..16;
range 0..255;
}
}
}
Expand Down
Loading