Skip to content

Commit c073a5c

Browse files
simonartxavierdceara
authored andcommitted
tests: Fix flaky "ovn-controller: Multiple OVS interfaces ...".
The tests was sometimes (rarely) failing as: - Looking for flows with e.g. cookie c5d057f but hitting cookie bec5d057. - Looking for flows with e.g. cookie 1000000 but hitting set_field:0x1000000. Signed-off-by: Xavier Simonart <[email protected]> Acked-by: Ales Musil <[email protected]> Signed-off-by: Dumitru Ceara <[email protected]>
1 parent 89e43f7 commit c073a5c

File tree

1 file changed

+35
-44
lines changed

1 file changed

+35
-44
lines changed

tests/ovn.at

Lines changed: 35 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -35517,6 +35517,22 @@ m4_define([MULTIPLE_OVS_INT],
3551735517
sed -e 's/n_bytes=[[0-9]]*, //g'
3551835518
}
3551935519

35520+
WAIT_UNTIL_FLOWS()
35521+
{
35522+
cookie=${1}
35523+
interface=${2}
35524+
OVS_WAIT_UNTIL([
35525+
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=$interface)
35526+
ovs-ofctl dump-flows br-int | grep "cookie=$cookie" | grep "actions=output:$ofport"
35527+
])
35528+
}
35529+
35530+
get_nb_flows()
35531+
{
35532+
cookie=${1}
35533+
ovs-ofctl dump-flows br-int | grep -c "cookie=$cookie"
35534+
}
35535+
3552035536
check ovn-nbctl ls-add ls
3552135537
check ovn-nbctl lsp-add ls lp
3552235538
if test X$1 != X; then
@@ -35540,13 +35556,11 @@ m4_define([MULTIPLE_OVS_INT],
3554035556
echo ======================================================
3554135557
echo === Flows after iface-id set for the old interface ===
3554235558
echo ======================================================
35543-
COOKIE=$(ovn-sbctl find port_binding logical_port=lp|grep uuid|cut -d: -f2| cut -c1-8 | sed 's/^\s*0\{0,8\}//')
35559+
COOKIE=$(ovn-debug uuid-to-cookie $(fetch_column port_binding _uuid logical_port=lp))
3554435560

35545-
OVS_WAIT_UNTIL([
35546-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lpold)
35547-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35548-
])
35549-
nb_flows=`ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l`
35561+
WAIT_UNTIL_FLOWS $COOKIE lpold
35562+
35563+
nb_flows=$(get_nb_flows $COOKIE )
3555035564
echo $nb_flows "flows after iface-id set for old interface"
3555135565

3555235566
echo ======================================================
@@ -35555,11 +35569,8 @@ m4_define([MULTIPLE_OVS_INT],
3555535569
# Set external_ids:iface-id within same transaction as adding the port.
3555635570
# This will generally cause ovn-controller to get initially notified of ovs interface changes with ofport == 0.
3555735571
check ovs-vsctl add-port br-int lpnew -- set interface lpnew type=internal -- set interface lpnew external_ids:iface-id=lp
35558-
OVS_WAIT_UNTIL([
35559-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lpnew)
35560-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35561-
])
35562-
check test "$nb_flows" = $(ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l)
35572+
WAIT_UNTIL_FLOWS $COOKIE lpnew
35573+
check test "$nb_flows" = $(get_nb_flows $COOKIE)
3556335574
flows_lpnew=$(get_flows $COOKIE)
3556435575

3556535576
echo ======================================================
@@ -35568,7 +35579,7 @@ m4_define([MULTIPLE_OVS_INT],
3556835579
check ovs-vsctl del-port br-int lpold
3556935580
# We do not expect changes, so let's wait for controller to get time to process any update
3557035581
check ovn-nbctl --wait=hv sync
35571-
check test "$nb_flows" = $(ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l)
35582+
check test "$nb_flows" = $(get_nb_flows $COOKIE)
3557235583
flows_after_deletion=$(get_flows $COOKIE)
3557335584
check test "$flows_lpnew" = "$flows_after_deletion"
3557435585

@@ -35579,23 +35590,15 @@ m4_define([MULTIPLE_OVS_INT],
3557935590
# This will generally cause ovn-controller to get notified of ovs interface changes with a proper ofport.
3558035591
check ovs-vsctl add-port br-int lptemp -- set Interface lptemp type=internal
3558135592
check ovs-vsctl set Interface lptemp external_ids:iface-id=lp
35582-
OVS_WAIT_UNTIL([
35583-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lptemp)
35584-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35585-
])
35586-
check test "$nb_flows" = $(ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l)
35593+
WAIT_UNTIL_FLOWS $COOKIE lptemp
35594+
check test "$nb_flows" = $(get_nb_flows $COOKIE)
3558735595

3558835596
echo ======================================================
3558935597
echo ======= Flows after lptemp interface is deleted ======
3559035598
echo ======================================================
3559135599
check ovs-vsctl del-port br-int lptemp
35592-
OVS_WAIT_UNTIL([
35593-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lpnew)
35594-
echo $ofport
35595-
ovs-ofctl dump-flows br-int | grep $COOKIE
35596-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35597-
])
35598-
check test "$nb_flows" = $(ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l)
35600+
WAIT_UNTIL_FLOWS $COOKIE lpnew
35601+
check test "$nb_flows" = $(get_nb_flows $COOKIE)
3559935602
flows_after_deletion=$(get_flows $COOKIE)
3560035603
check test "$flows_lpnew" = "$flows_after_deletion"
3560135604

@@ -35604,7 +35607,7 @@ m4_define([MULTIPLE_OVS_INT],
3560435607
echo ======================================================
3560535608
check ovs-vsctl del-port br-int lpnew
3560635609
OVS_WAIT_UNTIL([
35607-
nb_flows=`ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l`
35610+
nb_flows=`get_nb_flows $COOKIE`
3560835611
test "${nb_flows}" = $nb_flows_ref
3560935612
])
3561035613

@@ -35617,21 +35620,15 @@ m4_define([MULTIPLE_OVS_INT],
3561735620
check ovs-vsctl set interface lpnew external_ids:iface-id=lp
3561835621

3561935622
# Wait for lpnew flows to be installed
35620-
OVS_WAIT_UNTIL([
35621-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lpnew)
35622-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35623-
])
35623+
WAIT_UNTIL_FLOWS $COOKIE lpnew
3562435624
flows_lpnew=$(get_flows $COOKIE)
35625-
nb_flows=`ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l`
35625+
nb_flows=`get_nb_flows $COOKIE`
3562635626

3562735627
check ovs-vsctl add-port br-int lptemp -- set Interface lptemp type=internal
3562835628
check ovs-vsctl set Interface lptemp external_ids:iface-id=lp
3562935629

3563035630
# Wait for lptemp flows to be installed
35631-
OVS_WAIT_UNTIL([
35632-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lptemp)
35633-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35634-
])
35631+
WAIT_UNTIL_FLOWS $COOKIE lptemp
3563535632

3563635633
# Delete both lpold and lptemp to go to a stable situation
3563735634
check ovs-vsctl del-port br-int lptemp
@@ -35642,21 +35639,15 @@ m4_define([MULTIPLE_OVS_INT],
3564235639
])
3564335640

3564435641
# Wait for correct/lpnew flows to be installed
35645-
OVS_WAIT_UNTIL([
35646-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lpnew)
35647-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35648-
])
35649-
check test "$nb_flows" = $(ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l)
35642+
WAIT_UNTIL_FLOWS $COOKIE lpnew
35643+
check test "$nb_flows" = $(get_nb_flows $COOKIE)
3565035644
flows_after_deletion=$(get_flows $COOKIE)
3565135645
check test "$flows_lpnew" = "$flows_after_deletion"
3565235646

3565335647
# Check that recompute still works
3565435648
check ovn-appctl -t ovn-controller recompute
35655-
OVS_WAIT_UNTIL([
35656-
ofport=$(ovs-vsctl --bare --columns ofport find Interface name=lpnew)
35657-
ovs-ofctl dump-flows br-int | grep $COOKIE | grep "actions=output:$ofport"
35658-
])
35659-
check test "$nb_flows" = $(ovs-ofctl dump-flows br-int | grep $COOKIE | wc -l)
35649+
WAIT_UNTIL_FLOWS $COOKIE lpnew
35650+
check test "$nb_flows" = $(get_nb_flows $COOKIE)
3566035651
flows_after_deletion=$(get_flows $COOKIE)
3566135652
check test "$flows_lpnew" = "$flows_after_deletion"
3566235653

0 commit comments

Comments
 (0)