Waiting for ovn-nbctl --wait=hv only synchronizes the OpenFlow updates.
Cached datapath flows may still reflect the previous ACL configuration,
causing transient packet loss or forwarding in the default_acl_drop and
Tiered ACLs tests.  Wait for revalidation before each traffic assertion,
following the existing NS_CHECK_CONNECTIVITY__ helper.

Also wait for the Tiered ACLs ports to be ready before the initial probe,
and preserve fractional ping loss percentages rather than reporting the
fractional suffix of 33.3333% as 333%.

Fixes: 6d0104e33f41 ("northd: Add logical flows to allow rpl/rel traffic in 
acl_after_lb stage.")
Fixes: 119f14e05cb4 ("northd: Add tiered ACL support.")
Assisted-by: DeepSeek V4 Pro, OpenCode
Signed-off-by: MJ Ponsonby <[email protected]>
---
 tests/system-ovn.at | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/tests/system-ovn.at b/tests/system-ovn.at
index 7d6941a59..9ab126f25 100644
--- a/tests/system-ovn.at
+++ b/tests/system-ovn.at
@@ -10601,6 +10601,7 @@ check ovn-nbctl set NB_Global . 
options:default_acl_drop=false \
     -- acl-add sw from-lport 20 "ip4 && icmp" allow-related \
     -- acl-add sw from-lport 10 "ip4" drop
 check ovn-nbctl --wait=hv sync
+check ovs-appctl revalidator/wait
 
 # 'vm1' should be able to ping 'vm2' directly.
 NS_CHECK_EXEC([vm1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | FORMAT_PING], \
@@ -10616,6 +10617,7 @@ check ovn-nbctl set NB_Global . 
options:default_acl_drop=true \
     -- --apply-after-lb acl-add sw from-lport 1 1 allow \
     -- acl-add sw to-lport 1 1 allow
 check ovn-nbctl --wait=hv sync
+check ovs-appctl revalidator/wait
 
 # 'vm1' should be able to ping 'vm2' directly.
 NS_CHECK_EXEC([vm1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | FORMAT_PING], \
@@ -10629,6 +10631,7 @@ check ovn-nbctl set NB_Global . 
options:default_acl_drop=false \
     -- --apply-after-lb acl-add sw from-lport 20 "ip4 && icmp" allow-related \
     -- --apply-after-lb acl-add sw from-lport 10 "ip4" drop
 check ovn-nbctl --wait=hv sync
+check ovs-appctl revalidator/wait
 
 # 'vm1' should be able to ping 'vm2' directly.
 NS_CHECK_EXEC([vm1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | FORMAT_PING], \
@@ -10644,6 +10647,7 @@ check ovn-nbctl set NB_Global . 
options:default_acl_drop=true \
     -- --apply-after-lb acl-add sw from-lport 20 "arp" allow-related \
     -- acl-add sw to-lport 1 1 allow
 check ovn-nbctl --wait=hv sync
+check ovs-appctl revalidator/wait
 
 # 'vm1' should be able to ping 'vm2' directly.
 NS_CHECK_EXEC([vm1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | FORMAT_PING], \
@@ -10657,6 +10661,7 @@ check ovn-nbctl set NB_Global . 
options:default_acl_drop=false \
     -- acl-add sw to-lport 20 "ip4 && icmp" allow-related \
     -- acl-add sw to-lport 10 "ip4" drop
 check ovn-nbctl --wait=hv sync
+check ovs-appctl revalidator/wait
 
 # 'vm1' should be able to ping 'vm2' directly.
 NS_CHECK_EXEC([vm1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | FORMAT_PING], \
@@ -10672,6 +10677,7 @@ check ovn-nbctl set NB_Global . 
options:default_acl_drop=true \
     -- acl-add sw to-lport 20 "ip4 && icmp" allow-related \
     -- acl-add sw to-lport 20 "arp" allow
 check ovn-nbctl --wait=hv sync
+check ovs-appctl revalidator/wait
 
 # 'vm1' should be able to ping 'vm2' directly.
 NS_CHECK_EXEC([vm1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | FORMAT_PING], \
@@ -11977,7 +11983,10 @@ ADD_VETH(lsp1, lsp1, br-int, "10.0.0.1/24", 
"00:00:00:00:00:01")
 ADD_NAMESPACES(lsp2)
 ADD_VETH(lsp2, lsp2, br-int, "10.0.0.2/24", "00:00:00:00:00:02")
 
-m4_define([PING_PCT], [grep -o "[[0-9]]\{1,3\}% packet loss"])
+wait_for_ports_up
+check ovn-nbctl --wait=hv sync
+
+m4_define([PING_PCT], [grep -Eo "[[0-9]]+(\.[[0-9]]+)?% packet loss"])
 
 acl_test() {
     direction=$1
@@ -11986,6 +11995,9 @@ acl_test() {
 
     # First a baseline. If traffic isn't being allowed, then something is
     # very wrong.
+    # --wait=hv does not wait for cached datapath flows to be revalidated.
+    # Synchronize the datapath before each traffic assertion below.
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 0% packet loss
@@ -11993,6 +12005,7 @@ acl_test() {
     # Add an untiered drop ACL. This should cause pings to fail.
     check ovn-nbctl --wait=hv $options acl-add $thing $direction 1000 "ip4.dst 
== 10.0.0.2" drop
     acl1_uuid=$(ovn-nbctl --bare --columns _uuid find ACL priority=1000)
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 100% packet loss
@@ -12001,6 +12014,7 @@ acl_test() {
     # Change the tier to 3. Despite there being "holes" in tiers 0, 1, and 2,
     # the ACL should still apply, and pings should fail.
     check ovn-nbctl --wait=hv set ACL $acl1_uuid tier=3
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 100% packet loss
@@ -12009,6 +12023,7 @@ acl_test() {
     # Add a tier-0 ACL that allows the traffic. The priority is only 4, but
     # since it is a higher tier, the traffic should be allowed.
     check ovn-nbctl --wait=hv $options acl-add $thing $direction 4 "ip4.dst == 
10.0.0.2" allow
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 0% packet loss
@@ -12018,6 +12033,7 @@ acl_test() {
     # to pass over the lower-priority tier-0 "allow" ACL, and move to the 
tier-3
     # ACL that drops the traffic.
     check ovn-nbctl --wait=hv $options acl-add $thing $direction 1000 "ip4.dst 
== 10.0.0.2" pass
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 100% packet loss
@@ -12025,6 +12041,7 @@ acl_test() {
 
     # Remove the "pass" ACL, and the "allow" rule should kick back in.
     check ovn-nbctl --wait=hv --tier=0 acl-del $thing $direction 1000 "ip4.dst 
== 10.0.0.2"
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 0% packet loss
@@ -12032,6 +12049,7 @@ acl_test() {
 
     # Removing the remaining 0-tier ACL should make traffic go back to being 
dropped.
     check ovn-nbctl --wait=hv acl-del $thing $direction 4 "ip4.dst == 10.0.0.2"
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 100% packet loss
@@ -12041,6 +12059,7 @@ acl_test() {
     # default ACL action. Currently, the default is to allow traffic, so the
     # traffic should be allowed.
     check ovn-nbctl --wait=hv --tier=3 $options acl-add $thing $direction 2000 
"ip4.dst == 10.0.0.2" pass
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 0% packet loss
@@ -12048,6 +12067,7 @@ acl_test() {
 
     # Change the default ACL action to drop, and now the traffic should be 
dropped.
     check ovn-nbctl --wait=hv set NB_Global . options:default_acl_drop=true
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 100% packet loss
@@ -12057,6 +12077,7 @@ acl_test() {
     # make traffic go back to passing.
     check ovn-nbctl clear NB_Global . options
     check ovn-nbctl --wait=hv acl-del $thing
+    check ovs-appctl revalidator/wait
     NS_CHECK_EXEC([lsp1], [ping -q -c 3 -i 0.3 -w 2 10.0.0.2 | PING_PCT], \
 [0], [dnl
 0% packet loss
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to