Simulated chassis are added with ovn_attach(), ovn_az_attach() and start_virtual_controller(). Wait for ovn-controllers to register in the Southbound (create their Encap record) before continuing. That's required because 'ovn-nbctl --wait=hv sync' (used throughout the test suite) has different semantics if no chassis is registered in the Southbound. In those cases the command is equivalent to 'ovn-nbctl --wait=sb sync'.
This was causing a race condition due to which CI would occasionally fail because of missing OpenFlows, e.g.: https://github.com/ovsrobot/ovn/actions/runs/6471719045/job/17570941948#step:8:4849 Co-authored-by: Xavier Simonart <xsimo...@redhat.com> Signed-off-by: Xavier Simonart <xsimo...@redhat.com> Signed-off-by: Dumitru Ceara <dce...@redhat.com> --- tests/ovn-macros.at | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index e2ed67eab3..2afed2c17d 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -288,6 +288,25 @@ net_attach () { || return 1 } +ovn_wait_for_encaps() { + local systemid=$1 + + local encap=$(ovs-vsctl get Open_vSwitch . external_ids:ovn-encap-type-$systemid) + if [[ -n "$encap" ]]; then + encap=$(ovs-vsctl get Open_vSwitch .external_ids:ovn-encap-type) + fi + + local ip=$(ovs-vsctl get Open_vSwitch . external_ids:ovn-encap-ip-$systemid) + if [[ -n "$ip" ]]; then + ip=$(ovs-vsctl get Open_vSwitch .external_ids:ovn-encap-ip) + fi + + IFS="," read -r -a encap_types <<< "$encap" + for e in "${encap_types[[@]]}"; do + wait_column "$ip" sb:Encap ip chassis_name="$systemid" type="$e" + done +} + # ovn_az_attach AZ NETWORK BRIDGE IP [MASKLEN] [ENCAP] ovn_az_attach() { local az=$1 net=$2 bridge=$3 ip=$4 masklen=${5-24} encap=${6-geneve,vxlan} systemid=${7-$sandbox} cli_args=${@:8} @@ -332,6 +351,11 @@ ovn_az_attach() { fi start_daemon ovn-controller --enable-dummy-vif-plug ${cli_args} || return 1 + if test X"$az" = XNONE; then + ovn_wait_for_encaps $systemid + else + ovn_as $az ovn_wait_for_encaps $systemid + fi } # ovn_attach NETWORK BRIDGE IP [MASKLEN] [ENCAP] @@ -372,6 +396,7 @@ start_virtual_controller() { || return 1 ovn-controller --enable-dummy-vif-plug ${cli_args} -vconsole:off --detach --no-chdir + ovn_wait_for_encaps $systemid } # ovn_setenv AZ -- 2.39.3 _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev