@@ -16246,15 +16246,13 @@ sim_add hv1
as hv1
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.11
-ovs-vsctl -- add-port br-int hv1-vif0 -- \
-set Interface hv1-vif0 ofport-request=1
+ovs-vsctl -- add-port br-int hv1-vif0
sim_add hv2
as hv2
ovs-vsctl add-br br-phys
ovn_attach n1 br-phys 192.168.0.12
-ovs-vsctl -- add-port br-int hv2-vif0 -- \
-set Interface hv2-vif0 ofport-request=1
+ovs-vsctl -- add-port br-int hv2-vif0
# Allow only chassis hv1 to bind logical port lsp0.
ovn-nbctl lsp-set-options lsp0 requested-chassis=hv1
@@ -16262,6 +16260,16 @@ ovn-nbctl lsp-set-options lsp0 requested-chassis=hv1
# Allow some time for ovn-northd and ovn-controller to catch up.
check ovn-nbctl --wait=hv sync
+OVS_WAIT_UNTIL([
+ hv1_ofport=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=hv1-vif0)
+ test 1 -le $hv1_ofport
+])
+
+OVS_WAIT_UNTIL([
+ hv2_ofport=$(as hv2 ovs-vsctl --bare --columns ofport find Interface name=hv2-vif0)
+ test 1 -le $hv2_ofport
+])
+
# Retrieve hv1 and hv2 chassis UUIDs from southbound database
wait_row_count Chassis 1 name=hv1
wait_row_count Chassis 1 name=hv2
@@ -16277,7 +16285,7 @@ OVS_WAIT_UNTIL([test 1 = $(grep -c "Not claiming lport lsp0" hv2/ovn-controller.
wait_row_count Port_Binding 1 logical_port=lsp0 'chassis=[[]]'
# (2) Chassis hv2 should not add flows in OFTABLE_PHY_TO_LOG and OFTABLE_LOG_TO_PHY tables.
-AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=1], [1], [])
+AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=$hv2_ofport], [1], [])
AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep output], [1], [])
# (3) Chassis hv1 should bind lsp0 when physical to logical mapping exists on hv1.
@@ -16290,8 +16298,8 @@ wait_column "$hv1_uuid" Port_Binding chassis logical_port=lsp0
# (4) Chassis hv1 should add flows in OFTABLE_PHY_TO_LOG and OFTABLE_LOG_TO_PHY tables.
as hv1 ovs-ofctl dump-flows br-int
-AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=1], [0], [ignore])
-AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep actions=output:1], [0], [ignore])
+AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=$hv1_ofport], [0], [ignore])
+AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep actions=output:$hv1_ofport], [0], [ignore])
# (5) Chassis hv1 should release lsp0 binding and chassis hv2 should bind lsp0 when
# the requested chassis for lsp0 is changed from hv1 to hv2.
@@ -16304,10 +16312,10 @@ OVS_WAIT_UNTIL([test 1 -le $(grep -c "Releasing lport lsp0" hv1/ovn-controller.l
wait_column "$hv2_uuid" Port_Binding chassis logical_port=lsp0
# (6) Chassis hv2 should add flows and hv1 should not.
-AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=1], [0], [ignore])
-AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep actions=output:1], [0], [ignore])
+AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_PHY_TO_LOG | grep in_port=$hv2_ofport], [0], [ignore])
+AT_CHECK([as hv2 ovs-ofctl dump-flows br-int table=OFTABLE_LOG_TO_PHY | grep actions=output:$hv2_ofport], [0], [ignore])
-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_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])
The test was failing due to the following race condition. By using ofport-request, there is the risk that the ofport is initially not assigned the expected value, and hence that the ofport changes. This happens for instance if the geneve interface gets the ofport expected for the vif. In that case, both the geneve and the vif see their ofports changing. An ofport change for the geneve interface is not I+P handled. If this change is handled within the same loop as the iface-id setting for the vif, then a runtime data recompute happened for the vif, and the expected log was not produced. Signed-off-by: Xavier Simonart <xsimonar@redhat.com> --- tests/ovn.at | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)