Skip to content

Commit

Permalink
tests: Fixed "1 LR with HA distributed router gateway port"
Browse files Browse the repository at this point in the history
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 <xsimonar@redhat.com>
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Mark Michelson <mmichels@redhat.com>
  • Loading branch information
simonartxavier authored and putnopvut committed May 1, 2023
1 parent b026482 commit 8bc3876
Showing 1 changed file with 72 additions and 87 deletions.
159 changes: 72 additions & 87 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
])

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 8bc3876

Please sign in to comment.