7f7b2c
From df617604c7b1f366601bcec6fd0c752f8a52977c Mon Sep 17 00:00:00 2001
7f7b2c
From: Dumitru Ceara <dceara@redhat.com>
7f7b2c
Date: Wed, 16 Dec 2020 13:59:02 +0100
7f7b2c
Subject: [PATCH 7/7] tests: Make "ovn -- ovn-controller incremental
7f7b2c
 processing" more reliable.
7f7b2c
7f7b2c
Relax the full recompute checks as changes to tunnel interfaces, e.g. due
7f7b2c
to BFD state changes, are not processed incrementally and cause full
7f7b2c
recomputes.  On slower systems (like in CI) this can happen more often.
7f7b2c
7f7b2c
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
7f7b2c
Signed-off-by: Mark Michelson <mmichels@redhat.com>
7f7b2c
Acked-by: Ilya Maximets <i.maximets@ovn.org>
7f7b2c
---
7f7b2c
 tests/ovn-performance.at | 111 +++++++++++++++++++--------------------
7f7b2c
 1 file changed, 53 insertions(+), 58 deletions(-)
7f7b2c
7f7b2c
diff --git a/tests/ovn-performance.at b/tests/ovn-performance.at
7f7b2c
index 6cc5b2174..e510c6cef 100644
7f7b2c
--- a/tests/ovn-performance.at
7f7b2c
+++ b/tests/ovn-performance.at
7f7b2c
@@ -232,37 +232,32 @@ AT_SETUP([ovn -- ovn-controller incremental processing])
7f7b2c
 
7f7b2c
 ovn_start
7f7b2c
 net_add n1
7f7b2c
-for i in 1 2; do
7f7b2c
+for i in `seq 1 5`; do
7f7b2c
     sim_add hv$i
7f7b2c
     as hv$i
7f7b2c
     ovs-vsctl add-br br-phys
7f7b2c
     ovn_attach n1 br-phys 192.168.0.$i
7f7b2c
-done
7f7b2c
-
7f7b2c
-for i in 1 2 3; do
7f7b2c
-    sim_add gw$i
7f7b2c
-    as gw$i
7f7b2c
-    ovs-vsctl add-br br-phys
7f7b2c
-    ovs-vsctl add-br br-ex
7f7b2c
-    ovs-vsctl set open . external_ids:ovn-bridge-mappings="public:br-ex"
7f7b2c
-    j=$((i + 2))
7f7b2c
-    ovn_attach n1 br-phys 192.168.0.$j
7f7b2c
-    ip link add vgw$i type dummy
7f7b2c
-    ovs-vsctl add-port br-ex vgw$i
7f7b2c
+    if [[ $i -ge 3 ]] ; then
7f7b2c
+        ovs-vsctl add-br br-ex
7f7b2c
+        ovs-vsctl set open . external_ids:ovn-bridge-mappings="public:br-ex"
7f7b2c
+        ip link add vgw$i type dummy
7f7b2c
+        ovs-vsctl add-port br-ex vgw$i
7f7b2c
+    fi
7f7b2c
 done
7f7b2c
 
7f7b2c
 # Wait for the tunnel ports to be created and up.
7f7b2c
 # Otherwise this may affect the lflow_run count.
7f7b2c
+for i in `seq 1 5`; do
7f7b2c
+    for j in `seq 1 5`; do
7f7b2c
+        if [[ $i -ne $j ]] ; then
7f7b2c
+            OVS_WAIT_UNTIL([
7f7b2c
+                test $(as hv$i ovs-vsctl list interface ovn-hv$j-0 | \
7f7b2c
+            grep -c tunnel_egress_iface_carrier=up) -eq 1
7f7b2c
+            ])
7f7b2c
+        fi
7f7b2c
+    done
7f7b2c
+done
7f7b2c
 
7f7b2c
-OVS_WAIT_UNTIL([
7f7b2c
-    test $(as hv1 ovs-vsctl list interface ovn-hv2-0 | \
7f7b2c
-grep tunnel_egress_iface_carrier=up | wc -l) -eq 1
7f7b2c
-])
7f7b2c
-
7f7b2c
-OVS_WAIT_UNTIL([
7f7b2c
-    test $(as hv2 ovs-vsctl list interface ovn-hv1-0 | \
7f7b2c
-grep tunnel_egress_iface_carrier=up | wc -l) -eq 1
7f7b2c
-])
7f7b2c
 
7f7b2c
 # Add router lr1
7f7b2c
 OVN_CONTROLLER_EXPECT_NO_HIT(
7f7b2c
@@ -463,63 +458,63 @@ OVN_CONTROLLER_EXPECT_NO_HIT(
7f7b2c
 )
7f7b2c
 
7f7b2c
 OVN_CONTROLLER_EXPECT_HIT_COND(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run], [=0 =0 >0 =0 =0],
7f7b2c
-    [ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public gw1 30 && ovn-nbctl --wait=hv sync]
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run], [=0 =0 >0 =0 =0],
7f7b2c
+    [ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public hv3 30 && ovn-nbctl --wait=hv sync]
7f7b2c
 )
7f7b2c
 
7f7b2c
-# After this, BFD should be enabled from hv1 and hv2 to gw1.
7f7b2c
-# So there should be lflow_run hits in hv1, hv2, gw1 and gw2
7f7b2c
+# After this, BFD should be enabled from hv1 and hv2 to hv3.
7f7b2c
+# So there should be lflow_run hits in hv1, hv2, hv3 and hv4
7f7b2c
 OVN_CONTROLLER_EXPECT_HIT_COND(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run], [>0 >0 >0 >0 =0],
7f7b2c
-    [ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public gw2 20 && ovn-nbctl --wait=hv sync]
7f7b2c
-)
7f7b2c
-
7f7b2c
-OVN_CONTROLLER_EXPECT_HIT(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run],
7f7b2c
-    [ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public gw3 10 && ovn-nbctl --wait=hv sync]
7f7b2c
-)
7f7b2c
-
7f7b2c
-# create QoS rule
7f7b2c
-OVN_CONTROLLER_EXPECT_NO_HIT(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run],
7f7b2c
-    [ovn-nbctl --wait=hv set Logical_Switch_Port ln-public options:qos_burst=1000]
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run], [>0 >0 >0 >0 =0],
7f7b2c
+    [ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public hv4 20 && ovn-nbctl --wait=hv sync]
7f7b2c
 )
7f7b2c
 
7f7b2c
 OVN_CONTROLLER_EXPECT_HIT(
7f7b2c
-    [gw1], [lflow_run],
7f7b2c
-    [as gw1 ovs-vsctl set interface vgw1 external-ids:ovn-egress-iface=true]
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run],
7f7b2c
+    [ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public hv5 10 && ovn-nbctl --wait=hv sync]
7f7b2c
 )
7f7b2c
 
7f7b2c
-# Make gw2 master. There is remote possibility that full recompute
7f7b2c
-# triggers for gw2 after it becomes master. Most of the time
7f7b2c
-# there will be no recompute.
7f7b2c
-ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public gw2 40
7f7b2c
-gw2_ch=$(ovn-sbctl --bare --columns _uuid list chassis gw2)
7f7b2c
-OVS_WAIT_UNTIL([ovn-sbctl find port_binding logical_port=cr-lr1-public chassis=$gw2_ch])
7f7b2c
+# Make hv4 master. There is remote possibility that full recompute
7f7b2c
+# triggers for hv1-hv5 after hv4 becomes master because of updates to the
7f7b2c
+# ovn-hv$i-0 interfaces. Most of the time there will be no recompute.
7f7b2c
+ovn-nbctl --wait=hv lrp-set-gateway-chassis lr1-public hv4 40
7f7b2c
+hv4_ch=$(ovn-sbctl --bare --columns _uuid list chassis hv4)
7f7b2c
+OVS_WAIT_UNTIL([ovn-sbctl find port_binding logical_port=cr-lr1-public chassis=$hv4_ch])
7f7b2c
 
7f7b2c
 OVN_CONTROLLER_EXPECT_HIT_COND(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run],  [=0 =0 =0 >=0 =0],
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run],  [>=0 >=0 >=0 >=0 >=0],
7f7b2c
     [ovn-nbctl --wait=hv sync]
7f7b2c
 )
7f7b2c
 
7f7b2c
-# Delete gw2 from gateway chassis
7f7b2c
+# Delete hv4 from gateway chassis
7f7b2c
 OVN_CONTROLLER_EXPECT_HIT(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run],
7f7b2c
-    [ovn-nbctl --wait=hv lrp-del-gateway-chassis lr1-public gw2 && ovn-nbctl --wait=hv sync]
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run],
7f7b2c
+    [ovn-nbctl --wait=hv lrp-del-gateway-chassis lr1-public hv4 && ovn-nbctl --wait=hv sync]
7f7b2c
 )
7f7b2c
 
7f7b2c
-# Delete gw1 from gateway chassis
7f7b2c
-# After this, the BFD should be disabled entirely as gw3 is the
7f7b2c
+# Delete hv3 from gateway chassis
7f7b2c
+# After this, the BFD should be disabled entirely as hv5 is the
7f7b2c
 # only gateway chassis.
7f7b2c
 OVN_CONTROLLER_EXPECT_HIT_COND(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run],  [>0 >0 >0 =0 >0],
7f7b2c
-    [ovn-nbctl --wait=hv lrp-del-gateway-chassis lr1-public gw1]
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run],  [>0 >0 >0 =0 >0],
7f7b2c
+    [ovn-nbctl --wait=hv lrp-del-gateway-chassis lr1-public hv3]
7f7b2c
 )
7f7b2c
 
7f7b2c
-# Delete gw3 from gateway chassis. There should be no lflow_run.
7f7b2c
+# Delete hv5 from gateway chassis. There should be no lflow_run.
7f7b2c
 OVN_CONTROLLER_EXPECT_NO_HIT(
7f7b2c
-    [hv1 hv2 gw1 gw2 gw3], [lflow_run],
7f7b2c
-    [ovn-nbctl --wait=hv lrp-del-gateway-chassis lr1-public gw3]
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run],
7f7b2c
+    [ovn-nbctl --wait=hv lrp-del-gateway-chassis lr1-public hv5]
7f7b2c
+)
7f7b2c
+
7f7b2c
+# create QoS rule
7f7b2c
+OVN_CONTROLLER_EXPECT_NO_HIT(
7f7b2c
+    [hv1 hv2 hv3 hv4 hv5], [lflow_run],
7f7b2c
+    [ovn-nbctl --wait=hv set Logical_Switch_Port ln-public options:qos_burst=1000]
7f7b2c
+)
7f7b2c
+
7f7b2c
+OVN_CONTROLLER_EXPECT_HIT(
7f7b2c
+    [hv3], [lflow_run],
7f7b2c
+    [as hv3 ovs-vsctl set interface vgw3 external-ids:ovn-egress-iface=true]
7f7b2c
 )
7f7b2c
 
7f7b2c
 for i in 1 2; do
7f7b2c
-- 
7f7b2c
2.28.0
7f7b2c