On Thu, Apr 20, 2023 at 6:15 PM Xavier Simonart <xsimo...@redhat.com> wrote:

> This test is broken since a long time but passed as it used
> OVS_WAIT_UNTIL for checking output, which succeeds whatever the output is
> ...
> - Replaced OVS_WAIT_UNTIL by OVS_WAIT_FOR_OUTPUT
> - Update table numbers
> - Added back hv$i-vif1 port
> - Changed slaves to members
> - Added back gw2 (hence could remove the XXX)
>
> The following has also been removed:
>   OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=9 | grep
> arp_tpa=192.168.0.101 | wc -l], [0], [[0
> i.e. checking ARP responder flows in ls_in_arp_rsp as the test expected n
> such flows for
> the lowest priority chassis in the HA group.
>
> Signed-off-by: Xavier Simonart <xsimo...@redhat.com>
> ---
>  tests/ovn.at | 159 +++++++++++++++++++++++----------------------------
>  1 file changed, 72 insertions(+), 87 deletions(-)
>
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 7e804699a..aba3e92c6 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -13277,30 +13277,27 @@ as hv2 ovs-ofctl dump-flows br-int table=37
>  gw1_chassis=$(fetch_column Chassis _uuid name=gw1)
>  gw2_chassis=$(fetch_column Chassis _uuid name=gw2)
>
> -OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv1_gw1_ofport,$hv1_gw2_ofport \
> +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv1_gw1_ofport,$hv1_gw2_ofport \
>  | wc -l], [0], [1
>  ])
>
> -OVS_WAIT_UNTIL([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv2_gw1_ofport,$hv2_gw2_ofport \
> +OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv2_gw1_ofport,$hv2_gw2_ofport \
>  | wc -l], [0], [1
>  ])
>
> -# make sure that flows for handling the outside router port reside on gw1
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=25 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[1
> +# make sure that flows for handling the outside router port reside on gw1
> through ls_in_l2_lkup table
> +OVS_WAIT_FOR_OUTPUT([as gw1 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[1
>  ]])
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=25 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[0
> +OVS_WAIT_FOR_OUTPUT([as gw2 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[0
>  ]])
>
> -# make sure ARP responder flows for outside router port reside on gw1 too
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=9 | \
> -grep arp_tpa=192.168.0.101 | wc -l], [0], [[1
> -]])
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=9 | grep
> arp_tpa=192.168.0.101 | wc -l], [0], [[0
> -]])
> +# make sure ARP responder flows for outside router port reside on gw1 too
> through ls_in_arp_rsp table
> +OVS_WAIT_UNTIL([test `as gw1 ovs-ofctl dump-flows br-int table=27 | \
> +grep arp_tpa=192.168.0.101 | wc -l` -ge 1])
>
>  # check that the chassis redirect port has been claimed by the gw1 chassis
>  wait_row_count Port_Binding 1 logical_port=cr-outside chassis=$gw1_chassis
> @@ -13323,13 +13320,13 @@ wait_for_ports_up
>  check ovn-nbctl --wait=hv sync
>
>  # we make sure that the hypervisors noticed, and inverted the slave ports
> -OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv1_gw2_ofport,$hv1_gw1_ofport \
> +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv1_gw2_ofport,$hv1_gw1_ofport \
>  | wc -l], [0], [1
>  ])
>
> -OVS_WAIT_UNTIL([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv2_gw2_ofport,$hv2_gw1_ofport \
> +OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv2_gw2_ofport,$hv2_gw1_ofport \
>  | wc -l], [0], [1
>  ])
>
> @@ -13381,11 +13378,11 @@ AT_CHECK([ovs-vsctl --bare --columns bfd find
> Interface name=ovn-hv1-0],[0],
>  ]])
>
>  # make sure that flows for handling the outside router port reside on gw2
> now
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=25 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[1
> +OVS_WAIT_FOR_OUTPUT([as gw2 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[1
>  ]])
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=25 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[0
> +OVS_WAIT_FOR_OUTPUT([as gw1 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[0
>  ]])
>
>  # disconnect GW2 from the network, GW1 should take over
> @@ -13395,12 +13392,12 @@ as main ovs-vsctl del-port n1 $port
>
>  bfd_dump
>
> -# make sure that flows for handling the outside router port reside on gw2
> now
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=25 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[1
> +# make sure that flows for handling the outside router port reside on gw1
> now
> +OVS_WAIT_FOR_OUTPUT([as gw1 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[1
>  ]])
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=25 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[0
> +OVS_WAIT_FOR_OUTPUT([as gw2 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[0
>  ]])
>
>  # check that the chassis redirect port has been reclaimed by the gw1
> chassis
> @@ -13479,45 +13476,16 @@ ovn-nbctl set Logical_Router_Port outside
> ha_chassis_group=$hagrp1_uuid
>  wait_row_count HA_Chassis_Group 1
>  wait_row_count HA_Chassis 2
>
> -OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv1_gw1_ofport,$hv1_gw2_ofport \
> -| wc -l], [0], [1
> +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv1_gw1_ofport,$hv1_gw2_ofport \
> +| wc -l], [0], [0
>  ])
>
> -OVS_WAIT_UNTIL([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv2_gw1_ofport,$hv2_gw2_ofport \
> -| wc -l], [0], [1
> +OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv2_gw1_ofport,$hv2_gw2_ofport \
> +| wc -l], [0], [0
>  ])
>
> -# make sure that flows for handling the outside router port reside on gw1
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=24 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[1
> -]])
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=24 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[0
> -]])
> -
> -# make sure ARP responder flows for outside router port reside on gw1 too
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=9 | \
> -grep arp_tpa=192.168.0.101 | wc -l], [0], [[1
> -]])
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=9 | grep
> arp_tpa=192.168.0.101 | wc -l], [0], [[0
> -]])
> -
> -# check that the chassis redirect port has been claimed by the gw1 chassis
> -#
> -# XXX actually it doesn't happen, the test has always been wrong here
> -# because the following just checks that "wc -l" succeeds (and it always
> -# does):
> -#
> -#   OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \
> -#   logical_port=cr-outside | grep $gw1_chassis | wc -l], [0],[[1
> -#   ]])
> -#
> -# If it were correct, then the following would be a good substitute:
> -#
> -#   wait_row_count Port_Binding 1 logical_port=cr-outside
> chassis=$gw1_chassis
> -
>  # Re add the ovs ports.
>  for i in 1 2; do
>      as hv$i
> @@ -13528,6 +13496,34 @@ for i in 1 2; do
>          ofport-request=1
>  done
>
> +# Re-add gw2
> +as gw2 ovn_attach n1 br-phys 192.168.0.1
> +
> +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv1_gw1_ofport,$hv1_gw2_ofport \
> +| wc -l], [0], [1
> +])
> +
> +OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv2_gw1_ofport,$hv2_gw2_ofport \
> +| wc -l], [0], [1
> +])
> +
> +# make sure that flows for handling the outside router port reside on gw1
> +OVS_WAIT_FOR_OUTPUT([as gw1 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[1
> +]])
> +OVS_WAIT_FOR_OUTPUT([as gw2 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst:00:00:02:01:02:04" | wc -l], [0], [[0
> +]])
> +
> +# make sure ARP responder flows for outside router port reside on gw1 too
> +OVS_WAIT_UNTIL([test `as gw1 ovs-ofctl dump-flows br-int table=27 | \
> +grep arp_tpa=192.168.0.101 | wc -l` -ge 1 ])
> +
> +# check that the chassis redirect port has been claimed by the gw1 chassis
> +wait_row_count Port_Binding 1 logical_port=cr-outside chassis=$gw1_chassis
> +
>  hv1_ch_uuid=$(fetch_column Chassis _uuid name=hv1)
>  hv2_ch_uuid=$(fetch_column Chassis _uuid name=hv2)
>  exp_ref_ch_list="$hv1_ch_uuid $hv2_ch_uuid"
> @@ -13536,29 +13532,18 @@ wait_column "$exp_ref_ch_list" HA_Chassis_Group
> ref_chassis
>  # Increase the priority of gw2
>  ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 gw2 40
>
> -OVS_WAIT_UNTIL([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv1_gw2_ofport,$hv1_gw1_ofport \
> +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv1_gw2_ofport,$hv1_gw1_ofport \
>  | wc -l], [0], [1
>  ])
>
> -OVS_WAIT_UNTIL([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> -grep active_backup | grep slaves:$hv2_gw2_ofport,$hv2_gw1_ofport \
> +OVS_WAIT_FOR_OUTPUT([as hv2 ovs-ofctl dump-flows br-int table=37 | \
> +grep active_backup | grep members:$hv2_gw2_ofport,$hv2_gw1_ofport \
>  | wc -l], [0], [1
>  ])
>
>  # check that the chassis redirect port has been reclaimed by the gw2
> chassis
> -#
> -# XXX actually it doesn't happen, the test has always been wrong here
> -# because the following just checks that "wc -l" succeeds (and it always
> -# does):
> -#
> -#   OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \
> -#   logical_port=cr-outside | grep $gw2_chassis | wc -l], [0],[[1
> -#   ]])
> -#
> -# If it were correct, then the following would be a good substitute:
> -#
> -#   wait_row_count Port_Binding 1 logical_port=cr-outside
> chassis=$gw2_chassis
> +wait_row_count Port_Binding 1 logical_port=cr-outside chassis=$gw2_chassis
>
>  # check BFD enablement on tunnel ports from gw1 #########
>  as gw1
> @@ -13597,11 +13582,11 @@ AT_CHECK([ovs-vsctl --bare --columns bfd find
> Interface name=ovn-hv1-0],[0],
>  ]])
>
>  # make sure that flows for handling the outside router port reside on gw2
> now
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=24 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[1
> +OVS_WAIT_FOR_OUTPUT([as gw2 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[1
>  ]])
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=24 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[0
> +OVS_WAIT_FOR_OUTPUT([as gw1 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[0
>  ]])
>
>  # disconnect GW2 from the network, GW1 should take over
> @@ -13612,11 +13597,11 @@ as main ovs-vsctl del-port n1 $port
>  bfd_dump
>
>  # make sure that flows for handling the outside router port reside on gw2
> now
> -OVS_WAIT_UNTIL([as gw1 ovs-ofctl dump-flows br-int table=24 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[1
> +OVS_WAIT_FOR_OUTPUT([as gw1 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[1
>  ]])
> -OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=24 | \
> -grep 00:00:02:01:02:04 | wc -l], [0], [[0
> +OVS_WAIT_FOR_OUTPUT([as gw2 ovs-ofctl dump-flows br-int table=33 | \
> +grep "dl_dst=00:00:02:01:02:04" | wc -l], [0], [[0
>  ]])
>
>  # check that the chassis redirect port has been reclaimed by the gw1
> chassis
> --
> 2.31.1
>
> _______________________________________________
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Looks good to me, thanks.

Acked-by: Ales Musil <amu...@redhat.com>

-- 

Ales Musil

Senior Software Engineer - OVN Core

Red Hat EMEA <https://www.redhat.com>

amu...@redhat.com    IM: amusil
<https://red.ht/sig>
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to