diff mbox series

[ovs-dev,5/6] tests: Compare I+P flows with with recompute ones.

Message ID 20241114135756.1082588-6-xsimonar@redhat.com
State Changes Requested
Headers show
Series Compare I+P flows with with recompute ones. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Xavier Simonart Nov. 14, 2024, 1:57 p.m. UTC
For all unit tests, automatically compare I+P flows with with
recompute ones.

IP and recompute flows show differences in the following cases:
- OVN does not properly remove a datapath from the list of local datapaths
  when ports are removed. Hence some related_ports and/or datapath can be
  avoided in the comparison. Tests were updated in that sense.
- ct_zone allocation differs between I+P and recompute. Tests were updated
  (right before cleanup) in order to avoid this situation.
- Multiple peer_ports causing flows replacing chassis mac with non deterministic
  router port mac for east west traffic. Tests were also updated to avoid this
  situation.

Finally, some ecmp related tests were modified in order to have ports on DR
in different subnets to prevent having flows with same match but different actions

Reported-at: https://issues.redhat.com/browse/FDP-152
Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 tests/ovn-controller.at |   6 +-
 tests/ovn-ic.at         |   6 +-
 tests/ovn-macros.at     |  13 ++-
 tests/ovn-northd.at     |   9 +-
 tests/ovn.at            | 200 ++++++++++++++++++++++++++++++----------
 5 files changed, 178 insertions(+), 56 deletions(-)
diff mbox series

Patch

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index a2e451880..960b1b599 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -668,8 +668,12 @@  primary lport : [[lsp1]]
 done
 
 check as northd ovn-appctl -t ovn-northd resume
+
+# Since northd is restarted, port type is back to localport, so ls is not local datapath anymore.
 OVN_CLEANUP([hv1
-/No distributed-port option set for chassisredirect port lsp1/d])
+/No distributed-port option set for chassisredirect port lsp1/d
+ignored_dp=ls1
+])
 AT_CLEANUP
 
 AT_SETUP([ovn-controller - ssl files change when using command line options])
diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at
index 33ad37f2e..8bb3073bd 100644
--- a/tests/ovn-ic.at
+++ b/tests/ovn-ic.at
@@ -402,7 +402,8 @@  switch <0> (ts1)
 ovn-nbctl lsp-del lsp-ts1-lr1
 OVS_WAIT_WHILE([ovn_as az2 ovn-nbctl show | grep lsp-ts1-lr1])
 
-OVN_CLEANUP_SBOX(gw1)
+# ts1 should not be local dataath since lsp-ts1-lr1 has been deleted.
+OVN_CLEANUP_SBOX(gw1, [], [], [ts1,lr1])
 OVN_CLEANUP_IC([az1], [az2])
 
 AT_CLEANUP
@@ -1623,7 +1624,8 @@  done
 OVS_WAIT_UNTIL([check_packets], [$at_diff -F'^---' expected received])
 
 for az in `seq 1 $n_az`; do
-    OVN_CLEANUP_SBOX([hv$az])
+    ovn_as az$az
+    OVN_CLEANUP_SBOX([hv$az], [], [], [ts3])
     OVN_CLEANUP_SBOX([gw$az])
     OVN_CLEANUP_AZ([az$az])
 done
diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 8f835071d..239317ea3 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -278,6 +278,7 @@  m4_define([CHECK_RELATED_PORTS_AFTER_RECOMPUTE], [
 # CHECK_AFTER_RECOMPUTE(hv, sbox, related_ports, ignored_dp)
 # Check related ports (ignoring $related_ports) and FLOWS (ignoring flows from $ignored_dp)
 # by comparing IP flows and flows after recompute.
+# # We also ignore Flows from tables OFTABLE_MAC_BINDING, OFTABLE_MAC_LOOKUP, OFTABLE_MAC_CACHE_USE
 m4_define([CHECK_AFTER_RECOMPUTE], [
     hv=$1
     sbox=$2
@@ -331,6 +332,7 @@  m4_define([CHECK_AFTER_RECOMPUTE], [
           fi
         fi
       done
+      cat flow-diff-$hv | grep -v "table=OFTABLE_MAC_BINDING" | grep -v "table=OFTABLE_MAC_LOOKUP" | grep -v "table=OFTABLE_MAC_CACHE_USE" > flow-diff-$hv
       AT_CHECK([wc -l < flow-diff-$hv], [0], [0
 ])
     fi
@@ -346,8 +348,9 @@  m4_define([OVN_CLEANUP_CONTROLLER],[
     hv=$1
     sbox=$2
     related_ports=$3
+    ignored_dp=$4
 
-    CHECK_RELATED_PORTS_AFTER_RECOMPUTE([$hv], [$sbox], [$related_ports])
+    CHECK_AFTER_RECOMPUTE([$hv], [$sbox], [$related_ports], [$ignored_dp])
     if test "$hv" = "vtep"; then
         OVS_APP_EXIT_AND_WAIT([ovn-controller-vtep])
         OVS_APP_EXIT_AND_WAIT([ovs-vtep])
@@ -366,8 +369,9 @@  m4_define([OVN_CLEANUP_SBOX],[
     sbox=$1
     error=$2
     related_ports=$3
+    ignored_dp=$4
     echo "$sbox: clean up sandbox"
-    OVN_CLEANUP_CONTROLLER([$sbox], [$sbox], [$related_ports])
+    OVN_CLEANUP_CONTROLLER([$sbox], [$sbox], [$related_ports], [$ignored_dp])
     OVN_CLEANUP_VSWITCH([$sbox])
 
     # Check for errors in logs. Ignore following errors:
@@ -395,8 +399,9 @@  m4_define([OVN_CLEANUP],[
     m4_foreach([sbox_and_error], [$@], [
         sbox=$(echo "sbox_and_error" |sed -n '1p')
         error=$(echo "sbox_and_error"  | grep '/')
-        related_ports=$(echo "sbox_and_error" | sed -n '2,$p' | grep -v '/')
-        OVN_CLEANUP_SBOX([$sbox], [$error], [$related_ports])
+        ignored_dp=$(echo "sbox_and_error"  | grep 'ignored_dp' |  cut -d'=' -f 2)
+        related_ports=$(echo "sbox_and_error" | sed -n '2,$p' | grep -v '/' | grep -v 'ignored_dp')
+        OVN_CLEANUP_SBOX([$sbox], [$error], [$related_ports], [$ignored_dp])
     ])
 
     echo
diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at
index 8477e4250..767b138d2 100644
--- a/tests/ovn-northd.at
+++ b/tests/ovn-northd.at
@@ -10810,7 +10810,10 @@  northd_recomp=$(as northd ovn-appctl -t ovn-northd inc-engine/show-stats northd
 echo northd_recomp $northd_recomp
 AT_CHECK([test $northd_recomp -ge 1])
 
-OVN_CLEANUP([hv1])
+# ls0 should not be a local datapath as all its ports got deleted.
+OVN_CLEANUP([hv1
+ignored_dp=ls0
+])
 AT_CLEANUP
 ])
 
@@ -10933,7 +10936,9 @@  check ovn-nbctl --wait=sb lrp-del lrp
 check_recompute_counter 1 1
 CHECK_NO_CHANGE_AFTER_RECOMPUTE
 
-OVN_CLEANUP([hv1])
+# lr0 is not local datapath as lrp got deleted.
+OVN_CLEANUP([hv1
+ignored_dp=lr0])
 AT_CLEANUP
 ])
 
diff --git a/tests/ovn.at b/tests/ovn.at
index 40b8e59f8..6062e3e0e 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -8402,7 +8402,9 @@  OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xup])
 as hv1 ovs-vsctl del-port br-int vif1
 OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xdown])
 
-OVN_CLEANUP([hv1])
+# ls1 not local to hv1 anymore after  ovs-vsctl del-port br-int vif1
+OVN_CLEANUP([hv1
+ignored_dp=ls1])
 
 AT_CLEANUP
 ])
@@ -10738,7 +10740,9 @@  OVS_WAIT_UNTIL([test xdown = x$(ovn-nbctl lsp-get-up vm1)])
 OVS_WAIT_UNTIL([test xdown = x$(ovn-nbctl lsp-get-up foo1)])
 OVS_WAIT_UNTIL([test xdown = x$(ovn-nbctl lsp-get-up bar1)])
 
-OVN_CLEANUP([hv1],[hv2])
+# mgmt2 not local to hv1 anymore after ovs-vsctl del-port vm1
+OVN_CLEANUP([hv1
+ignored_dp=mgmt2],[hv2])
 
 AT_CLEANUP
 ])
@@ -12399,7 +12403,8 @@  net_add n1
 sim_add hv1
 as hv1
 ovs-vsctl add-br br-phys
-ovn_attach n1 br-phys 192.168.0.1
+# do not use same ip for underlay and underlay networks
+ovn_attach n1 br-phys 192.168.1.1
 
 AT_CHECK([ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=physnet1:br-phys])
 AT_CHECK([ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:tx_pcap=hv1/snoopvif-tx.pcap options:rxq_pcap=hv1/snoopvif-rx.pcap])
@@ -12407,13 +12412,13 @@  AT_CHECK([ovs-vsctl add-port br-phys snoopvif -- set Interface snoopvif options:
 sim_add hv2
 as hv2
 ovs-vsctl add-br br-phys
-ovn_attach n1 br-phys 192.168.0.2
+ovn_attach n1 br-phys 192.168.1.2
 # Initially test with no bridge-mapping on hv2, expect to receive no packets
 
 sim_add hv3
 as hv3
 ovs-vsctl add-br br-phys
-ovn_attach n1 br-phys 192.168.0.3
+ovn_attach n1 br-phys 192.168.1.3
 # Initially test with no bridge-mapping on hv3
 
 # Create a localnet port.
@@ -14884,7 +14889,9 @@  wait_column "$hv1_uuid" Port_Binding requested_chassis logical_port=lsp0
 wait_column "$hv2_uuid" Port_Binding additional_chassis logical_port=lsp0
 wait_column "$hv2_uuid $hv3_uuid" Port_Binding requested_additional_chassis logical_port=lsp0
 
-OVN_CLEANUP([hv1],[hv2],[hv3])
+# ls0 not local to hv1 since as hv1 check ovs-vsctl -- del-port br-int lsp0
+OVN_CLEANUP([hv1
+ignored_dp=ls0],[hv2],[hv3])
 
 AT_CLEANUP
 ])
@@ -15225,6 +15232,16 @@  echo $request >> hv3/third.expected
 
 check_packets
 
+# ct_zone allocation differs between I+P and recompute:
+# - In I+P an ovs interface with external-ids:iface-id set (but no
+#   logical_port in sb) results in no ct_zone allocated.
+# - In recompute, in the same case, a ct_zone is allocated - this is
+#   necessary to avoid flushing ct_zone if/when controller is restarted.
+# As migrrator has iface-id set on hv1 but is bound to hv2, we would hit
+# some ct-zone related differences in flows before and after recompute.
+# Avoid/hide this by removing iface-id on hv1.
+
+as hv1 check ovs-vsctl remove Interface migrator external-ids iface-id
 OVN_CLEANUP([hv1],[hv2],[hv3])
 
 AT_CLEANUP
@@ -15621,6 +15638,11 @@  echo $request >> hv2/n1.expected
 
 check_packets
 
+# ct_zone allocation differs between I+P and recompute.
+# As migrrator has iface-id set on hv1 but is bound to hv2, we would hit
+# some ct-zone related differences in flows before and after recompute.
+# Avoid/hide this by removing iface-id on hv1.
+as hv1 check ovs-vsctl remove Interface migrator external-ids iface-id
 OVN_CLEANUP([hv1],[hv2],[hv3])
 
 AT_CLEANUP
@@ -16160,6 +16182,12 @@  check_packets
 check ovn-nbctl lsp-set-options migrator requested-chassis=hv2
 OVS_WAIT_UNTIL([test x = x$(ovn-sbctl get Port_Binding $pb_uuid options:additional-chassis-activated)])
 
+# ct_zone allocation differs between I+P and recompute.
+# As migrrator has iface-id set on hv1 but is bound to hv2, we would hit
+# some ct-zone related differences in flows before and after recompute.
+# Avoid/hide this by removing iface-id on hv1.
+as hv1 check ovs-vsctl remove Interface migrator external-ids iface-id
+
 OVN_CLEANUP([hv1],[hv2],[hv3])
 
 AT_CLEANUP
@@ -16415,7 +16443,9 @@  AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep act
 AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=$hv1_ofport], [1], [])
 AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep output], [1], [])
 
-OVN_CLEANUP([hv1],[hv2])
+# ls0 should nt be local to hv1 anymore since ovn-nbctl lsp-set-options lsp0 requested-chassis=hv2
+OVN_CLEANUP([hv1
+ignored_dp=ls0],[hv2])
 
 AT_CLEANUP
 ])
@@ -16508,7 +16538,9 @@  wait_column '' Port_Binding chasssi logical_port=lsp0
 AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=1], [1], [])
 AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep output], [1], [])
 
-OVN_CLEANUP([hv1])
+# ls0 not local to hv1 since ovn-nbctl --wait=hv lsp-set-options lsp0 requested-chassis=non-existant-chassis
+OVN_CLEANUP([hv1
+ignored_dp=ls0])
 
 AT_CLEANUP
 ])
@@ -16772,6 +16804,7 @@  OVN_CHECK_PACKETS_CONTAIN([hv2/br-phys_n1-tx.pcap], [hv2/n1.expected])
 # So public should not be a related_port.
 OVN_CLEANUP([hv1
 public
+ignored_dp=ls0
 ],[hv2])
 
 AT_CLEANUP
@@ -19752,6 +19785,13 @@  OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected])
 # Start ovn-controller again just so OVN_CLEANUP doesn't complain
 as hv2 start_daemon ovn-controller
 
+# Stopping and restarting ovn-controller on hv2 might cause geneve to be recreated, and ofport change.
+# Make sure the ofport change does not happen right before recompute, cauing potential flow differences
+# between IP and recompute flows.
+OVS_WAIT_UNTIL([
+    test 1 = $(as hv1 ovs-vsctl --columns ofport --bare find Interface name=ovn-hv2-0 | wc -l)
+])
+
 OVN_CLEANUP([hv1],[hv2])
 AT_CLEANUP
 ])
@@ -24374,10 +24414,12 @@  m4_define([DVR_N_S_ARP_HANDLING],
    as hv4 ovs-appctl fdb/show br-phys
 
    # Expect some potential transaction errors for MAC_Binding
-   # Since router-to-underlay moved to hv3, ls-underlay is not local to hv1 anymore and ln3 should not be a related_port.
+   Since router-to-underlay moved to hv3, ls-underlay is not local to hv1 anymore
+   As ls-underlay is not local, ln3 should not be a related_port.
    OVN_CLEANUP([hv1
    /transaction error/d
-ln3],[hv2
+ln3
+ignored_dp=ls-underlay],[hv2
    /transaction error/d
    ],[hv3
    /transaction error/d
@@ -25363,6 +25405,12 @@  as hv4 ovs-ofctl dump-flows br-int
 as hv4 ovs-ofctl show br-phys
 as hv4 ovs-appctl fdb/show br-phys
 
+# Wait till the mac_binding flows appear in hv1 to avoid flow differences in tables OFTABLE_MAC_BINDING, OFTABLE_MAC_LOOKUP, OFTABLE_MAC_CACHE_USE.
+OVS_WAIT_UNTIL([test 1 = $(as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_BINDING \
+| grep -c  reg0=0xc0a80101)])
+OVS_WAIT_UNTIL([test 1 = $(as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_MAC_BINDING \
+| grep -c  reg0=0xc0a80202)])
+
 # Expect some potential transaction errors for MAC_Binding
 OVN_CLEANUP([hv1
 /transaction error/d
@@ -25641,13 +25689,13 @@  check ovn-nbctl lsp-set-type sw0-lr0 router
 check ovn-nbctl lsp-set-addresses sw0-lr0 router
 check ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0
 
-check ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 2001::a/64
+check ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 2002::a/64
 check ovn-nbctl lsp-add sw1 sw1-lr0
 check ovn-nbctl lsp-set-type sw1-lr0 router
 check ovn-nbctl lsp-set-addresses sw1-lr0 router
 check ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1
 
-check ovn-nbctl lb-add lb1 [[2001::a]]:80 [[2001::3]]:80,[[2002::3]]:80
+check ovn-nbctl lb-add lb1 [[2002::a]]:80 [[2001::3]]:80,[[2002::3]]:80
 OVN_LB_ID=$(ovn-nbctl --bare --column _uuid find load_balancer name=lb1)
 check ovn-nbctl set load_balancer ${OVN_LB_ID} selection_fields="ip_dst,ip_src,tp_dst,tp_src"
 #
@@ -25655,7 +25703,7 @@  check ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:\"[[2001::3]]\"=\
 check ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:\"[[2002::3]]\"=\"sw1-p1:[[2002::2]]\"
 
 AT_CHECK([ovn-nbctl --wait=sb \
-          -- --id=@hc create Load_Balancer_Health_Check vip="\[\[2001\:\:a\]\]\:80" \
+          -- --id=@hc create Load_Balancer_Health_Check vip="\[\[2002\:\:a\]\]\:80" \
              options:failure_count=100 \
           -- add Load_Balancer . health_check @hc | uuidfilt], [0], [<0>
 ])
@@ -25691,15 +25739,15 @@  OVS_WAIT_FOR_OUTPUT(
   [ovn-sbctl dump-flows > sbflows
    ovn-sbctl dump-flows sw0 | grep ct_lb_mark | grep priority=120 | sed 's/table=..//'], 0,
   [dnl
-  (ls_in_pre_stateful ), priority=120  , match=(reg0[[2]] == 1 && ip6.dst == 2001::a && tcp.dst == 80), action=(xxreg1 = 2001::a; reg2[[0..15]] = 80; ct_lb_mark;)
-  (ls_in_lb           ), priority=120  , match=(ct.new && ip6.dst == 2001::a && tcp.dst == 80), action=(xxreg1 = 2001::a; reg2[[0..15]] = 80; ct_lb_mark(backends=[[2001::3]]:80,[[2002::3]]:80; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");)
+  (ls_in_pre_stateful ), priority=120  , match=(reg0[[2]] == 1 && ip6.dst == 2002::a && tcp.dst == 80), action=(xxreg1 = 2002::a; reg2[[0..15]] = 80; ct_lb_mark;)
+  (ls_in_lb           ), priority=120  , match=(ct.new && ip6.dst == 2002::a && tcp.dst == 80), action=(xxreg1 = 2002::a; reg2[[0..15]] = 80; ct_lb_mark(backends=[[2001::3]]:80,[[2002::3]]:80; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");)
 ])
 
 AT_CAPTURE_FILE([sbflows2])
 OVS_WAIT_FOR_OUTPUT(
   [ovn-sbctl dump-flows > sbflows2
    ovn-sbctl dump-flows lr0 | grep ct_lb_mark | grep priority=120 | sed 's/table=..//'], 0,
-  [  (lr_in_dnat         ), priority=120  , match=(ct.new && !ct.rel && ip6 && ip6.dst == 2001::a && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_lb_mark(backends=[[2001::3]]:80,[[2002::3]]:80; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");)
+  [  (lr_in_dnat         ), priority=120  , match=(ct.new && !ct.rel && ip6 && ip6.dst == 2002::a && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_lb_mark(backends=[[2001::3]]:80,[[2002::3]]:80; hash_fields="ip_dst,ip_src,tcp_dst,tcp_src");)
 ])
 
 # get the svc monitor mac.
@@ -25716,7 +25764,7 @@  OVS_WAIT_UNTIL(
 grep "405400000003${svc_mon_src_mac}" | wc -l`]
 )
 
-check ovn-nbctl set load_balancer_health_check [[2001::a]]:80 options:failure_count=1
+check ovn-nbctl set load_balancer_health_check [[2002::a]]:80 options:failure_count=1
 wait_row_count Service_Monitor 2 status=offline
 
 OVS_WAIT_UNTIL(
@@ -25732,16 +25780,16 @@  grep "405400000003${svc_mon_src_mac}" | wc -l`]
 AT_CAPTURE_FILE([sbflows3])
 ovn-sbctl dump-flows sw0 > sbflows3
 AT_CHECK(
-  [grep "ip6.dst == 2001::a && tcp.dst == 80" sbflows3 | grep priority=120 |\
+  [grep "ip6.dst == 2002::a && tcp.dst == 80" sbflows3 | grep priority=120 |\
    ovn_strip_lflows], [0], [dnl
-  table=??(ls_in_lb           ), priority=120  , match=(ct.new && ip6.dst == 2001::a && tcp.dst == 80), action=(drop;)
-  table=??(ls_in_pre_stateful ), priority=120  , match=(reg0[[2]] == 1 && ip6.dst == 2001::a && tcp.dst == 80), action=(xxreg1 = 2001::a; reg2[[0..15]] = 80; ct_lb_mark;)
+  table=??(ls_in_lb           ), priority=120  , match=(ct.new && ip6.dst == 2002::a && tcp.dst == 80), action=(drop;)
+  table=??(ls_in_pre_stateful ), priority=120  , match=(reg0[[2]] == 1 && ip6.dst == 2002::a && tcp.dst == 80), action=(xxreg1 = 2002::a; reg2[[0..15]] = 80; ct_lb_mark;)
 ])
 
 AT_CAPTURE_FILE([sbflows4])
 ovn-sbctl dump-flows lr0 > sbflows4
 AT_CHECK([grep lr_in_dnat sbflows4 | grep priority=120 | sed 's/table=..//' | sort], [0], [dnl
-  (lr_in_dnat         ), priority=120  , match=(ct.new && !ct.rel && ip6 && ip6.dst == 2001::a && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(drop;)
+  (lr_in_dnat         ), priority=120  , match=(ct.new && !ct.rel && ip6 && ip6.dst == 2002::a && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(drop;)
 ])
 
 # Delete sw0-p1
@@ -26739,8 +26787,10 @@  else
     AT_CHECK([test $hv2_rcv_n2 -eq 0], [0], [])
 fi
 
-OVN_CLEANUP([hv1], [hv2])
-
+#ls1, ls2 and lr1 are not local datapaths on hv1 since all ports on hv1 moved to hv2
+OVN_CLEANUP([hv1
+ignored_dp=ls1,ls2,lr1
+], [hv2])
 AT_CLEANUP
 ])
 
@@ -28756,7 +28806,9 @@  reg15=0x${p1_dpkey} | grep REG13 | wc -l) -eq 0])
 p1_zoneid=$(as hv1 ovs-vsctl get bridge br-int external_ids:ct-zone-sw0-p1 | sed 's/"//g')
 AT_CHECK([test -z $p1_zoneid])
 
-OVN_CLEANUP([hv1])
+# sw0 is not local to hv1 since ovn-nbctl lsp-del sw0-p1
+OVN_CLEANUP([hv1
+ignored_dp=sw0])
 AT_CLEANUP
 ])
 
@@ -28802,8 +28854,13 @@  check ovn-nbctl lrp-add DR dr-ls1 00:00:01:01:02:03 10.0.0.1/24
 check ovn-nbctl lsp-add ls1 ls1-dr -- set Logical_Switch_Port ls1-dr \
     type=router options:router-port=dr-ls1 addresses='"00:00:01:01:02:03"'
 
+# Ports on DR should be in different subnets to prevent having flows with same match but different actions.
+# The following flows (in lr_in_ip_routing) would fight in case the same subnet is used:
+# table=IP_ROUTING, priority=74,ip,metadata=0x1,nw_dst=10.0.0.0/24 actions=dec_ttl(),load:0->OXM_OF_PKT_REG4[32..47],move:NXM_OF_IP_DST[]->NXM_NX_XXREG0[96..127],load:0xa000002->NXM_NX_XXREG0[64..95],mod_dl_src:00:00:01:01:02:04,load:0x2
+# table=IP_ROUTING, priority=74,ip,metadata=0x1,nw_dst=10.0.0.0/24 actions=dec_ttl(),load:0->OXM_OF_PKT_REG4[32..47],move:NXM_OF_IP_DST[]->NXM_NX_XXREG0[96..127],load:0xa000002->NXM_NX_XXREG0[64..95],mod_dl_src:00:00:01:01:02:03,load:0x1
+
 # Connect ls2 to DR
-check ovn-nbctl lrp-add DR dr-ls2 00:00:01:01:02:04 10.0.0.2/24
+check ovn-nbctl lrp-add DR dr-ls2 00:00:01:01:02:04 10.0.1.1/24
 check ovn-nbctl lsp-add ls2 ls2-dr -- set Logical_Switch_Port ls2-dr \
     type=router options:router-port=dr-ls2 addresses='"00:00:01:01:02:04"'
 
@@ -28826,8 +28883,8 @@  check ovn-nbctl lr-route-add GW 10.0.0.0/24 20.0.0.1
 check ovn-nbctl --policy="src-ip" lr-route-add DR 10.0.0.0/24 20.0.0.2
 
 # Now add some ECMP routes to the GW router.
-check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/24 172.16.0.2
-check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/24 172.16.0.3
+check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/16 172.16.0.2
+check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/16 172.16.0.3
 
 wait_for_ports_up
 check ovn-nbctl --wait=hv sync
@@ -28928,12 +28985,12 @@  check ovn-nbctl ls-add join
 check ovn-nbctl ls-add ext
 
 # Connect ls1 to DR
-check ovn-nbctl lrp-add DR dr-ls1 00:00:01:01:02:03 1001::1/64
+check ovn-nbctl lrp-add DR dr-ls1 00:00:01:01:02:03 1001:0:0:1::1/64
 check ovn-nbctl lsp-add ls1 ls1-dr -- set Logical_Switch_Port ls1-dr \
     type=router options:router-port=dr-ls1 addresses='"00:00:01:01:02:03"'
 
 # Connect ls2 to DR
-check ovn-nbctl lrp-add DR dr-ls2 00:00:01:01:02:04 1001::2/64
+check ovn-nbctl lrp-add DR dr-ls2 00:00:01:01:02:04 1001:0:0:2::1/64
 check ovn-nbctl lsp-add ls2 ls2-dr -- set Logical_Switch_Port ls2-dr \
     type=router options:router-port=dr-ls2 addresses='"00:00:01:01:02:04"'
 
@@ -28956,8 +29013,8 @@  check ovn-nbctl lr-route-add GW 1001::/64 2001::1
 check ovn-nbctl --policy="src-ip" lr-route-add DR 1001::0/64 2001::2
 
 # Now add some ECMP routes to the GW router.
-check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 1001::/64 7001::2
-check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 1001::/64 7001::3
+check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 1001::/48 7001::2
+check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 1001::/48 7001::3
 
 wait_for_ports_up
 check ovn-nbctl --wait=hv sync
@@ -29248,7 +29305,9 @@  as hv1 ovn-appctl -t ovn-controller debug/resume
 # Make sure ovn-controller runs fine.
 OVS_WAIT_UNTIL([test x$(as hv1 ovn-appctl -t ovn-controller debug/status) = "xrunning"])
 
-OVN_CLEANUP([hv1])
+# ls is not local to hv1 since ovn-nbctl --wait=sb lsp-del lsp
+OVN_CLEANUP([hv1
+ignored_dp=ls])
 AT_CLEANUP
 ])
 
@@ -29897,9 +29956,26 @@  OVS_WAIT_UNTIL([
 test_arp_response 000030303233 $(ip_to_hex 172 16 0 200) hv1 hv2 hv3
 test_arp_response 000030303233 $(ip_to_hex 172 16 0 201) hv1 hv2 hv3
 
+# In OVN_CLEANUP we recompute to check whether I-P created flows are correct.
+# However, if gw_router is on hv1, then public on hv1 has two peer ports.
+# There is one flow (in table 0, priority 180) replacing chassis mac with router
+# port mac for east west traffic. If there are two peer ports, then recompute is not
+# deterministic as new src mac might be from any of the two router ports.
+# Hence, move gw_router back on hv3 to avoid this issue.
+# Schedule gw_router on hv3.
+ovn-nbctl set logical_router gw_router options:chassis=hv3
+hv3_uuid=$(ovn-sbctl --bare --columns _uuid list chassis hv3)
+
+OVS_WAIT_UNTIL([
+    gw_router_ch=$(ovn-sbctl --bare --columns chassis list port_binding gw_router-public)
+    test "$gw_router_ch" = $hv3_uuid
+])
+
+
 OVN_CLEANUP([hv1
 /parse MAC binding/d
 /unknown logical port/d
+ignored_dp=gw_router
 ],[hv2
 /parse MAC binding/d
 /unknown logical port/d
@@ -30161,7 +30237,9 @@  ovs-vsctl set interface hv1-vif1 external_ids:iface-id=foo
 OVS_WAIT_UNTIL([test 0 = `as hv1 ovs-ofctl dump-flows br-int | \
 grep conjunction | wc -l`])
 
-OVN_CLEANUP([hv1])
+# ls1 is not local to hv1 since ovs-vsctl set interface hv1-vif1 external_ids:iface-id=foo
+OVN_CLEANUP([hv1
+ignored_dp=ls1])
 AT_CLEANUP
 ])
 
@@ -31292,7 +31370,9 @@  wait_column "false" Port_Binding up logical_port=lsp2
 wait_column "false" Port_Binding up logical_port=lsp1
 wait_column "false" nb:Logical_Switch_Port up name=lsp1
 
-OVN_CLEANUP([hv1])
+# ls not local to hv1 since lsp1 and lsp2 w/o iface-id
+OVN_CLEANUP([hv1
+ignored_dp=ls])
 AT_CLEANUP
 ])
 
@@ -32105,7 +32185,9 @@  wait_column "false" nb:Logical_Switch_Port up name=vm1
 wait_column "false" nb:Logical_Switch_Port up name=vm-cont1
 wait_column "false" nb:Logical_Switch_Port up name=vm-cont2
 
-OVN_CLEANUP([hv1])
+# ls is not local to hv1 since vm1 as a child port of some non existent lport
+OVN_CLEANUP([hv1
+ignored_dp=ls])
 AT_CLEANUP
 ])
 
@@ -32203,7 +32285,9 @@  AT_CHECK([kill -0 $(cat hv1/ovn-controller.pid)])
 
 wait_column "false" nb:Logical_Switch_Port up name=vm1
 
-OVN_CLEANUP([hv1])
+# ls not local to hv1 since as hv1 ovs-vsctl set Interface vm1 external_ids:iface-id=foo
+OVN_CLEANUP([hv1
+ignored_dp=ls])
 AT_CLEANUP
 ])
 
@@ -32281,7 +32365,10 @@  check ovn-nbctl --wait=hv sync
 # Make sure that ovn-controller has not asserted.
 AT_CHECK([kill -0 $(cat hv1/ovn-controller.pid)])
 
-OVN_CLEANUP([hv1])
+# ls1 not local since ovn-nbctl lsp-add ls1 lsp1
+OVN_CLEANUP([hv1
+ignored_dp=ls1
+])
 AT_CLEANUP
 ])
 
@@ -32599,7 +32686,9 @@  primary lport : [[sw0p2]]
 ----------------------------------------
 ])
 
-OVN_CLEANUP([hv1], [hv2])
+# sw0 not local to hv1 since sw0p1 as child port of non existent lport - foo and sw0p2 is on hv2
+OVN_CLEANUP([hv1
+ignored_dp=sw0], [hv2])
 AT_CLEANUP
 ])
 
@@ -33495,6 +33584,7 @@  OVN_CLEANUP([hv1
 ln1
 ln2
 ln3
+ignored_dp=S1,S2,S3
 ],[hv2],[hv3],[hv4],[hv5])
 AT_CLEANUP
 ])
@@ -33731,7 +33821,7 @@  ovn-nbctl ls-add sw0
 ovn-nbctl lsp-add sw0 sw0-port1
 ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 10.0.0.3"
 check ovn-nbctl lsp-add sw0 sw0-port2
-check ovn-nbctl lsp-set-addresses sw0-port2 "50:54:00:00:00:01 10.0.0.4"
+check ovn-nbctl lsp-set-addresses sw0-port2 "50:54:00:00:00:02 10.0.0.4"
 check ovn-nbctl lsp-set-type sw0-port2 localport
 
 ovn-nbctl lr-add lr0
@@ -34034,7 +34124,9 @@  OVS_WAIT_UNTIL([
     grep -q "CMS requested plugging of lport lsp3" hv2/ovn-controller.log
 ])
 
-OVN_CLEANUP([hv1],[hv2
+# lsw0 not local as ports unplugged
+OVN_CLEANUP([hv1
+ignored_dp=lsw0],[hv2
 /CMS requested plugging of lport lsp3/d
 ])
 AT_CLEANUP
@@ -34583,7 +34675,9 @@  check_port_sec_offlows hv2 OFTABLE_CHK_IN_PORT_SEC
 check_port_sec_offlows hv2 OFTABLE_CHK_IN_PORT_SEC_ND
 check_port_sec_offlows hv2 OFTABLE_CHK_OUT_PORT_SEC
 
-OVN_CLEANUP([hv1], [hv2])
+# sw0 not local to hv1 as sw0p2 and hv1-vif0 are deleted
+OVN_CLEANUP([hv1
+ignored_dp=sw0], [hv2])
 AT_CLEANUP
 ])
 
@@ -35135,7 +35229,8 @@  AT_CHECK([as hv1 ovn-appctl -t ovn-controller debug/dump-mac-bindings], [0], [dn
 Local MAC bindings:
 ])
 
-OVN_CLEANUP([hv1])
+OVN_CLEANUP([hv1
+ignored_dp=lr])
 AT_CLEANUP
 ])
 
@@ -35176,7 +35271,10 @@  check ovn-nbctl --wait=hv sync
 check ovn-nbctl lsp-del lsp
 check ovn-nbctl lrp-del lrp
 check ovn-nbctl --wait=hv sync
-OVN_CLEANUP([hv1])
+
+# ro0 not local as lrp deleted
+OVN_CLEANUP([hv1
+ignored_dp=ro0])
 AT_CLEANUP
 ])
 
@@ -35261,7 +35359,10 @@  check ovn-nbctl --wait=hv lrp-add ro0 lrp 00:00:00:00:00:01 aef0:0:0:0:0:0:0:1/6
 check ovn-nbctl --wait=hv lsp-del lsp
 check ovn-nbctl lrp-del lrp
 check ovn-nbctl --wait=hv sync
-OVN_CLEANUP([hv1])
+
+# ro0 not local as lrp deleted
+OVN_CLEANUP([hv1
+ignored_dp=ro0])
 AT_CLEANUP
 ])
 
@@ -37385,7 +37486,8 @@  wait_column "" Port_Binding chassis logical_port=lsp2
 # ls1 should not be a local datapath in hv1 as vif1 iface-id has been removed.
 # Hence ln1 should not be a related port.
 OVN_CLEANUP([hv1
-ln1])
+ln1
+ignored_dp=ls1])
 AT_CLEANUP
 ])
 
@@ -38561,7 +38663,9 @@  OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG
 0
 ])
 
-OVN_CLEANUP([hv1])
+# lsw0 not local as lsp1 requested-chassis to differant chassis
+OVN_CLEANUP([hv1
+ignored_dp=lsw0])
 AT_CLEANUP
 ])
 
@@ -39682,7 +39786,9 @@  wait_for_ports_up multi
 check_column $remote_chassis Port_Binding chassis logical_port=multi
 check_column "[]" Port_Binding additional_chassis logical_port=multi
 
-OVN_CLEANUP([hv1])
+# ls is not local datapaths anymore in hv1.
+OVN_CLEANUP([hv1
+ignored_dp=ls])
 
 AT_CLEANUP
 ])