Open okaravasi opened 1 month ago
Moving issue from sonic-utilities repo, here. Closing the original ticket (https://github.com/sonic-net/sonic-utilities/issues/3558) as duplicate.
Cannot repro in MSFT lab
admin@str2-7250-lc1-2:~$ show ver
SONiC Software Version: SONiC.20220532.72 SONiC OS Version: 11 Distribution: Debian 11.9 Kernel: 5.10.0-23-2-amd64 Build commit: 7766169087 Build date: Fri Oct 4 00:15:40 UTC 2024 Built by: azureuser@98b2318ac000000
Platform: x86_64-nokia_ixr7250e_36x400g-r0 HwSKU: Nokia-IXR7250E-36x100G ASIC: broadcom ASIC Count: 2 Serial Number: NS220304200 Model Number: 3HE12578AARA01 Hardware Revision: 56 Uptime: 15:54:33 up 4 days, 19:56, 1 user, load average: 1.52, 1.65, 1.73 Date: Wed 09 Oct 2024 15:54:33
admin@str2-7250-lc1-2:~$ cat acl.json [ { "op": "add", "path": "/asic1/ACL_RULE", "value": { "NTP_ACL|TEST_DROP": { "IP_PROTOCOL": "17", "L4_DST_PORT": "123", "IP_TYPE": "IP", "PACKET_ACTION": "DROP", "PRIORITY": "9998", "SRC_IP": "9.9.9.9/32" } } } ]
admin@str2-7250-lc1-2:~$ sudo config apply-patch acl.json sonic_yang(6):Note: Below table(s) have no YANG models: DHCP_SERVER sonic_yang(6):Note: Below table(s) have no YANG models: LOGGER sonic_yang(6):Note: Below table(s) have no YANG models: LOGGER Patch Applier: asic1: Patch application starting. Patch Applier: asic1: Patch: [{"op": "add", "path": "/ACL_RULE", "value": {"NTP_ACL|TEST_DROP": {"IP_PROTOCOL": "17", "L4_DST_PORT": "123", "IP_TYPE": "IP", "PACKET_ACTION": "DROP", "PRIORITY": "9998", "SRC_IP": "9.9.9.9/32"}}}] Patch Applier: asic1 getting current config db. Patch Applier: asic1: simulating the target full config after applying the patch. Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields Patch Applier: asic1: validating target config does not have empty tables, since they do not show up in ConfigDb. Patch Applier: asic1: sorting patch updates. Patch Applier: The asic1 patch was converted into 1 change: Patch Applier: asic1: applying 1 change in order: Patch Applier: * [{"op": "add", "path": "/ACL_RULE", "value": {"NTP_ACL|TEST_DROP": {"IP_PROTOCOL": "17", "L4_DST_PORT": "123", "IP_TYPE": "IP", "PACKET_ACTION": "DROP", "PRIORITY": "9998", "SRC_IP": "9.9.9.9/32"}}}] Patch Applier: asic1: verifying patch updates are reflected on ConfigDB. Patch Applier: asic1 patch application completed. Patch applied successfully.
config db looks like: "asic1": { "ACL_RULE": { "NTP_ACL|TEST_DROP": { "IP_PROTOCOL": "17", "IP_TYPE": "IP", "L4_DST_PORT": "123", "PACKET_ACTION": "DROP", "PRIORITY": "9998", "SRC_IP": "9.9.9.9/32" } },
admin@str2-7250-lc1-2:~$ sudo ip netns exec asic1 show acl rule Table Rule Priority Action Match Status
NTP_ACL TEST_DROP 9998 DROP IP_PROTOCOL: 17 N/A IP_TYPE: IP L4_DST_PORT: 123 SRC_IP: 9.9.9.9/32
admin@str2-7250-lc1-2:~$ sudo ip netns exec asic1 iptables -S -P INPUT ACCEPT -P FORWARD ACCEPT -P OUTPUT ACCEPT -A INPUT -s 127.0.0.1/32 -i lo -j ACCEPT -A INPUT -s 240.127.1.3/32 -d 240.127.1.3/32 -j ACCEPT -A INPUT -s 240.127.1.1/32 -d 240.127.1.3/32 -j ACCEPT -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT -A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT -A INPUT -p udp -m udp --dport 67:68 -j ACCEPT -A INPUT -p udp -m udp --dport 546:547 -j ACCEPT -A INPUT -p tcp -m tcp --dport 179 -j ACCEPT -A INPUT -s 20.44.16.64/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 13.66.141.96/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 13.69.229.128/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 52.231.147.224/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 40.74.146.224/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 40.78.203.96/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 20.150.171.224/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8081 -j ACCEPT -A INPUT -s 20.44.16.64/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 13.66.141.96/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 13.69.229.128/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 52.231.147.224/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 40.74.146.224/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 40.78.203.96/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 20.150.171.224/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8090 -j ACCEPT -A INPUT -s 9.9.9.9/32 -p udp -m udp --dport 123 -j DROP -A INPUT -d 10.1.0.1/32 -j DROP -A INPUT -d 192.0.0.2/32 -j DROP -A INPUT -d 10.3.146.0/32 -j DROP -A INPUT -d 10.0.0.6/32 -j DROP -A INPUT -d 10.0.0.10/32 -j DROP -A INPUT -m ttl --ttl-lt 2 -j ACCEPT -A INPUT -j DROP
@xincunli-sonic
After further debugging, the issue is happening only when trying to modify an existing ACL_RULE via apply-patch replace and it is not seen when creating a new ACL RULE. In that case, the apply-patch recognizes 0 changes and as a result the iptable shows out-of dated information.
So, after creating an ACL_RULE with the steps from description, as a next step please try to modify the newly created rule.
For example sending this patch:
[
{
"op": "replace",
"path": "/asic1/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP",
"value": "8.8.8.8/32"
}
]
Output from console shows the change was not recognized (patch was converted into 0 changes.).
Patch Applier: asic1: Patch application starting. Patch Applier: asic1: Patch: [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}] Patch Applier: asic1 getting current config db. Patch Applier: asic1: simulating the target full config after applying the patch. Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields Patch Applier: asic1: validating target config does not have empty tables, since they do not show up in ConfigDb. Patch Applier: asic1: sorting patch updates. Patch Applier: The asic1 patch was converted into 0 changes. Patch Applier: asic1: applying 0 changes in order. Patch Applier: asic1: verifying patch updates are reflected on ConfigDB. Patch Applier: asic1 patch application completed. Patch applied successfully.
Also, tried with operation "add" also, and results were the same.
admin@ixre-egl-board41:~$ sudo config apply-patch acl_rule_replace Patch Applier: asic1: Patch application starting. Patch Applier: asic1: Patch: [{"op": "add", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}] Patch Applier: asic1 getting current config db. Patch Applier: asic1: simulating the target full config after applying the patch. Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields Patch Applier: asic1: validating target config does not have empty tables, since they do not show up in ConfigDb. Patch Applier: asic1: sorting patch updates. Patch Applier: The asic1 patch was converted into 0 changes. Patch Applier: asic1: applying 0 changes in order. Patch Applier: asic1: verifying patch updates are reflected on ConfigDB. Patch Applier: asic1 patch application completed. Patch applied successfully.
Entries in iptables -S displayed the initial rule information - were not updated.
@xincunli-sonic, can you please help triage this issue.
acla.json
[
{
"op": "add",
"path": "/asic1/ACL_RULE",
"value": {
"NTP_ACL|TEST_DROP": {
"IP_PROTOCOL": "17",
"L4_DST_PORT": "123",
"IP_TYPE": "IP",
"PACKET_ACTION": "DROP",
"PRIORITY": "9998",
"SRC_IP": "9.9.9.9/32"
}
}
}
]
aclp.json
[
{
"op": "replace",
"path": "/asic1/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP",
"value": "8.8.8.8/32"
}
]
admin@str2-7250-lc1-2:~$ sudo config apply-patch acla.json
Patch Applier: asic1: Patch application starting.
Patch Applier: asic1: Patch: [{"op": "add", "path": "/ACL_RULE", "value": {"NTP_ACL|TEST_DROP": {"IP_PROTOCOL": "17", "L4_DST_PORT": "123", "IP_TYPE": "IP", "PACKET_ACTION": "DROP", "PRIORITY": "9998", "SRC_IP": "9.9.9.9/32"}}}]
Patch Applier: asic1 getting current config db.
Patch Applier: asic1: simulating the target full config after applying the patch.
Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic1: validating target config does not have empty tables,
since they do not show up in ConfigDb.
Patch Applier: asic1: sorting patch updates.
Patch Applier: The asic1 patch was converted into 1 change:
Patch Applier: asic1: applying 1 change in order:
Patch Applier: * [{"op": "add", "path": "/ACL_RULE", "value": {"NTP_ACL|TEST_DROP": {"IP_PROTOCOL": "17", "L4_DST_PORT": "123", "IP_TYPE": "IP", "PACKET_ACTION": "DROP", "PRIORITY": "9998", "SRC_IP": "9.9.9.9/32"}}}]
Patch Applier: asic1: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic1 patch application completed.
Patch applied successfully.
admin@str2-7250-lc1-2:~$ sudo config apply-patch aclp.json
Patch Applier: asic1: Patch application starting.
Patch Applier: asic1: Patch: [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}]
Patch Applier: asic1 getting current config db.
Patch Applier: asic1: simulating the target full config after applying the patch.
Patch Applier: asic1: validating all JsonPatch operations are permitted on the specified fields
Patch Applier: asic1: validating target config does not have empty tables,
since they do not show up in ConfigDb.
Patch Applier: asic1: sorting patch updates.
Patch Applier: The asic1 patch was converted into 1 change:
Patch Applier: asic1: applying 1 change in order:
Patch Applier: * [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}]
Patch Applier: asic1: verifying patch updates are reflected on ConfigDB.
Patch Applier: asic1 patch application completed.
Patch applied successfully.
admin@str2-7250-lc1-2:~$ sudo ip netns exec asic1 show acl rule
Table Rule Priority Action Match Status
------- --------- ---------- -------- ------------------ --------
NTP_ACL TEST_DROP 9998 DROP IP_PROTOCOL: 17 N/A
IP_TYPE: IP
L4_DST_PORT: 123
SRC_IP: 8.8.8.8/32
admin@str2-7250-lc1-2:~$ sudo ip netns exec asic1 iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-A INPUT -s 127.0.0.1/32 -i lo -j ACCEPT
-A INPUT -s 240.127.1.2/32 -d 240.127.1.2/32 -j ACCEPT
-A INPUT -s 240.127.1.1/32 -d 240.127.1.2/32 -j ACCEPT
-A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 0 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 3 -j ACCEPT
-A INPUT -p icmp -m icmp --icmp-type 11 -j ACCEPT
-A INPUT -p udp -m udp --dport 67:68 -j ACCEPT
-A INPUT -p udp -m udp --dport 546:547 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 179 -j ACCEPT
-A INPUT -s 20.44.16.64/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 13.66.141.96/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 13.69.229.128/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 52.231.147.224/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 40.74.146.224/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 40.78.203.96/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 20.150.171.224/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -d 10.20.8.199/32 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -d 10.212.64.1/32 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -d 10.212.64.2/32 -p tcp -m tcp --dport 8081 -j ACCEPT
-A INPUT -s 20.44.16.64/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 13.66.141.96/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 13.69.229.128/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 52.231.147.224/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 40.74.146.224/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 40.78.203.96/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 20.150.171.224/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 52.162.110.128/27 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -d 10.20.8.199/32 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -d 10.212.64.1/32 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -d 10.212.64.2/32 -p tcp -m tcp --dport 8090 -j ACCEPT
-A INPUT -s 9.9.9.9/32 -p udp -m udp --dport 123 -j DROP
-A INPUT -d 10.1.0.1/32 -j DROP
-A INPUT -d 192.0.0.2/32 -j DROP
-A INPUT -d 10.0.0.6/32 -j DROP
-A INPUT -d 10.0.0.10/32 -j DROP
-A INPUT -p icmp -m ttl --ttl-lt 2 -j ACCEPT
-A INPUT -p udp -m ttl --ttl-lt 2 -m udp --dport 1025:65535 -j ACCEPT
-A INPUT -p tcp -m ttl --ttl-lt 2 -m tcp --dport 1025:65535 -j ACCEPT
-A INPUT -j DROP
"asic1": {
"ACL_RULE": {
"NTP_ACL|TEST_DROP": {
"IP_PROTOCOL": "17",
"IP_TYPE": "IP",
"L4_DST_PORT": "123",
"PACKET_ACTION": "DROP",
"PRIORITY": "9998",
"SRC_IP": "8.8.8.8/32"
}
},
admin@str2-7250-lc1-2:~$ sudo grep -F 8.8.8.8 /var/log/syslog
2024 Nov 19 00:29:26.189474 str2-7250-lc1-2 NOTICE GenericConfigUpdater: Patch Applier: asic1: Patch: [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}]
2024 Nov 19 00:29:28.192324 str2-7250-lc1-2 NOTICE config: Patch Applier: * [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}]
2024 Nov 19 00:29:30.648647 str2-7250-lc1-2 NOTICE config: 'apply-patch' executed successfully for asic1 by [{'op': 'replace', 'path': '/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP', 'value': '8.8.8.8/32'}]
2024 Nov 19 00:29:30.648779 str2-7250-lc1-2 NOTICE config: Patch applied successfully for [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}].
2024 Nov 19 00:30:30.984409 str2-7250-lc1-2 NOTICE GenericConfigUpdater: Patch Applier: asic1: Patch: [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}]
2024 Nov 19 00:30:38.490914 str2-7250-lc1-2 NOTICE GenericConfigUpdater: Patch Applier: asic1: Patch: [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}]
2024 Nov 19 00:30:40.848050 str2-7250-lc1-2 NOTICE config: 'apply-patch' executed successfully for asic1 by [{'op': 'replace', 'path': '/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP', 'value': '8.8.8.8/32'}]
2024 Nov 19 00:30:40.848161 str2-7250-lc1-2 NOTICE config: Patch applied successfully for [{"op": "replace", "path": "/ACL_RULE/NTP_ACL|TEST_DROP/SRC_IP", "value": "8.8.8.8/32"}].
admin@str2-7250-lc1-2:/var/log/swss$ grep -F 8.8.8.8 swss.asic1.rec
2024-11-19.00:29:28.675297|ACL_RULE|NTP_ACL|TEST_DROP|SET|IP_PROTOCOL:17|IP_TYPE:IP|L4_DST_PORT:123|PACKET_ACTION:DROP|PRIORITY:9998|SRC_IP:8.8.8.8/32
So, the config db has been changed, acl rule changed too, but iptables did not change. @arlakshm, would you mind help take a look further? Thanks!
Description
GCU modification to ACL_RULE path fail to be applied for multi-asic platform. More specifically, ACL_RULE is added per namespace but not applied to iptables and thus, the test case verification fails.
Failed tests:
(Automated test cases support for running in t2 topology is added via PR https://github.com/sonic-net/sonic-mgmt/pull/14070 )
Steps to reproduce the issue
sudo config apply-patch add_acl_rule.json
sudo ip netns exec asic1 show acl rule
sudo ip netns exec asic1 iptables -S
Describe the results you received
The rule was not seen in iptables cmd and functionality not applied.
Describe the results you expected
The rule should be visible in runningconfiguration as well as in iptables.
Additional information you deem important (e.g. issue happens only occasionally)
Issue happend only on multi-asic platform.
Output of
show version