From patchwork Fri Oct 30 00:24:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390528 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkX4Csqz9sSn for ; Fri, 30 Oct 2020 11:25:08 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id BCC46229D4; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uiNETuOOKuxL; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 4E4582047C; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 178D8C0859; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id BCBD6C0051 for ; Fri, 30 Oct 2020 00:24:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id B028E2046E for ; Fri, 30 Oct 2020 00:24:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sG4NNN-S5te8 for ; Fri, 30 Oct 2020 00:24:58 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by silver.osuosl.org (Postfix) with ESMTPS id 5F41220354 for ; Fri, 30 Oct 2020 00:24:58 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id CF5E540002; Fri, 30 Oct 2020 00:24:52 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:32 -0700 Message-Id: <20201030002447.936548-1-blp@ovn.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 01/16] tests: Drop support for glibc before version 2.11. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" The "ldd" call here didn't work if libtool was involved and would print an error message. We could fix that, but the check is only needed for glibc earlier than 2.11. glibc 2.11 was released in 2009, so it should be safe to expect that testers are running it or a newer version. Signed-off-by: Ben Pfaff Acked-by: Numan Siddique --- tests/atlocal.in | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/tests/atlocal.in b/tests/atlocal.in index 26681f02d851..4517ebf72fab 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -46,23 +46,7 @@ esac case `uname` in Linux) MALLOC_PERTURB_=165; export MALLOC_PERTURB_ - - # Before glibc 2.11, the feature enabled by MALLOC_CHECK_ was not - # thread-safe. See https://bugzilla.redhat.com/show_bug.cgi?id=585674 and - # in particular the patch attached there, which was applied to glibc CVS as - # "Restore locking in free_check." between 1.11 and 1.11.1. - binary=$abs_top_builddir/controller/ovn-controller - glibc=`ldd $binary | sed -n 's/^ libc\.[^ ]* => \([^ ]*\) .*/\1/p'` - glibc_version=`$glibc | sed -n '1s/.*version \([0-9]\{1,\}\.[0-9]\{1,\}\).*/\1/p'` - case $glibc_version in - 2.[0-9] | 2.1[01]) mcheck=disabled ;; - *) mcheck=enabled ;; - esac - if test $mcheck = enabled; then - MALLOC_CHECK_=2; export MALLOC_CHECK_ - else - echo >&2 "glibc $glibc_version detected, disabling memory checking" - fi + MALLOC_CHECK_=2; export MALLOC_CHECK_ ;; FreeBSD) case `uname -r` in From patchwork Fri Oct 30 00:24:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390542 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjm76t7Wz9sSf for ; Fri, 30 Oct 2020 11:26:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0E3EA86D96; Fri, 30 Oct 2020 00:26:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7M6mA6qh4XVQ; Fri, 30 Oct 2020 00:25:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 0B64F86CC1; Fri, 30 Oct 2020 00:25:26 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E4B08C1ADD; Fri, 30 Oct 2020 00:25:25 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4DD22C1AE8 for ; Fri, 30 Oct 2020 00:25:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 306258685F for ; Fri, 30 Oct 2020 00:25:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kHjdKzeCovBD for ; Fri, 30 Oct 2020 00:24:59 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5BC738667D for ; Fri, 30 Oct 2020 00:24:58 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 365FE40003; Fri, 30 Oct 2020 00:24:54 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:33 -0700 Message-Id: <20201030002447.936548-2-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 02/16] tests: Introduce new testing helpers. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" These simplify a lot of otherwise harder to understand checks within the tests. This commit should show how valuable they are, although I'm sure scope remains to use them in more places. Signed-off-by: Ben Pfaff --- tests/ovn-controller.at | 8 +- tests/ovn-ic.at | 31 +-- tests/ovn-macros.at | 121 ++++++++++ tests/ovn-nbctl.at | 12 +- tests/ovn-northd.at | 524 ++++++++++------------------------------ tests/ovn.at | 495 +++++++++++++------------------------ tests/ovs-macros.at | 41 +++- 7 files changed, 468 insertions(+), 764 deletions(-) diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at index d8061345f8f3..014a97760bec 100644 --- a/tests/ovn-controller.at +++ b/tests/ovn-controller.at @@ -201,9 +201,7 @@ OVS_WAIT_UNTIL([ ]) # Only one Chassis_Private record should exist. -OVS_WAIT_UNTIL([ - test $(ovn-sbctl --columns _uuid list chassis_private | wc -l) -eq 1 -]) +wait_row_count Chassis_Private 1 # Simulate system-id changing while ovn-controller is disconnected from the # SB. @@ -227,9 +225,7 @@ OVS_WAIT_UNTIL([ ]) # Only one Chassis_Private record should exist. -OVS_WAIT_UNTIL([ - test $(ovn-sbctl --columns _uuid list chassis_private | wc -l) -eq 1 -]) +wait_row_count Chassis_Private 1 # Gracefully terminate daemons OVN_CLEANUP_SBOX([hv]) diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index 6fb00319a4f5..1d40ce958d6c 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -5,7 +5,7 @@ ovn_init_ic_db ovn_start az1 ovn_start az2 -OVS_WAIT_UNTIL([test `ovn-ic-sbctl show | wc -l` -eq 2]) +wait_row_count ic-sb:Availability_Zone 2 AT_CHECK([ovn-ic-sbctl show], [0], [dnl availability-zone az1 availability-zone az2 @@ -39,32 +39,21 @@ AT_CHECK([ovn-ic-nbctl ts-add ts1]) AT_CHECK([ovn-ic-nbctl ts-add ts2]) # Check ISB -OVS_WAIT_UNTIL([ovn-ic-sbctl list datapath | grep ts2]) -AT_CHECK([ovn-ic-sbctl -f csv -d bare --no-headings --columns transit_switch list datapath | sort], [0], [dnl -ts1 -ts2 -]) +wait_row_count ic-sb:Datapath_Binding 1 transit_switch=ts1 +wait_row_count ic-sb:Datapath_Binding 1 transit_switch=ts2 +check_column "ts1 ts2" ic-sb:Datapath_Binding transit_switch +check_column "ts1 ts2" nb:Logical_Switch name -# Check NB -AT_CHECK([ovn-nbctl -f csv -d bare --no-headings --columns name list logical_switch | sort], [0], [dnl -ts1 -ts2 -]) # Check SB DP key -ts1_key=$(ovn-ic-sbctl -f csv -d bare --no-headings --columns tunnel_key find datapath transit_switch=ts1) -sb_ts1_key=$(ovn-sbctl -f csv -d bare --no-headings --columns tunnel_key find datapath_binding external_ids:interconn-ts=ts1) -AT_CHECK([test $ts1_key = $sb_ts1_key]) +ts1_key=$(fetch_column ic-sb:Datapath_Binding tunnel_key transit_switch=ts1) +check_column "$ts1_key" Datapath_Binding tunnel_key external_ids:interconn-ts=ts1 # Test delete AT_CHECK([ovn-ic-nbctl ts-del ts1]) -OVS_WAIT_WHILE([ovn-ic-sbctl list datapath | grep ts1]) -AT_CHECK([ovn-ic-sbctl -f csv -d bare --no-headings --columns transit_switch list datapath], [0], [dnl -ts2 -]) -AT_CHECK([ovn-nbctl -f csv -d bare --no-headings --columns name list logical_switch | sort], [0], [dnl -ts2 -]) +wait_row_count ic-sb:Datapath_Binding 0 transit_switch=ts1 +check_column ts2 ic-sb:Datapath_Binding transit_switch +check_column ts2 nb:Logical_Switch name OVN_CLEANUP_IC([az1]) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index a6719be8303f..be596caf33d0 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -286,4 +286,125 @@ ovn_populate_arp__() { } m4_divert_pop([PREPARE_TESTS]) +OVS_START_SHELL_HELPERS +# check COMMAND... +# +# Runs COMMAND and checks that it succeeds without any output. +check() { + echo "$@" + AT_CHECK(["$@"]) +} + +parse_db() { + case $1 in + (*:*) echo ${1%%:*} ;; + (*) echo sb ;; + esac +} + +parse_table() { + case $1 in + (*:*) echo ${1##*:} ;; + (*) echo $1 ;; + esac +} + +# count_rows TABLE [CONDITION...] +# +# Prints the number of rows in TABLE (that satisfy CONDITION). +# Uses the southbound db by default; set DB=nb for the northbound database. +count_rows() { + local db=$(parse_db $1) table=$(parse_table $1); shift + ovn-${db}ctl --format=table --no-headings find $table "$@" | wc -l +} + +# check_row_count [DATABASE:]TABLE COUNT [CONDITION...] +# +# Checks that TABLE contains COUNT rows (that satisfy CONDITION). +# The default DATABASE is "sb". +check_row_count() { + local db=$(parse_db $1) table=$(parse_table $1); shift + local count=$1; shift + local found=$(count_rows $db:$table "$@") + echo + echo "Checking for $count rows in $db $table${1+ with $*}... found $found" + if test "$count" != "$found"; then + ovn-${db}ctl list $table + AT_FAIL_IF([:]) + fi +} + +# wait_row_count [DATABASE:]TABLE COUNT [CONDITION...] +# +# Waits until TABLE contains COUNT rows (that satisfy CONDITION). +# The default DATABASE is "sb". +wait_row_count() { + local db=$(parse_db $1) table=$(parse_table $1); shift + local count=$1; shift + local a=$1 b=$2 c=$3 + echo "Waiting until $count rows in $db $table${1+ with $*}..." + OVS_WAIT_UNTIL([test $count = $(count_rows $db:$table $a $b $c)],[ + echo "$db table $table has the following rows. $(count_rows $db:$table $a $b $c) rows match instead of expected $count:" + ovn-${db}ctl list $table]) +} + +# fetch_column [DATABASE:]TABLE COLUMN [CONDITION...] +# +# Fetches and prints all the values of COLUMN in the rows of TABLE +# (that satisfy CONDITION), sorting the results lexicographically. +# The default DATABASE is "sb". +fetch_column() { + local db=$(parse_db $1) table=$(parse_table $1) column=${2-_uuid}; shift; shift + # Using "echo" removes spaces and newlines. + echo $(ovn-${db}ctl --bare --columns $column find $table "$@" | sort) +} + +# check_column EXPECTED [DATABASE:]TABLE COLUMN [CONDITION...] +# +# Fetches all of the values of COLUMN in the rows of TABLE (that +# satisfy CONDITION), and compares them against EXPECTED (ignoring +# order). +# +# The default DATABASE is "sb". +check_column() { + local expected=$1 db=$(parse_db $2) table=$(parse_table $2) column=${3-_uuid}; shift; shift; shift + local found=$(ovn-${db}ctl --bare --columns $column find $table "$@") + + # Sort the expected and found values. + local found=$(for d in $found; do echo $d; done | sort) + local expected=$(for d in $expected; do echo $d; done | sort) + + echo + echo "Checking values in $db $table${1+ with $*} against $expected... found $found" + if test "$found" != "$expected"; then + ovn-${db}ctl list $table + AT_FAIL_IF([:]) + fi +} + +# wait_column EXPECTED [DATABASE:]TABLE [COLUMN [CONDITION...]] +# +# Wait until all of the values of COLUMN in the rows of TABLE (that +# satisfy CONDITION) equal EXPECTED (ignoring order). +# +# The default DATABASE is "sb". +# +# COLUMN defaults to _uuid if unspecified. +wait_column() { + local expected=$(for d in $1; do echo $d; done | sort) + local db=$(parse_db $2) table=$(parse_table $2) column=${3-_uuid}; shift; shift; shift + local a=$1 b=$2 c=$3 + + echo + echo "Waiting until $column in $db $table${1+ with $*} is $expected..." + OVS_WAIT_UNTIL([ + found=$(ovn-${db}ctl --bare --columns $column find $table $a $b $c) + found=$(for d in $found; do echo $d; done | sort) + test "$expected" = "$found" + ], [ + echo "$column in $db table $table has value $found, from the following rows:" + ovn-${db}ctl list $table]) +} +OVS_END_SHELL_HELPERS + m4_define([OVN_POPULATE_ARP], [AT_CHECK(ovn_populate_arp__, [0], [ignore])]) diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at index 3dbedc843b7c..79d580d3f454 100644 --- a/tests/ovn-nbctl.at +++ b/tests/ovn-nbctl.at @@ -536,18 +536,12 @@ snat 30.0.0.1 192.168.1.0/24 snat fd01::1 fd11::/64 ]) -AT_CHECK([ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l], [0], -[0 -]) +check_row_count nb:NAT 0 options:stateless=true AT_CHECK([ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat 40.0.0.2 192.168.1.4]) -AT_CHECK([ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l], [0], -[1 -]) +check_row_count nb:NAT 1 options:stateless=true AT_CHECK([ovn-nbctl --stateless lr-nat-add lr0 dnat_and_snat fd21::1 fd11::2]) -AT_CHECK([ovn-nbctl --bare --columns=options list nat | grep stateless=true| wc -l], [0], -[2 -]) +check_row_count nb:NAT 2 options:stateless=true AT_CHECK([ovn-nbctl lr-nat-del lr0 dnat_and_snat fd21::1]) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 946f20b6a176..869bcd6f6cba 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -22,130 +22,47 @@ nb_gwc1_uuid=`ovn-nbctl --bare --columns _uuid find Gateway_Chassis name="alice_ # With the new ha_chassis_group table added, there should be no rows in # gateway_chassis table in SB DB. -AT_CHECK([ovn-sbctl list gateway_chassis | wc -l], [0], [0 -]) - -# There should be one ha_chassis_group with the name "alice" -ha_chassi_grp_name=`ovn-sbctl --bare --columns name find \ -ha_chassis_group name="alice"` - -AT_CHECK([test $ha_chassi_grp_name = alice]) - -ha_chgrp_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group name=alice` - -AT_CHECK([ovn-sbctl --bare --columns ha_chassis_group find port_binding \ -logical_port="cr-alice" | grep $ha_chgrp_uuid | wc -l], [0], [1 -]) +check_row_count Gateway_Chassis 0 # There should be one ha_chassis_group with the name "alice" -ha_chassi_grp_name=`ovn-sbctl --bare --columns name find \ -ha_chassis_group name="alice"` - -AT_CHECK([test $ha_chassi_grp_name = alice]) - -ha_chgrp_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group name=alice` - -AT_CHECK([ovn-sbctl --bare --columns ha_chassis_group find port_binding \ -logical_port="cr-alice" | grep $ha_chgrp_uuid | wc -l], [0], [1 -]) - -ha_ch=`ovn-sbctl --bare --columns ha_chassis find ha_chassis_group` -# Trim the spaces. -ha_ch=`echo $ha_ch | sed 's/ //g'` +check_row_count HA_Chassis_Group 1 name=alice +ha_chgrp_uuid=$(fetch_column HA_Chassis_Group _uuid name=alice) +check_row_count Port_Binding 1 logical_port=cr-alice ha_chassis_group=$ha_chgrp_uuid -ha_ch_list='' -for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort` -do - ha_ch_list="$ha_ch_list $i" -done - -# Trim the spaces. -ha_ch_list=`echo $ha_ch_list | sed 's/ //g'` - -AT_CHECK([test "$ha_ch_list" = "$ha_ch"]) +ha_ch=$(fetch_column HA_Chassis_Group ha_chassis name=alice) +check_column "$ha_ch" HA_Chassis _uuid # Delete chassis - gw2 in SB DB. # ovn-northd should not recreate ha_chassis rows # repeatedly when gw2 is deleted. ovn-sbctl chassis-del gw2 -ha_ch_list_1='' -for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort` -do - ha_ch_list_1="$ha_ch_list_1 $i" -done - -# Trim the spaces. -ha_ch_list_1=`echo $ha_ch_list_1 | sed 's/ //g'` - -ha_ch_list_2='' -for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort` -do - ha_ch_list_2="$ha_ch_list_2 $i" -done - -# Trim the spaces. -ha_ch_list_2=`echo $ha_ch_list_2 | sed 's/ //g'` - -AT_CHECK([test "$ha_ch_list_1" = "$ha_ch_list_2"]) +ha_ch_list=$(fetch_column HA_Chassis _uuid) +check_column "$ha_ch_list" HA_Chassis _uuid # Add back the gw2 chassis ovn-sbctl chassis-add gw2 geneve 1.2.4.8 # delete the 2nd Gateway_Chassis on NBDB for alice port -gw_ch=`ovn-sbctl --bare --columns gateway_chassis find port_binding \ -logical_port="cr-alice"` -AT_CHECK([test "$gw_ch" = ""]) +check_column '' Port_Binding gateway_chassis logical_port=cr-alice -ha_ch=`ovn-sbctl --bare --columns ha_chassis find ha_chassis_group` -ha_ch=`echo $ha_ch | sed 's/ //g'` -# Trim the spaces. -echo "ha ch in grp = $ha_ch" - -ha_ch_list='' -for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort` -do - ha_ch_list="$ha_ch_list $i" -done - -# Trim the spaces. -ha_ch_list=`echo $ha_ch_list | sed 's/ //g'` - -AT_CHECK([test "$ha_ch_list" = "$ha_ch"]) +ha_ch=$(fetch_column HA_Chassis_Group ha_chassis) +check_column "$ha_ch" HA_Chassis _uuid # delete the 2nd Gateway_Chassis on NBDB for alice port ovn-nbctl --wait=sb set Logical_Router_Port alice gateway_chassis=${nb_gwc1_uuid} # There should be only 1 row in ha_chassis SB DB table. -AT_CHECK([ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l], [0], [1 -]) - -AT_CHECK([ovn-sbctl list gateway_chassis | wc -l], [0], [0 -]) - -# There should be only 1 row in ha_chassis SB DB table. -AT_CHECK([ovn-sbctl --bare --columns _uuid list ha_chassis | wc -l], [0], [1 -]) +check_row_count HA_Chassis 1 +check_row_count Gateway_Chassis 0 # delete all the gateway_chassis on NBDB for alice port - ovn-nbctl --wait=sb clear Logical_Router_Port alice gateway_chassis # expect that the ha_chassis doesn't exist anymore -AT_CHECK([ovn-sbctl list gateway_chassis | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl list ha_chassis | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl list ha_chassis_group | wc -l], [0], [0 -]) - -# expect that the ha_chassis doesn't exist anymore -AT_CHECK([ovn-sbctl list ha_chassis | wc -l], [0], [0 -]) -AT_CHECK([ovn-sbctl list ha_chassis_group | wc -l], [0], [0 -]) +check_row_count HA_Chassis 0 +check_row_count Gateway_Chassis 0 +check_row_count Ha_Chassis_Group 0 AT_CLEANUP @@ -154,11 +71,11 @@ ovn_start ovn-nbctl ls-add S1 ovn-nbctl --wait=sb lsp-add S1 S1-vm1 -AT_CHECK([test x`ovn-nbctl lsp-get-up S1-vm1` = xdown]) +wait_row_count nb:Logical_Switch_Port 1 name=S1-vm1 'up!=true' ovn-sbctl chassis-add hv1 geneve 127.0.0.1 ovn-sbctl lsp-bind S1-vm1 hv1 -AT_CHECK([test x`ovn-nbctl lsp-get-up S1-vm1` = xup]) +wait_row_count nb:Logical_Switch_Port 1 name=S1-vm1 'up=true' AT_CLEANUP @@ -334,8 +251,7 @@ as northd start_daemon ovn-northd --unixctl="$ovs_base"/northd/ovn-northd.ctl -- ovn-nbctl ls-add sw ovn-nbctl --wait=sb lsp-add sw p1 # northd created with unixctl option successfully created port_binding entry -AT_CHECK([ovn-sbctl --bare --columns datapath find port_binding logical_port="p1" | wc -l], [0], [1 -]) +check_row_count Port_Binding 1 logical_port=p1 AT_CHECK([ovn-nbctl --wait=sb lsp-del p1]) # ovs-appctl exit with unixctl option @@ -344,15 +260,13 @@ OVS_APP_EXIT_AND_WAIT_BY_TARGET(["$ovs_base"/northd/ovn-northd.ctl], ["$ovs_base # Check no port_binding entry for new port as ovn-northd is not running ovn-nbctl lsp-add sw p2 ovn-nbctl --timeout=10 --wait=sb sync -AT_CHECK([ovn-sbctl --bare --columns datapath find port_binding logical_port="p2" | wc -l], [0], [0 -]) +check_row_count Port_Binding 0 logical_port=p2 # test default unixctl path as northd start_daemon ovn-northd --ovnnb-db=unix:"$ovs_base"/ovn-nb/ovn-nb.sock --ovnsb-db=unix:"$ovs_base"/ovn-sb/ovn-sb.sock ovn-nbctl --wait=sb lsp-add sw p3 # northd created with default unixctl path successfully created port_binding entry -AT_CHECK([ovn-sbctl --bare --columns datapath find port_binding logical_port="p3" | wc -l], [0], [1 -]) +check_row_count Port_Binding 1 logical_port=p3 as ovn-sb OVS_APP_EXIT_AND_WAIT([ovsdb-server]) @@ -371,28 +285,22 @@ ovn-nbctl --wait=sb ha-chassis-group-add hagrp1 # ovn-northd should not create HA chassis group and HA chassis rows # unless the HA chassis group in OVN NB DB is associated to # a logical router port or logical port of type external. -AT_CHECK([ovn-sbctl --bare --columns name find ha_chassis_group name="hagrp1" \ -| wc -l], [0], [0 -]) +check_row_count HA_Chassis_Group 0 name=hagrp1 ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30 ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20 ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10 # There should be no HA_Chassis rows in SB DB. -AT_CHECK([ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \ -| grep -v '-' | wc -l ], [0], [0 -]) +check_row_count HA_Chassis 0 # Add chassis ch1. ovn-sbctl chassis-add ch1 geneve 127.0.0.2 -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl list chassis | grep ch1 | wc -l`]) +wait_row_count Chassis 1 name=ch1 # There should be no HA_Chassis rows -AT_CHECK([ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \ -| grep -v '-' | wc -l ], [0], [0 -]) +check_row_count HA_Chassis 0 # Create a logical router port and attach ha chassis group. ovn-nbctl lr-add lr0 @@ -401,44 +309,21 @@ ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1` ovn-nbctl set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) +wait_row_count HA_Chassis_Group 1 name=hagrp1 -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +check_row_count HA_Chassis 3 # Make sure that ovn-northd doesn't recreate the ha_chassis # records if the chassis record is missing in SB DB. - -ha_ch_list_1='' -for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort` -do - ha_ch_list_1="$ha_ch_list_1 $i" -done - -# Trim the spaces. -ha_ch_list_1=`echo $ha_ch_list_1 | sed 's/ //g'` - -ha_ch_list_2='' -for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort` -do - ha_ch_list_2="$ha_ch_list_2 $i" -done - -# Trim the spaces. -ha_ch_list_2=`echo $ha_ch_list_2 | sed 's/ //g'` - -AT_CHECK([test "$ha_ch_list_1" = "$ha_ch_list_2"]) +ha_ch_list=$(fetch_column HA_Chassis _uuid) +check_column "$ha_ch_list" HA_Chassis _uuid # 2 HA chassis should be created with 'chassis' column empty because # we have not added hv1 and hv2 chassis to the SB DB. -AT_CHECK([test 2 = `ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \ -| grep -v '-' | wc -l`]) +check_row_count HA_Chassis 2 'chassis=[[]]' # We should have 1 ha chassis with 'chassis' column set for hv1 -AT_CHECK([test 1 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | awk '{print $3}' \ -| grep '-' | wc -l`]) +check_row_count HA_Chassis 1 'chassis!=[[]]' # Create another logical router port and associate to the same ha_chasis_group ovn-nbctl lr-add lr1 @@ -447,94 +332,68 @@ ovn-nbctl lrp-add lr1 lr1-public 00:00:20:20:12:14 182.168.0.100/24 ovn-nbctl set logical_router_port lr1-public ha_chassis_group=$hagrp1_uuid # We should still have 1 HA chassis group and 3 HA chassis in SB DB. -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis_Group 1 name=hagrp1 +check_row_count HA_Chassis 3 # Change the priority of ch1 - ha chassis in NB DB. It should get # reflected in SB DB. ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 100 -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns priority find \ -ha_chassis | grep 100 | wc -l`]) +wait_row_count HA_Chassis 1 priority=100 # Delete ch1 HA chassis in NB DB. ovn-nbctl --wait=sb ha-chassis-group-remove-chassis hagrp1 ch1 -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis 2 # Add back the ha chassis ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 40 -OVS_WAIT_UNTIL([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis 3 # Delete lr0-public. We should still have 1 HA chassis group and # 3 HA chassis in SB DB. ovn-nbctl --wait=sb lrp-del lr0-public -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis_Group 1 name=hagrp1 +wait_row_count HA_Chassis 3 # Delete lr1-public. There should be no HA chassis group in SB DB. ovn-nbctl --wait=sb lrp-del lr1-public -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 0 = `ovn-sbctl list ha_chassis | grep chassis | wc -l`]) +wait_row_count HA_Chassis_Group 0 name=hagrp1 +wait_row_count HA_Chassis 0 # Add lr0-public again ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 ovn-nbctl set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis_Group 1 name=hagrp1 +wait_row_count HA_Chassis 3 # Create a Gateway chassis. ovn-northd should ignore this. ovn-nbctl lrp-set-gateway-chassis lr0-public ch-1 20 # There should be only 1 HA chassis group in SB DB with the # name hagrp1. -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group | wc -l`]) - -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis_Group 1 +wait_row_count HA_Chassis_Group 1 name=hagrp1 +wait_row_count HA_Chassis 3 # Now delete HA chassis group. ovn-northd should create HA chassis group # with the Gateway chassis name ovn-nbctl clear logical_router_port lr0-public ha_chassis_group ovn-nbctl ha-chassis-group-del hagrp1 -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="lr0-public" | wc -l`]) - -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns _uuid \ -find ha_chassis | wc -l`]) +wait_row_count HA_Chassis_Group 0 name=hagrp1 +wait_row_count HA_Chassis_Group 1 name=lr0-public +wait_row_count HA_Chassis 1 ovn-nbctl lrp-set-gateway-chassis lr0-public ch2 10 -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="lr0-public" | wc -l`]) +wait_row_count HA_Chassis_Group 1 name=lr0-public ovn-sbctl --bare --columns _uuid find ha_chassis -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis 2 # Test if 'ref_chassis' column is properly set or not in # SB DB ha_chassis_group. @@ -553,35 +412,23 @@ ovn-nbctl lsp-set-addresses sw0-lr0 router ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 ovn-sbctl lsp-bind sw0-p1 comp1 -OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw0-p1` = xup]) +wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=true -comp1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="comp1"` -comp2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="comp2"` -ch2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="comp1"` +comp1_ch_uuid=$(fetch_column Chassis _uuid name=comp1) +comp2_ch_uuid=$(fetch_column Chassis _uuid name=comp2) +ch2_ch_uuid=$comp1_ch_uuid echo "comp1_ch_uuid = $comp1_ch_uuid" -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$comp1_ch_uuid" = "$ref_ch_list"]) +wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis # unbind sw0-p1 ovn-sbctl lsp-unbind sw0-p1 -OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw0-p1` = xdown]) -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "" = "$ref_ch_list"]) +wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=false +wait_column "" HA_Chassis_Group ref_chassis # Bind sw0-p1 in comp2 ovn-sbctl lsp-bind sw0-p1 comp2 -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$comp2_ch_uuid" = "$ref_ch_list"]) +wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis ovn-nbctl ls-add sw1 ovn-nbctl lsp-add sw1 sw1-p1 @@ -595,14 +442,10 @@ ovn-nbctl lsp-set-options sw1-lr1 router-port=lr1-sw1 # Bind sw1-p1 in comp1. ovn-sbctl lsp-bind sw1-p1 comp1 # Wait until sw1-p1 is up -OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw1-p1` = xup]) +wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=true # sw1-p1 is not connected to lr0. So comp1 should not be in 'ref_chassis' -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$comp2_ch_uuid" = "$ref_ch_list"]) +wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Now attach sw0 to lr1 ovn-nbctl lrp-add lr1 lr1-sw0 00:00:20:20:12:16 10.0.0.10/24 @@ -613,30 +456,14 @@ ovn-nbctl lsp-set-options sw0-lr1 router-port=lr1-sw0 # Both comp1 and comp2 should be in 'ref_chassis' as sw1 is indirectly # connected to lr0 -exp_ref_ch_list='' -for i in `ovn-sbctl --bare --columns _uuid list chassis | sort` -do - if test $i = $comp1_ch_uuid; then - exp_ref_ch_list="${exp_ref_ch_list}$i" - elif test $i = $comp2_ch_uuid; then - exp_ref_ch_list="${exp_ref_ch_list}$i" - fi -done - -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$exp_ref_ch_list" = "$ref_ch_list"]) +exp_ref_ch_list="$comp1_ch_uuid $comp2_ch_uuid" + +wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # Unind sw1-p1. comp2 should not be in the ref_chassis. ovn-sbctl lsp-unbind sw1-p1 -OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw1-p1` = xdown]) -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$comp2_ch_uuid" = "$ref_ch_list"]) +wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=false +wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Create sw2 and attach it to lr2 ovn-nbctl ls-add sw2 @@ -651,14 +478,10 @@ ovn-nbctl lsp-set-options sw2-lr2 router-port=lr2-sw2 # Bind sw2-p1 to comp1 ovn-sbctl lsp-bind sw2-p1 comp1 # Wait until sw2-p1 is up -OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw2-p1` = xup]) +wait_row_count nb:Logical_Switch_Port 1 name=sw2-p1 up=true # sw2-p1 is not connected to lr0. So comp1 should not be in 'ref_chassis' -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$comp2_ch_uuid" = "$ref_ch_list"]) +wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Now attach sw1 to lr2. With this sw2-p1 is indirectly connected to lr0. ovn-nbctl lrp-add lr2 lr2-sw1 00:00:20:20:12:18 20.0.0.10/24 @@ -669,60 +492,39 @@ ovn-nbctl lsp-set-options sw1-lr2 router-port=lr2-sw1 # sw2-p1 is indirectly connected to lr0. So comp1 (and comp2) should be in # 'ref_chassis' -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$exp_ref_ch_list" = "$ref_ch_list"]) +wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # Create sw0-p2 and bind it to comp1 ovn-nbctl lsp-add sw0 sw0-p2 ovn-sbctl lsp-bind sw0-p2 comp1 -OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw0-p2` = xup]) -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$exp_ref_ch_list" = "$ref_ch_list"]) +wait_row_count nb:Logical_Switch_Port 1 name=sw0-p2 up=true +wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # unbind sw0-p2 ovn-sbctl lsp-unbind sw0-p2 -OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up sw0-p2` = xdown]) -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$exp_ref_ch_list" = "$ref_ch_list"]) +wait_row_count nb:Logical_Switch_Port 1 name=sw0-p2 up=false +wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # Delete lr1-sw0. comp1 should be deleted from ref_chassis as there is no link # from sw1 and sw2 to lr0. ovn-nbctl lrp-del lr1-sw0 -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$comp2_ch_uuid" = "$ref_ch_list"]) +wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Set redirect-chassis option to lr0-public. It should be ignored # (because redirect-chassis is obsolete). ovn-nbctl set logical_router_port lr0-public options:redirect-chassis=ch1 -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group | wc -l`]) - -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="lr0-public" | wc -l`]) +wait_row_count HA_Chassis_Group 1 +wait_row_count HA_Chassis_Group 1 name=lr0-public -ovn-sbctl --bare --columns _uuid find ha_chassis -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis 2 # Delete the gateway chassis. ovn-nbctl clear logical_router_port lr0-public gateway_chassis -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list ha_chassis_group | wc -l`]) -AT_CHECK([test 0 = `ovn-sbctl list ha_chassis | wc -l`]) +wait_row_count HA_Chassis_Group 0 +check_row_count HA_Chassis 0 # Delete old sw0. ovn-nbctl ls-del sw0 @@ -746,8 +548,8 @@ ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10 # ovn-northd should not create HA chassis group and HA chassis rows # unless the HA chassis group in OVN NB DB is associated to # a logical router port or logical port of type external. -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list ha_chassis_group | wc -l`]) -AT_CHECK([test 0 = `ovn-sbctl list ha_chassis | wc -l`]) +wait_row_count HA_Chassis_Group 0 +check_row_count HA_Chassis 0 hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group \ name=hagrp1` @@ -756,69 +558,50 @@ name=hagrp1` # So ha_chassis_group should be ignored. ovn-nbctl set logical_switch_port sw0-pext1 ha_chassis_group=$hagrp1_uuid -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 0 = `ovn-sbctl list ha_chassis | grep chassis | wc -l`]) +wait_row_count HA_Chassis_Group 0 name=hagrp1 +check_row_count HA_Chassis 0 # Set the type of sw0-pext1 to external ovn-nbctl lsp-set-type sw0-pext1 external -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis_Group 1 name=hagrp1 +check_row_count HA_Chassis 3 sb_hagrp1_uuid=`ovn-sbctl --bare --columns _uuid find ha_chassis_group \ name=hagrp1` -AT_CHECK([test "$sb_hagrp1_uuid" = `ovn-sbctl --bare --columns \ -ha_chassis_group find port_binding logical_port=sw0-pext1`]) +check_row_count Port_Binding 1 logical_port=sw0-pext1 ha_chassis_group=$sb_hagrp1_uuid # Set the type of sw0-pext2 to external and associate ha_chassis_group ovn-nbctl lsp-set-type sw0-pext2 external ovn-nbctl set logical_switch_port sw0-pext2 ha_chassis_group=$hagrp1_uuid -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) - -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | -grep -v chassis-name | wc -l`]) -AT_CHECK([test "$sb_hagrp1_uuid" = `ovn-sbctl --bare --columns \ -ha_chassis_group find port_binding logical_port=sw0-pext1`]) - -OVS_WAIT_UNTIL([test "$sb_hagrp1_uuid" = `ovn-sbctl --bare --columns \ -ha_chassis_group find port_binding logical_port=sw0-pext2`]) +wait_row_count HA_Chassis_Group 1 name=hagrp1 +check_row_count HA_Chassis 3 +check_row_count Port_Binding 1 logical_port=sw0-pext1 ha_chassis_group=$sb_hagrp1_uuid +wait_row_count Port_Binding 1 logical_port=sw0-pext2 ha_chassis_group=$sb_hagrp1_uuid # sw0-p1 is a normal port. So ha_chassis_group should not be set # in port_binding. ovn-nbctl --wait=sb set logical_switch_port sw0-p1 \ ha_chassis_group=$hagrp1_uuid -OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \ -logical_port=sw0-p1) = x], [0], []) +wait_row_count Port_Binding 0 logical_port=sw0-p1 'chassis!=[[]]' # Clear ha_chassis_group for sw0-pext1 ovn-nbctl --wait=sb clear logical_switch_port sw0-pext1 ha_chassis_group -OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \ -logical_port=sw0-pext1) = x], [0], []) - -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns name find \ -ha_chassis_group name="hagrp1" | wc -l`]) +wait_row_count Port_Binding 0 logical_port=sw0-pext1 'chassis!=[[]]' -AT_CHECK([test 3 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +wait_row_count HA_Chassis_Group 1 name=hagrp1 +wait_row_count HA_Chassis 3 # Clear ha_chassis_group for sw0-pext2 ovn-nbctl --wait=sb clear logical_switch_port sw0-pext2 ha_chassis_group -OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \ -logical_port=sw0-pext2) = x], [0], []) - -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list ha_chassis_group | wc -l`]) -AT_CHECK([test 0 = `ovn-sbctl list ha_chassis | wc -l`]) +wait_row_count Port_Binding 0 logical_port=sw0-pext2 'chassis!=[[]]' +wait_row_count HA_Chassis_Group 0 +check_row_count HA_Chassis 0 as ovn-sb OVS_APP_EXIT_AND_WAIT([ovsdb-server]) @@ -906,17 +689,11 @@ ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1 ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1 -uuid=`ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=cr-R1-S1` -echo "CR-LRP UUID is: " $uuid - ovn-nbctl lrp-set-redirect-type R1-S1 bridged -OVS_WAIT_UNTIL([ovn-sbctl get Port_Binding ${uuid} options:redirect-type], [0], [bridged -]) +wait_row_count Port_Binding 1 logical_port=cr-R1-S1 options:redirect-type=bridged ovn-nbctl lrp-set-redirect-type R1-S1 overlay -OVS_WAIT_UNTIL([ovn-sbctl get Port_Binding ${uuid} options:redirect-type], [0], [overlay -]) - +wait_row_count Port_Binding 1 logical_port=cr-R1-S1 options:redirect-type=overlay AT_CLEANUP AT_SETUP([ovn -- check stateless dnat_and_snat rule]) @@ -935,9 +712,6 @@ ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1 ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1 -uuid=`ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=cr-R1-S1` -echo "CR-LRP UUID is: " $uuid - # IPV4 ovn-nbctl lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 @@ -1296,37 +1070,32 @@ ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1 ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1 -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list service_monitor | wc -l`]) +wait_row_count Service_Monitor 0 ovn-nbctl --wait=sb -- --id=@hc create \ Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \ health_check @hc -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list service_monitor | wc -l`]) +wait_row_count Service_Monitor 0 # create logical switches and ports ovn-nbctl ls-add sw0 ovn-nbctl --wait=sb lsp-add sw0 sw0-p1 -- lsp-set-addresses sw0-p1 \ "00:00:00:00:00:03 10.0.0.3" -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | wc -l`]) +wait_row_count Service_Monitor 0 ovn-nbctl ls-add sw1 ovn-nbctl --wait=sb lsp-add sw1 sw1-p1 -- lsp-set-addresses sw1-p1 \ "02:00:00:00:00:03 20.0.0.3" -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l`]) +wait_row_count Service_Monitor 0 ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2 -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | wc -l`]) +wait_row_count Service_Monitor 1 ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2 - -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l`]) +wait_row_count Service_Monitor 2 ovn-nbctl --wait=sb ls-lb-add sw0 lb1 @@ -1337,7 +1106,7 @@ AT_CHECK([cat lflows.txt], [0], [dnl # Delete the Load_Balancer_Health_Check ovn-nbctl --wait=sb clear load_balancer . health_check -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list service_monitor | wc -l`]) +wait_row_count Service_Monitor 0 ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -1349,8 +1118,7 @@ ovn-nbctl --wait=sb -- --id=@hc create \ Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \ health_check @hc -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l`]) +wait_row_count Service_Monitor 2 ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -1364,9 +1132,7 @@ sm_sw1_p1=`ovn-sbctl --bare --columns _uuid find service_monitor logical_port=sw # Set the service monitor for sw1-p1 to offline ovn-sbctl set service_monitor $sm_sw1_p1 status=offline -OVS_WAIT_UNTIL([ - status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1` - test "$status" = "offline"]) +wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=offline ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -1376,9 +1142,7 @@ AT_CHECK([cat lflows.txt], [0], [dnl # Set the service monitor for sw0-p1 to offline ovn-sbctl set service_monitor $sm_sw0_p1 status=offline -OVS_WAIT_UNTIL([ - status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw0-p1` - test "$status" = "offline"]) +wait_row_count Service_Monitor 1 logical_port=sw0-p1 status=offline ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -1394,9 +1158,7 @@ AT_CHECK([cat lflows.txt], [0], [dnl ovn-sbctl set service_monitor $sm_sw0_p1 status=online ovn-sbctl set service_monitor $sm_sw1_p1 status=online -OVS_WAIT_UNTIL([ - status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1` - test "$status" = "online"]) +wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=online ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -1405,9 +1167,7 @@ AT_CHECK([cat lflows.txt], [0], [dnl # Set the service monitor for sw1-p1 to error ovn-sbctl set service_monitor $sm_sw1_p1 status=error -OVS_WAIT_UNTIL([ - status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1` - test "$status" = "error"]) +wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=error ovn-sbctl dump-flows sw0 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" \ | grep priority=120 > lflows.txt @@ -1429,16 +1189,9 @@ health_check @hc # * 10.0.0.3:1000 # * 20.0.0.3:80 -OVS_WAIT_UNTIL([test 3 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l`]) - -# There should be 2 rows with logical_port=sw0-p1 -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor logical_port=sw0-p1 | sed '/^$/d' | wc -l`]) - -# There should be 1 row1 with port=1000 -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor port=1000 | sed '/^$/d' | wc -l`]) +wait_row_count Service_Monitor 3 +wait_row_count Service_Monitor 2 logical_port=sw0-p1 +wait_row_count Service_Monitor 1 port=1000 ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -1449,9 +1202,7 @@ AT_CHECK([cat lflows.txt], [0], [dnl # Set the service monitor for sw1-p1 to online ovn-sbctl set service_monitor $sm_sw1_p1 status=online -OVS_WAIT_UNTIL([ - status=`ovn-sbctl --bare --columns status find service_monitor logical_port=sw1-p1` - test "$status" = "online"]) +wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=online ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -1479,26 +1230,23 @@ ovn-nbctl ls-lb-add sw0 lb2 ovn-nbctl ls-lb-add sw1 lb2 ovn-nbctl lr-lb-add lr0 lb2 -OVS_WAIT_UNTIL([test 5 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l`]) +wait_row_count Service_Monitor 5 # Change the svc_monitor_mac. This should get reflected in service_monitor table rows. ovn-nbctl set NB_Global . options:svc_monitor_mac="fe:a0:65:a2:01:03" -OVS_WAIT_UNTIL([test 5 = `ovn-sbctl --bare --columns src_mac find \ -service_monitor | grep "fe:a0:65:a2:01:03" | wc -l`]) +wait_row_count Service_Monitor 5 src_mac='"fe:a0:65:a2:01:03"' # Change the source ip for 10.0.0.3 backend ip in lb2 ovn-nbctl --wait=sb set load_balancer $lb2_uuid ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.100 -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns src_ip find \ -service_monitor logical_port=sw0-p1 | grep "10.0.0.100" | wc -l`]) +wait_row_count Service_Monitor 1 logical_port=sw0-p1 src_ip=10.0.0.100 ovn-nbctl --wait=sb lb-del lb1 -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns _uuid find service_monitor | sed '/^$/d' | wc -l`]) +wait_row_count Service_Monitor 2 ovn-nbctl --wait=sb lb-del lb2 -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list service_monitor | wc -l`]) +wait_row_count Service_Monitor 0 AT_CLEANUP @@ -1594,22 +1342,14 @@ AT_CHECK([ovn-nbctl --wait=sb sync], [0]) # Ports are bound on different datapaths so it's expected that they both # get tunnel_key == 1. -AT_CHECK([test 1 = $(ovn-sbctl --bare --columns tunnel_key find \ -port_binding logical_port=lsp1)]) -AT_CHECK([test 1 = $(ovn-sbctl --bare --columns tunnel_key find \ -port_binding logical_port=lsp2)]) +check_column 1 Port_Binding tunnel_key logical_port=lsp1 +check_column 1 Port_Binding tunnel_key logical_port=lsp2 ovn-nbctl lsp-del lsp2 -- lsp-add ls1 lsp2 AT_CHECK([ovn-nbctl --wait=sb sync], [0]) -AT_CHECK([test 1 = $(ovn-sbctl --bare --columns tunnel_key find \ -port_binding logical_port=lsp1)]) -AT_CHECK([test 2 = $(ovn-sbctl --bare --columns tunnel_key find \ -port_binding logical_port=lsp2)]) - -# ovn-northd should allocate a new tunnel_key for lsp1 or lsp2 to maintain -# unique DB indices. -AT_CHECK([test ${pb1_key} != ${pb2_key}]) +check_column 1 Port_Binding tunnel_key logical_port=lsp1 +check_column 2 Port_Binding tunnel_key logical_port=lsp2 AT_CLEANUP @@ -1635,7 +1375,7 @@ AT_CHECK([ovn-nbctl --wait=sb sync], [0]) ovn-nbctl lsp-del lsp2 -- lsp-add ls1 lsp2 AT_CHECK([ovn-nbctl --wait=sb sync], [0]) -AT_CHECK([test 0 = $(ovn-sbctl list Ha_Chassis_Group | wc -l)]) +check_row_count HA_Chassis_Group 0 AT_CLEANUP @@ -1701,20 +1441,14 @@ ls2_key=$(ovn-sbctl --columns tunnel_key --bare list Datapath_Binding ls2) # Add lsp1 & lsp2 to a port group. This should generate two entries in the # SB (one per logical switch). ovn-nbctl --wait=sb pg-add pg_test lsp1 lsp2 -AT_CHECK([test 2 = $(ovn-sbctl --columns _uuid list Port_Group | grep uuid -c)]) -AT_CHECK([ovn-sbctl --columns ports --bare find Port_Group name=${ls1_key}_pg_test], [0], [dnl -lsp1 -]) -AT_CHECK([ovn-sbctl --columns ports --bare find Port_Group name=${ls2_key}_pg_test], [0], [dnl -lsp2 -]) +wait_row_count Port_Group 2 +check_row_count Port_Group 1 name=${ls1_key}_pg_test +check_row_count Port_Group 1 name=${ls2_key}_pg_test # Delete logical switch ls1. This should remove the associated SB Port_Group. ovn-nbctl --wait=sb ls-del ls1 -AT_CHECK([test 1 = $(ovn-sbctl --columns _uuid list Port_Group | grep uuid -c)]) -AT_CHECK([ovn-sbctl --columns ports --bare find Port_Group name=${ls2_key}_pg_test], [0], [dnl -lsp2 -]) +wait_row_count Port_Group 1 +check_row_count Port_Group 1 name=${ls2_key}_pg_test AT_CLEANUP diff --git a/tests/ovn.at b/tests/ovn.at index 04b7a3df736b..46f13f46617b 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -2063,20 +2063,12 @@ get_lsp_uuid () { # explictly # For Chassis hv1 -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp11], [0], [dnl -encap : [[]] -]) -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp12], [0], [dnl -encap : [[]] -]) +check_row_count Port_Binding 1 logical_port=lp11 'encap=[[]]' +check_row_count Port_Binding 1 logical_port=lp12 'encap=[[]]' # For Chassis hv2 -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp21], [0], [dnl -encap : [[]] -]) -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp22], [0], [dnl -encap : [[]] -]) +check_row_count Port_Binding 1 logical_port=lp21 'encap=[[]]' +check_row_count Port_Binding 1 logical_port=lp22 'encap=[[]]' # Bind the ports to the encap-ip for i in 1 2; do @@ -2092,26 +2084,14 @@ sleep 1 # ports to be bound to geneve tunnels. # For Chassis 1 -encap_rec=`ovn-sbctl --data=bare --no-heading --column _uuid find encap chassis_name=hv1 type=geneve ip=192.168.0.1` - -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp11], [0], [dnl -encap : ${encap_rec} -]) - -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp12], [0], [dnl -encap : ${encap_rec} -]) +encap_rec=$(fetch_column Encap _uuid chassis_name=hv1 type=geneve ip=192.168.0.1) +check_row_count Port_Binding 1 logical_port=lp11 encap=$encap_rec +check_row_count Port_Binding 1 logical_port=lp12 encap=$encap_rec # For Chassis 2 -encap_rec=`ovn-sbctl --data=bare --no-heading --column _uuid find encap chassis_name=hv2 type=geneve ip=192.168.0.2` - -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp21], [0], [dnl -encap : ${encap_rec} -]) - -AT_CHECK_UNQUOTED([ovn-sbctl --column encap list port_binding lp22], [0], [dnl -encap : ${encap_rec} -]) +encap_rec=$(fetch_column Encap _uuid chassis_name=hv2 type=geneve ip=192.168.0.2) +check_row_count Port_Binding 1 logical_port=lp21 encap=$encap_rec +check_row_count Port_Binding 1 logical_port=lp22 encap=$encap_rec # Pre-populate the hypervisors' ARP tables so that we don't lose any # packets for ARP resolution (native tunneling doesn't queue packets @@ -4061,7 +4041,7 @@ ovn-nbctl --wait=hv set logical_router lr0 options:always_learn_from_arp_request test_arp 11 $sha $spa $tpa sleep 1 -AT_CHECK([ovn-sbctl find mac_binding ip="192.168.1.100"], [0], []) +check_row_count MAC_Binding 0 ip="192.168.1.100" # When always_learn_from_arp_request=true, the new mac-binding will be learned. ovn-nbctl --wait=hv set logical_router lr0 options:always_learn_from_arp_request=true @@ -4086,7 +4066,7 @@ ovn-nbctl --wait=hv set logical_router lr0 options:always_learn_from_arp_request sha=f00000000012 test_arp 12 $sha $spa $tpa -OVS_WAIT_UNTIL([ovn-sbctl find mac_binding ip="192.168.1.100" | grep f0:00:00:00:00:12]) +wait_row_count MAC_Binding 1 ip="192.168.1.100" mac='"f0:00:00:00:00:12"' ovn-nbctl --wait=hv sync # give to the hv the time to send queued ip packets sleep 1 @@ -8043,18 +8023,18 @@ ovn-nbctl lsp-add ls0 lp0 ovn-nbctl lsp-add ls0 lp1 ovn-nbctl lsp-set-addresses lp0 "f0:00:00:00:00:01 192.168.0.1" ovn-nbctl lsp-set-addresses lp1 "f0:00:00:00:00:02 192.168.0.2" -dp_uuid=`ovn-sbctl find datapath | grep uuid | cut -f2 -d ":" | cut -f2 -d " "` +dp_uuid=$(fetch_column Datapath_Binding _uuid) ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid logical_port=lp0 mac="mac1" ovn-sbctl create MAC_Binding ip=10.0.0.1 datapath=$dp_uuid logical_port=lp1 mac="mac2" ovn-sbctl find MAC_Binding # Delete port lp0 and check that its MAC_Binding is deleted. ovn-nbctl lsp-del lp0 ovn-sbctl find MAC_Binding -OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding logical_port=lp0 | wc -l` = 0]) +wait_row_count MAC_Binding 0 logical_port=lp0 # Delete logical switch ls0 and check that its MAC_Binding is deleted. ovn-nbctl ls-del ls0 ovn-sbctl find MAC_Binding -OVS_WAIT_UNTIL([test `ovn-sbctl find MAC_Binding | wc -l` = 0]) +wait_row_count MAC_Binding 0 OVN_CLEANUP([hv1]) @@ -8121,61 +8101,62 @@ AT_CHECK([ovn-nbctl lsp-add ls0 parent1]) AT_CHECK([ovn-nbctl lsp-add ls0 parent2]) AT_CHECK([ovn-nbctl ls-add ls1]) -dnl When a tag is provided, no allocation is done +AS_BOX([requested tag for parent1]) AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c0 parent1 3]) -AT_CHECK([ovn-nbctl lsp-get-tag c0], [0], [3 -]) +c0_tag=$(ovn-nbctl lsp-get-tag c0) +echo c0_tag=$c0_tag +check test "$c0_tag" = 3 dnl The same 'tag' gets created in southbound database. -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c0"], [0], [3 -]) +check_row_count Port_Binding 1 logical_port=c0 tag=$c0_tag -dnl Allocate tags and see it getting created in both NB and SB +AS_BOX([tag allocation 1 for parent1]) AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c1 parent1 0]) -AT_CHECK([ovn-nbctl lsp-get-tag c1], [0], [1 -]) -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c1"], [0], [1 -]) +c1_tag=$(ovn-nbctl lsp-get-tag c1) +echo c1_tag=$c1_tag +check test "$c1_tag" != "$c0_tag" +check_row_count Port_Binding 1 logical_port=c1 tag=$c1_tag +AS_BOX([tag allocation 2 for parent1]) AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c2 parent1 0]) -AT_CHECK([ovn-nbctl lsp-get-tag c2], [0], [2 -]) -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c2"], [0], [2 -]) -AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c3 parent1 0]) -AT_CHECK([ovn-nbctl lsp-get-tag c3], [0], [4 -]) -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c3"], [0], [4 -]) +c2_tag=$(ovn-nbctl lsp-get-tag c2) +echo c2_tag=$c2_tag +check test "$c2_tag" != "$c0_tag" +check test "$c2_tag" != "$c1_tag" +check_row_count Port_Binding 1 logical_port=c2 tag=$c2_tag -dnl A different parent. +AS_BOX([tag allocation 3 for parent1]) +AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c3 parent1 0]) +c3_tag=$(ovn-nbctl lsp-get-tag c3) +echo c3_tag=$c3_tag +check test "$c3_tag" != "$c0_tag" +check test "$c3_tag" != "$c1_tag" +check test "$c3_tag" != "$c2_tag" +check_row_count Port_Binding 1 logical_port=c3 tag=$c3_tag + +AS_BOX([tag allocation 1 for parent2]) AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c4 parent2 0]) -AT_CHECK([ovn-nbctl lsp-get-tag c4], [0], [1 -]) -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c4"], [0], [1 -]) +c4_tag=$(ovn-nbctl lsp-get-tag c4) +echo c4_tag=$c4_tag +check_row_count Port_Binding 1 logical_port=c4 tag=$c4_tag +AS_BOX([tag allocation 2 for parent2]) AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c5 parent2 0]) -AT_CHECK([ovn-nbctl lsp-get-tag c5], [0], [2 -]) -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c5"], [0], [2 -]) +c5_tag=$(ovn-nbctl lsp-get-tag c5) +echo c5_tag=$c5_tag +check test "$c5_tag" != "$c4_tag" +check_row_count Port_Binding 1 logical_port=c5 tag=$c5_tag -dnl Delete a logical port and create a new one. +AS_BOX([delete and add tag allocation for parent1]) AT_CHECK([ovn-nbctl --wait=sb lsp-del c1]) AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c6 parent1 0]) -AT_CHECK([ovn-nbctl lsp-get-tag c6], [0], [1 -]) -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c6"], [0], [1 -]) - -dnl Restart northd to see that the same allocation remains. +c6_tag=$(ovn-nbctl lsp-get-tag c6) +echo c6_tag=$c6_tag +check_row_count Port_Binding 1 logical_port=c6 tag=$c6_tag +check test "$c6_tag" != "$c0_tag" +check test "$c6_tag" != "$c2_tag" +check test "$c6_tag" != "$c3_tag" + +AS_BOX([restart northd and make sure tag allocation is stable]) as northd OVS_APP_EXIT_AND_WAIT([ovn-northd]) start_daemon ovn-northd \ @@ -8184,30 +8165,30 @@ start_daemon ovn-northd \ dnl Create a switch to make sure that ovn-northd has run through the main loop. AT_CHECK([ovn-nbctl --wait=sb ls-add ls-dummy]) -AT_CHECK([ovn-nbctl lsp-get-tag c0], [0], [3 -]) -AT_CHECK([ovn-nbctl lsp-get-tag c6], [0], [1 -]) -AT_CHECK([ovn-nbctl lsp-get-tag c2], [0], [2 -]) -AT_CHECK([ovn-nbctl lsp-get-tag c3], [0], [4 -]) -AT_CHECK([ovn-nbctl lsp-get-tag c4], [0], [1 -]) -AT_CHECK([ovn-nbctl lsp-get-tag c5], [0], [2 + +AT_CHECK_UNQUOTED([ + for lsp in c0 c2 c3 c4 c5 c6; do + ovn-nbctl lsp-get-tag $lsp + done], [0], +[$c0_tag +$c2_tag +$c3_tag +$c4_tag +$c5_tag +$c6_tag ]) dnl Create a switch port with a tag that has already been allocated. dnl It should go through fine with a duplicate tag. -AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c7 parent2 2]) +AS_BOX([request duplicate tag]) +AT_CHECK([ovn-nbctl --wait=sb lsp-add ls1 c7 parent2 $c5_tag]) AT_CHECK([ovn-nbctl lsp-get-tag c7], [0], [2 ]) -AT_CHECK([ovn-sbctl --data=bare --no-heading --columns=tag find port_binding \ -logical_port="c7"], [0], [2 -]) -AT_CHECK([ovn-nbctl lsp-get-tag c5], [0], [2 -]) +check_row_count Port_Binding 1 logical_port=c7 tag=$c5_tag +check_row_count Port_Binding 1 logical_port=c5 tag=$c5_tag +check_row_count Port_Binding 2 parent_port=parent2 tag=$c5_tag +AS_BOX([tag_request without parent_name]) AT_CHECK([ovn-nbctl ls-add ls2]) dnl When there is no parent_name provided (for say, 'localnet'), 'tag_request' dnl gets copied to 'tag' @@ -8614,8 +8595,7 @@ check_tos 0 # Mark DSCP with a valid value qos_id=$(ovn-nbctl --wait=hv -- --id=@lp1-qos create QoS priority=100 action=dscp=48 match="inport\=\=\"lp1\"\ &&\ is_chassis_resident(\"lp1\")" direction="from-lport" -- set Logical_Switch lsw0 qos_rules=@lp1-qos) -AT_CHECK([as hv ovn-nbctl qos-list lsw0 | wc -l], [0], [1 -]) +as hv check_row_count nb:QoS 1 check_tos 48 # check at hv without qos meter @@ -8649,8 +8629,7 @@ check_tos 63 # Disable DSCP marking ovn-nbctl --wait=hv qos-del lsw0 -AT_CHECK([as hv ovn-nbctl qos-list lsw0 | wc -l], [0], [0 -]) +as hv check_row_count nb:QoS 0 check_tos 0 # check at hv without qos meter @@ -8659,8 +8638,7 @@ AT_CHECK([as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l], # check meter with chassis not resident ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp3" && is_chassis_resident("lp3")' rate=11123 burst=111230 -AT_CHECK([as hv ovn-nbctl qos-list lsw0 | wc -l], [0], [1 -]) +as hv check_row_count nb:QoS 1 # check no meter table AT_CHECK([as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l], [0], [0 @@ -10129,12 +10107,8 @@ AT_CHECK([ovn-nbctl --timeout=3 --wait=sb sync], [0], [ignore]) # hv1 should be in 'ref_chassis' of the ha_chasssi_group as logical # switch 'foo' can reach the router 'R1' (which has gw router port) # via foo1 -> foo -> R0 -> join -> R1 -hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"` -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$hv1_ch_uuid" = "$ref_ch_list"]) +hv1_ch_uuid=$(fetch_column Chassis _uuid name=hv1) +wait_column "$hv1_ch_uuid" HA_Chassis_Group ref_chassis # Allow some time for ovn-northd and ovn-controller to catch up. # XXX This should be more systematic. @@ -10547,13 +10521,11 @@ expected=${dst_mac}${src_mac}08004500001c000000003f110100${src_ip}${dst_ip}00351 echo $expected >> hv2-vif1.expected OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [hv2-vif1.expected]) -AT_CHECK([ovn-sbctl --bare --columns _uuid find Port_Binding logical_port=cr-alice | wc -l], [0], [1 -]) +check_row_count Port_Binding 1 logical_port=cr-alice ovn-nbctl --timeout=3 --wait=sb lrp-del-gateway-chassis alice hv2 -AT_CHECK([ovn-sbctl find Port_Binding logical_port=cr-alice | wc -l], [0], [0 -]) +check_row_count Port_Binding 0 logical_port=cr-alice OVN_CLEANUP([hv1],[hv2],[hv3]) @@ -10995,11 +10967,9 @@ as hv4 reset_pcap_file br-ex_n2 hv4/br-ex_n2 ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 hv4 40 # Wait till cr-alice is claimed by hv4 -hv4_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=hv4) +hv4_chassis=$(fetch_column Chassis _uuid name=hv4) # check that the chassis redirect port has been claimed by the gw1 chassis -OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \ -logical_port=cr-alice | grep $hv4_chassis | wc -l], [0],[[1 -]]) +wait_row_count Port_Binding 1 logical_port=cr-alice chassis=$hv4_chassis # Reset the pcap file for hv2/br-ex_n2. From now on ovn-controller in hv2 # should not send GARPs for the router ports. @@ -11352,7 +11322,7 @@ packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}${dst_ip}0035111 # Send the first packet to trigger a ARP response and population of # mac_bindings table. as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet -OVS_WAIT_UNTIL([test `ovn-sbctl find mac_binding ip="10.0.0.2" | wc -l` -gt 0]) +wait_row_count MAC_Binding 1 ip="10.0.0.2" ovn-nbctl --wait=hv sync # Packet to Expect at 'alice1' @@ -11583,31 +11553,13 @@ ovn-sbctl find Port_Binding type=chassisredirect echo "-------------------------------------------" # There should be one ha_chassis_group with the name "outside" -ha_chassi_grp_name=`ovn-sbctl --bare --columns name find \ -ha_chassis_group name="outside"` - -AT_CHECK([test $ha_chassi_grp_name = outside]) +check_row_count HA_Chassis_Group 1 name=outside # There should be 2 ha_chassis rows in SB DB. -AT_CHECK([ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | awk '{print $3}' \ -| grep '-' | wc -l ], [0], [2 -]) - -ha_ch=`ovn-sbctl --bare --columns ha_chassis find ha_chassis_group` -# Trim the spaces. -ha_ch=`echo $ha_ch | sed 's/ //g'` +check_row_count HA_Chassis 2 'chassis!=[[]]' -ha_ch_list='' -for i in `ovn-sbctl --bare --columns _uuid list ha_chassis | sort` -do - ha_ch_list="$ha_ch_list $i" -done - -# Trim the spaces. -ha_ch_list=`echo $ha_ch_list | sed 's/ //g'` - -AT_CHECK([test "$ha_ch_list" = "$ha_ch"]) +ha_ch=$(fetch_column HA_Chassis_Group ha_chassis) +check_column "$ha_ch" HA_Chassis _uuid for chassis in gw1 gw2 hv1 hv2; do as $chassis @@ -11650,8 +11602,8 @@ as hv1 ovs-ofctl dump-flows br-int table=32 echo "--- hv2 ---" as hv2 ovs-ofctl dump-flows br-int table=32 -gw1_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw1) -gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2) +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=32 | \ grep active_backup | grep slaves:$hv1_gw1_ofport,$hv1_gw2_ofport \ @@ -11679,29 +11631,12 @@ OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=9 | grep arp_tpa=192.16 ]]) # check that the chassis redirect port has been claimed by the gw1 chassis -OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \ -logical_port=cr-outside | grep $gw1_chassis | wc -l], [0],[[1 -]]) - -hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"` -hv2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv2"` - -exp_ref_ch_list='' -for i in `ovn-sbctl --bare --columns _uuid list chassis | sort` -do - if test $i = $hv1_ch_uuid; then - exp_ref_ch_list="${exp_ref_ch_list}$i" - elif test $i = $hv2_ch_uuid; then - exp_ref_ch_list="${exp_ref_ch_list}$i" - fi -done - -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$exp_ref_ch_list" = "$ref_ch_list"]) +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" +wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # at this point, we invert the priority of the gw chassis between gw1 and gw2 @@ -11727,9 +11662,7 @@ grep active_backup | grep slaves:$hv2_gw2_ofport,$hv2_gw1_ofport \ ]) # check that the chassis redirect port has been reclaimed by the gw2 chassis -OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \ -logical_port=cr-outside | grep $gw2_chassis | wc -l], [0],[[1 -]]) +wait_row_count Port_Binding 1 logical_port=cr-outside chassis=$gw2_chassis # check BFD enablement on tunnel ports from gw1 ######### as gw1 @@ -11801,9 +11734,7 @@ grep 00:00:02:01:02:04 | wc -l], [0], [[0 ]]) # check that the chassis redirect port has been reclaimed by the gw1 chassis -OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \ -logical_port=cr-outside | grep $gw1_chassis | wc -l], [0],[[1 -]]) +wait_row_count Port_Binding 1 logical_port=cr-outside chassis=$gw1_chassis ovn-nbctl --wait=hv set NB_Global . options:"bfd-min-rx"=2000 as gw2 @@ -11836,11 +11767,7 @@ done # reference to hv1. as hv1 ovs-vsctl del-port hv1-vif1 -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$hv2_ch_uuid" = "$ref_ch_list"]) +wait_column "$hv2_ch_uuid" HA_Chassis_Group ref_chassis # Delete the inside2 vif. ovn-sbctl show @@ -11849,19 +11776,14 @@ echo "Deleting hv2-vif1" as hv2 ovs-vsctl del-port hv2-vif1 # ref_chassis of ha_chassis_group should be empty -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - exp_ref_ch_list="" - test "$exp_ref_ch_list" = "$ref_ch_list"]) +wait_column '' HA_Chassis_Group ref_chassis # Delete the Gateway_Chassis for lrp - outside ovn-nbctl clear Logical_Router_Port outside gateway_chassis # There shoud be no ha_chassis_group rows in SB DB. -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list ha_chassis_group | wc -l`]) -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list ha_chassis | wc -l`]) +wait_row_count HA_Chassis_Group 0 +wait_row_count HA_Chassis 0 ovn-nbctl remove NB_Global . options "bfd-min-rx" ovn-nbctl remove NB_Global . options "bfd-min-tx" @@ -11879,16 +11801,13 @@ ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 gw2 20 # ovn-northd should not create HA chassis group and HA chassis rows # unless the HA chassis group in OVN NB DB is associated to # a logical router port. -OVS_WAIT_UNTIL([test 0 = `ovn-sbctl list ha_chassis | wc -l`]) +wait_row_count HA_Chassis 0 # Associate hagrp1 to outside logical router port ovn-nbctl set Logical_Router_Port outside ha_chassis_group=$hagrp1_uuid -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns _uuid \ -find ha_chassis_group | wc -l`]) - -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl list ha_chassis | grep chassis | \ -grep -v chassis-name | wc -l`]) +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=32 | \ grep active_backup | grep slaves:$hv1_gw1_ofport,$hv1_gw2_ofport \ @@ -11930,24 +11849,10 @@ for i in 1 2; do ofport-request=1 done -hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"` -hv2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv2"` - -exp_ref_ch_list='' -for i in `ovn-sbctl --bare --columns _uuid list chassis | sort` -do - if test $i = $hv1_ch_uuid; then - exp_ref_ch_list="${exp_ref_ch_list}$i" - elif test $i = $hv2_ch_uuid; then - exp_ref_ch_list="${exp_ref_ch_list}$i" - fi -done - -OVS_WAIT_UNTIL( - [ref_ch_list=`ovn-sbctl --bare --columns ref_chassis find ha_chassis_group | sort` - # Trim the spaces. - ref_ch_list=`echo $ref_ch_list | sed 's/ //g'` - test "$exp_ref_ch_list" = "$ref_ch_list"]) +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" +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 @@ -12035,9 +11940,7 @@ grep 00:00:02:01:02:04 | wc -l], [0], [[0 ]]) # check that the chassis redirect port has been reclaimed by the gw1 chassis -OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \ -logical_port=cr-outside | grep $gw1_chassis | wc -l], [0],[[1 -]]) +wait_row_count Port_Binding 1 logical_port=cr-outside chassis=$gw1_chassis OVN_CLEANUP([gw1],[gw2],[hv1],[hv2]) @@ -12304,22 +12207,14 @@ gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2) ovn-sbctl destroy Chassis $gw2_chassis # Wait for the gw2_chassis row is recreated. -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns=_uuid find Chassis name=gw2 | wc -l`]) - -gw1_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw1) -gw2_chassis=$(ovn-sbctl --bare --columns=_uuid find Chassis name=gw2) +wait_row_count Chassis 1 name=gw2 # When gw2 chassis row is destroyed, it gets recreated. There # is a small window in which gw2 may claim the cr-outside port if # it has not established bfd tunnel with gw1. # So make sure that, cr-outside is claimed by gw1 finally. -OVS_WAIT_WHILE( - [cr_outside_ch=`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside` - test $cr_outside_ch = $gw2_chassis]) - -OVS_WAIT_UNTIL( - [cr_outside_ch=`ovn-sbctl --bare --columns=chassis find Port_binding logical_port=cr-outside` - test $cr_outside_ch = $gw1_chassis]) +gw1_chassis=$(fetch_column Chassis _uuid name=gw1) +wait_row_count Port_Binding 1 logical_port=cr-outside chassis=$gw1_chassis OVN_CLEANUP([gw1],[gw2],[hv1]) @@ -12432,11 +12327,9 @@ AT_CHECK([ovn-sbctl dump-flows lr0_ip6 | grep nd_na_router | \ wc -l], [0], [4 ]) -cr_uuid=`ovn-sbctl find port_binding logical_port=cr-ip6_public | grep _uuid | cut -f2 -d ":"` - # Get the redirect chassis uuid. -chassis_uuid=`ovn-sbctl list chassis hv1 | grep _uuid | cut -f2 -d ":"` -OVS_WAIT_UNTIL([test $chassis_uuid = `ovn-sbctl get port_binding $cr_uuid chassis`]) +chassis_uuid=$(fetch_column Chassis _uuid name=hv1) +wait_row_count Port_Binding 1 logical_port=cr-ip6_public chassis=$chassis_uuid trim_zeros() { sed 's/\(00\)\{1,\}$//' @@ -12584,10 +12477,10 @@ ovn-nbctl lsp-set-options lsp0 requested-chassis=hv1 ovn-nbctl --wait=hv --timeout=3 sync # Retrieve hv1 and hv2 chassis UUIDs from southbound database -ovn-sbctl wait-until chassis hv1 -ovn-sbctl wait-until chassis hv2 -hv1_uuid=$(ovn-sbctl --bare --columns _uuid find chassis name=hv1) -hv2_uuid=$(ovn-sbctl --bare --columns _uuid find chassis name=hv2) +wait_row_count Chassis 1 name=hv1 +wait_row_count Chassis 1 name=hv2 +hv1_uuid=$(fetch_column Chassis _uuid name=hv1) +hv2_uuid=$(fetch_column Chassis _uuid name=hv2) # (1) Chassis hv2 should not bind lsp0 when requested-chassis is hv1. echo "verifying that hv2 does not bind lsp0 when hv2 physical/logical mapping is added" @@ -12595,7 +12488,7 @@ as hv2 ovs-vsctl set interface hv2-vif0 external-ids:iface-id=lsp0 OVS_WAIT_UNTIL([test 1 = $(grep -c "Not claiming lport lsp0" hv2/ovn-controller.log)]) -AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x], [0], []) +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=0 | grep in_port=1], [1], []) @@ -12607,7 +12500,7 @@ as hv1 ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0 OVS_WAIT_UNTIL([test 1 = $(grep -c "Claiming lport lsp0" hv1/ovn-controller.log)]) -AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"$hv1_uuid"], [0], []) +check_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 @@ -12620,7 +12513,7 @@ echo "verifying that lsp0 binding moves when requested-chassis is changed" ovn-nbctl lsp-set-options lsp0 requested-chassis=hv2 OVS_WAIT_UNTIL([test 1 = $(grep -c "Releasing lport lsp0 from this chassis" hv1/ovn-controller.log)]) -OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"$hv2_uuid"]) +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=0 | grep in_port=1], [0], [ignore]) @@ -12647,23 +12540,23 @@ 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 -ovn-sbctl wait-until chassis hv1 -hv1_hostname=$(ovn-sbctl --bare --columns hostname find Chassis name=hv1) +wait_row_count Chassis 1 name=hv1 +hv1_hostname=$(fetch Chassis hostname name=hv1) echo "hv1_hostname=${hv1_hostname}" ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=${hv1_hostname} as hv1 ovs-vsctl set interface hv1-vif0 external-ids:iface-id=lsp0 -hv1_uuid=$(ovn-sbctl --bare --columns _uuid find Chassis name=hv1) +hv1_uuid=$(fetch_column Chassis _uuid name=hv1) echo "hv1_uuid=${hv1_uuid}" OVS_WAIT_UNTIL([test 1 = $(grep -c "Claiming lport lsp0" hv1/ovn-controller.log)]) -AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x"$hv1_uuid"], [0], []) +wait_column "$hv1_uuid" Port_Binding chassis logical_port=lsp0 AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1], [0], [ignore]) AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=65 | grep actions=output:1], [0], [ignore]) ovn-nbctl --wait=hv --timeout=3 lsp-set-options lsp0 requested-chassis=non-existant-chassis OVS_WAIT_UNTIL([test 1 = $(grep -c "Releasing lport lsp0 from this chassis" hv1/ovn-controller.log)]) ovn-nbctl --wait=hv --timeout=3 sync -AT_CHECK([test x$(ovn-sbctl --bare --columns chassis find port_binding logical_port=lsp0) = x], [0], []) +wait_column '' Port_Binding chasssi logical_port=lsp0 AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=0 | grep in_port=1], [1], []) AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=65 | grep output], [1], []) @@ -13501,29 +13394,17 @@ ovn-nbctl --id=@p get Logical_Switch_Port lp3 -- add Port_Group pg2 ports @p ovn-nbctl --wait=sb sync dnl Check if port group address sets were populated with ports' addresses -AT_CHECK([ovn-sbctl get Address_Set pg1_ip4 addresses], - [0], [[["10.0.0.1", "10.0.0.2"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg2_ip4 addresses], - [0], [[["10.0.0.2", "10.0.0.3"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg1_ip6 addresses], - [0], [[["2001:db8::1", "2001:db8::2"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg2_ip6 addresses], - [0], [[["2001:db8::2", "2001:db8::3"]] -]) +check_column '10.0.0.1 10.0.0.2' Address_Set addresses name=pg1_ip4 +check_column '10.0.0.2 10.0.0.3' Address_Set addresses name=pg2_ip4 +check_column '2001:db8::1 2001:db8::2' Address_Set addresses name=pg1_ip6 +check_column '2001:db8::2 2001:db8::3' Address_Set addresses name=pg2_ip6 ovn-nbctl --wait=sb lsp-set-addresses lp1 \ "02:00:00:00:00:01 10.0.0.11 2001:db8::11" dnl Check if updated address got propagated to the port group address sets -AT_CHECK([ovn-sbctl get Address_Set pg1_ip4 addresses], - [0], [[["10.0.0.11", "10.0.0.2"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg1_ip6 addresses], - [0], [[["2001:db8::11", "2001:db8::2"]] -]) +check_column '10.0.0.11 10.0.0.2' Address_Set addresses name=pg1_ip4 +check_column '2001:db8::11 2001:db8::2' Address_Set addresses name=pg1_ip6 AT_CLEANUP @@ -16010,8 +15891,8 @@ ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.24.4.100 10.0.0.10 ovn-nbctl lr-nat-add lr1 dnat_and_snat 172.24.4.200 20.0.0.10 # Check that the MAC_Binding entries have been properly created -OVS_WAIT_UNTIL([test `ovn-sbctl find mac_binding logical_port="lr0-pub" ip="172.24.4.200" | wc -l` -gt 0]) -OVS_WAIT_UNTIL([test `ovn-sbctl find mac_binding logical_port="lr1-pub" ip="172.24.4.100" | wc -l` -gt 0]) +wait_row_count MAC_Binding 1 logical_port=lr0-pub ip=172.24.4.200 +wait_row_count MAC_Binding 1 logical_port=lr1-pub ip=172.24.4.100 # Check that the GARPs went also to the external physical network # Wait until at least 4 packets have arrived and copy them to a separate file as @@ -17219,10 +17100,7 @@ send_igmp_v3_report hv1-vif1 hv1 \ /dev/null # Check IGMP_Group table on both HV. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` - test "${total_entries}" = "1" -]) +wait_row_count IGMP_Group 1 address=239.0.1.68 # Send traffic and make sure it gets forwarded only on the port that joined. as hv1 reset_pcap_file hv1-vif1 hv1/vif1 @@ -17247,10 +17125,7 @@ OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) # Flush IGMP groups. ovn-sbctl ip-multicast-flush sw1 -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` - test "${total_entries}" = "0" -]) +wait_row_count IGMP_Group 0 address=239.0.1.68 # Check that traffic for 224.0.0.X is flooded even if some hosts register for # it. @@ -17261,10 +17136,7 @@ send_igmp_v3_report hv1-vif1 hv1 \ /dev/null # Check that the IGMP Group is learned. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "224.0.0.42" -c` - test "${total_entries}" = "1" -]) +wait_row_count IGMP_Group 1 address=224.0.0.42 # Send traffic and make sure it gets flooded to all ports. as hv1 reset_pcap_file hv1-vif1 hv1/vif1 @@ -17355,10 +17227,7 @@ send_igmp_v3_report hv2-vif3 hv2 \ /dev/null # Check that the IGMP Group is learned by all switches. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` - test "${total_entries}" = "2" -]) +wait_row_count IGMP_Group 2 address=239.0.1.68 # Send traffic from sw3 and make sure it is relayed by rtr. # to ports that joined. @@ -17845,10 +17714,7 @@ send_mld_v2_report hv2-vif1 hv2 \ /dev/null # Check that the IP multicast group is learned on both hv. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c` - test "${total_entries}" = "2" -]) +wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"' # Send traffic and make sure it gets forwarded only on the two ports that # joined. @@ -17881,10 +17747,7 @@ send_mld_v2_report hv1-vif1 hv1 \ /dev/null # Check IGMP_Group table on both HV. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c` - test "${total_entries}" = "1" -]) +wait_row_count IGMP_Group 1 address='"ff0a:dead:beef::1"' # Send traffic and make sure it gets forwarded only on the port that joined. as hv1 reset_pcap_file hv1-vif1 hv1/vif1 @@ -17913,10 +17776,7 @@ OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) # Flush IP multicast groups. ovn-sbctl ip-multicast-flush sw1 -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep " ff0a:dead:beef::1" -c` - test "${total_entries}" = "0" -]) +wait_row_count IGMP_Group 0 address='"ff0a:dead:beef::1"' # Check that traffic for "all-hosts" is flooded even if some hosts register # for it. @@ -17927,10 +17787,7 @@ send_mld_v2_report hv1-vif1 hv1 \ /dev/null # Check that the Multicast Group is learned. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "ff02::1" -c` - test "${total_entries}" = "1" -]) +wait_row_count IGMP_Group 1 address='"ff02::1"' # Send traffic and make sure it gets flooded to all ports. as hv1 reset_pcap_file hv1-vif1 hv1/vif1 @@ -18027,10 +17884,7 @@ send_mld_v2_report hv2-vif3 hv2 \ /dev/null # Check that the IGMP Group is learned by all switches. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c` - test "${total_entries}" = "2" -]) +wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"' # Send traffic from sw3 and make sure it is relayed by rtr. # to ports that joined. @@ -18081,10 +17935,7 @@ send_mld_v2_report hv1-vif4 hv1 \ /dev/null # Check that the Multicast Group is learned by all switches. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c` - test "${total_entries}" = "3" -]) +wait_row_count IGMP_Group 3 address='"ff0a:dead:beef::1"' # Send traffic from sw3 and make sure it is relayed by rtr # to ports that joined. @@ -18193,10 +18044,7 @@ send_mld_v2_report hv1-vif2 hv1 \ expected_reports # Check that the IP multicast group is learned. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c` - test "${total_entries}" = "1" -]) +wait_row_count IGMP_Group 1 address='"ff0a:dead:beef::1"' # Send traffic from sw1-p21 send_ip_multicast_pkt hv2-vif1 hv2 \ @@ -18917,14 +18765,14 @@ ip_to_hex() { # ip - 10.0.0.30 # mac - 50:54:00:00:00:03 -AT_CHECK([test 0 = `ovn-sbctl list mac_binding | wc -l`]) +check_row_count MAC_Binding 0 eth_src=505400000003 eth_dst=ffffffffffff spa=$(ip_to_hex 10 0 0 30) tpa=$(ip_to_hex 10 0 0 30) send_garp 1 1 $eth_src $eth_dst $spa $tpa -OVS_WAIT_UNTIL([test 1 = `ovn-sbctl --bare --columns _uuid list mac_binding | wc -l`]) +wait_row_count MAC_Binding 1 AT_CHECK([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \ list mac_binding], [0], [lr0-sw0 @@ -18964,7 +18812,7 @@ send_garp 1 1 $eth_src $eth_dst $spa $tpa # should be updated. OVS_WAIT_UNTIL([test 2 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`]) -AT_CHECK([test 1 = `ovn-sbctl --bare --columns _uuid list mac_binding | wc -l`]) +check_row_count MAC_Binding 1 AT_CHECK([ovn-sbctl --format=csv --bare --columns logical_port,ip,mac \ list mac_binding], [0], [lr0-sw0 @@ -19544,8 +19392,7 @@ ovn-nbctl --wait=hv lrp-set-gateway-chassis lr0-public hv1 20 OVN_POPULATE_ARP ovn-nbctl --wait=hv sync -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l`]) +wait_row_count Service_Monitor 2 ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt AT_CHECK([cat lflows.txt], [0], [dnl @@ -19571,8 +19418,7 @@ OVS_WAIT_UNTIL( grep "405400000003${svc_mon_src_mac}" | wc -l`] ) -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl --bare --columns status find \ -service_monitor | grep offline | wc -l`]) +wait_row_count Service_Monitor 2 status=offline OVS_WAIT_UNTIL( [test 2 = `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap | \ @@ -19599,33 +19445,26 @@ AT_CHECK([cat lflows.txt], [0], [dnl # Delete sw0-p1 ovn-nbctl lsp-del sw0-p1 -OVS_WAIT_UNTIL([test 1 = $(ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l)]) +wait_row_count Service_Monitor 1 # Add back sw0-p1 but without any IP address. ovn-nbctl lsp-add sw0 sw0-p1 ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03" -- \ lsp-set-port-security sw0-p1 "50:54:00:00:00:03" -OVS_WAIT_UNTIL([test 2 = $(ovn-sbctl --bare --columns status find \ -service_monitor | grep offline | wc -l)]) +wait_row_count Service_Monitor 2 status=offline ovn-nbctl lsp-del sw0-p1 ovn-nbctl lsp-del sw1-p1 -OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l)]) +wait_row_count Service_Monitor 0 # Add back sw0-p1 but without any address set. ovn-nbctl lsp-add sw0 sw0-p1 -OVS_WAIT_UNTIL([test 1 = $(ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l)]) -OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl --bare --columns status find \ -service_monitor | grep offline | wc -l)]) - -OVS_WAIT_UNTIL([test 0 = $(ovn-sbctl --bare --columns status find \ -service_monitor | grep online | wc -l)]) +wait_row_count Service_Monitor 1 +wait_row_count Service_Monitor 0 status=offline +wait_row_count Service_Monitor 0 status=online OVN_CLEANUP([hv1], [hv2]) AT_CLEANUP @@ -19736,9 +19575,7 @@ ovn-nbctl --wait=hv sync # And now for the anticlimax. We need to ensure that there is no # service monitor in the southbound db. - -AT_CHECK([test 0 = `ovn-sbctl --bare --columns _uuid find \ -service_monitor | sed '/^$/d' | wc -l`]) +check_row_count Service_Monitor 0 # Let's also be sure the warning message about SCTP load balancers is # is in the ovn-northd log @@ -22017,9 +21854,9 @@ as hv1 ovs-vsctl \ -- set Interface vif1 external_ids:iface-id=lsp # Wait for port to be bound. -OVS_WAIT_UNTIL([test $(ovn-sbctl --columns _uuid --bare list chassis hv1 | wc -l) -eq 1]) -ch=$(ovn-sbctl --columns _uuid --bare list chassis hv1) -OVS_WAIT_UNTIL([test $(ovn-sbctl --columns chassis --bare list port_binding lsp | grep $ch -c) -eq 1]) +wait_row_count Chassis 1 name=hv1 +ch=$(fetch_column Chassis _uuid name=hv1) +wait_row_count Port_Binding 1 logical_port=lsp chassis=$ch # Pause ovn-controller. as hv1 ovn-appctl -t ovn-controller debug/pause @@ -22731,9 +22568,9 @@ as hv1 ovs-vsctl \ -- set Interface vif1 external_ids:iface-id=sw0-p1 # Wait for port to be bound. -OVS_WAIT_UNTIL([test $(ovn-sbctl --columns _uuid --bare list chassis hv1 | wc -l) -eq 1]) -ch=$(ovn-sbctl --columns _uuid --bare list chassis hv1) -OVS_WAIT_UNTIL([test $(ovn-sbctl --columns chassis --bare list port_binding sw0-p1 | grep $ch -c) -eq 1]) +wait_row_count Chassis 1 name=hv1 +ch=$(fetch_column Chassis _uuid name=hv1) +wait_row_count Port_Binding 1 logical_port=sw0-p1 chassis=$ch as hv1 ovs-vsctl add-br br-temp as hv1 ovs-vsctl \ @@ -22743,13 +22580,13 @@ as hv1 ovs-vsctl \ ovn-nbctl --wait=hv sync # hv1 ovn-controller should not bind sw0-p2. -AT_CHECK([test $(ovn-sbctl --columns chassis --bare list port_binding sw0-p2 | grep $ch -c) -eq 0]) +check_row_count Port_Binding 0 logical_port=sw0-p2 chassis=$c # Trigger recompute and sw0-p2 should not be claimed. as hv1 ovn-appctl -t ovn-controller recompute ovn-nbctl --wait=hv sync -AT_CHECK([test $(ovn-sbctl --columns chassis --bare list port_binding sw0-p2 | grep $ch -c) -eq 0]) +check_row_count Port_Binding 0 logical_port=sw0-p2 chassis=$ch ovn-sbctl --columns chassis --bare list port_binding sw0-p2 diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at index 3dcf8f96d8fe..856f5d2d7294 100644 --- a/tests/ovs-macros.at +++ b/tests/ovs-macros.at @@ -23,9 +23,11 @@ dnl that can ordinarily be run only within AT_SETUP...AT_CLEANUP. m4_define([OVS_START_SHELL_HELPERS], [m4_ifdef([AT_ingroup], [m4_fatal([$0: AT_SETUP and OVS_DEFINE_SHELL_HELPERS may not nest])]) m4_define([AT_ingroup]) + m4_define([AT_capture_files]) m4_divert_push([PREPARE_TESTS])]) m4_define([OVS_END_SHELL_HELPERS], [ m4_divert_pop([PREPARE_TESTS]) + m4_undefine([AT_capture_files]) m4_undefine([AT_ingroup])]) m4_divert_push([PREPARE_TESTS]) @@ -231,21 +233,52 @@ ovs_wait_failed () { ovs_wait "AS_ESCAPE([$3])" "AS_ESCAPE([$4])" ]) -dnl OVS_WAIT_UNTIL(COMMAND) +dnl OVS_WAIT_UNTIL(COMMAND[, IF-FAILED]) dnl dnl Executes shell COMMAND in a loop until it returns dnl zero return code. If COMMAND did not return dnl zero code within reasonable time limit, then -dnl the test fails. +dnl the test fails. In that case, runs IF-FAILED +dnl before aborting. m4_define([OVS_WAIT_UNTIL], [OVS_WAIT([$1], [$2], [AT_LINE], [until $1])]) -dnl OVS_WAIT_WHILE(COMMAND) +dnl OVS_WAIT_FOR_OUTPUT(COMMAND, EXIT-STATUS, STDOUT, STDERR) +dnl +dnl Executes shell COMMAND in a loop until it exits with status EXIT-STATUS, +dnl prints STDOUT on stdout, and prints STDERR on stderr. If this doesn't +dnl happen within a reasonable time limit, then the test fails. +m4_define([OVS_WAIT_FOR_OUTPUT], [dnl +wait_expected_status=m4_if([$2], [], [0], [$2]) +AT_DATA([wait-expected-stdout], [$3]) +AT_DATA([wait-expected-stderr], [$4]) +ovs_wait_command() { + $1 +} +ovs_wait_cond() { + ovs_wait_command >wait-stdout 2>wait-stderr + wait_status=$? + (test $wait_status = $wait_expected_status && + $at_diff wait-expected-stdout wait-stdout && + $at_diff wait-expected-stderr wait-stderr) >/dev/null 2>&1 +} +ovs_wait_failed () { + if test $wait_status != $wait_expected_status; then + echo "exit status $wait_status != expected $wait_expected_status" + fi + $at_diff wait-expected-stdout wait-stdout + $at_diff wait-expected-stderr wait-stderr +} +ovs_wait "AS_ESCAPE([AT_LINE])" "for output from AS_ESCAPE([$1])" +]) + +dnl OVS_WAIT_WHILE(COMMAND[, IF-FAILED]) dnl dnl Executes shell COMMAND in a loop until it returns dnl non-zero return code. If COMMAND did not return dnl non-zero code within reasonable time limit, then -dnl the test fails. +dnl the test fails. In that case, runs IF-FAILED +dnl before aborting. m4_define([OVS_WAIT_WHILE], [OVS_WAIT([if $1; then return 1; else return 0; fi], [$2], [AT_LINE], [while $1])]) From patchwork Fri Oct 30 00:24:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390538 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjl81RThz9sSn for ; Fri, 30 Oct 2020 11:25:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 870042E1BE; Fri, 30 Oct 2020 00:25:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bzEnRvk-YVOv; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 138A222FC6; Fri, 30 Oct 2020 00:25:09 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id EA5BCC0859; Fri, 30 Oct 2020 00:25:08 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3F29AC0859 for ; Fri, 30 Oct 2020 00:25:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 0DFBE22FEE for ; Fri, 30 Oct 2020 00:25:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n4iHDeJWClnb for ; Fri, 30 Oct 2020 00:25:00 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by silver.osuosl.org (Postfix) with ESMTPS id D473120354 for ; Fri, 30 Oct 2020 00:24:59 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 2921840005; Fri, 30 Oct 2020 00:24:56 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:34 -0700 Message-Id: <20201030002447.936548-3-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Leonid Ryzhyk , Ben Pfaff Subject: [ovs-dev] [PATCH ovn 03/16] tests: Add some more "wait"s for ovn-northd synchronization. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Leonid Ryzhyk These also add "check" to the calls that are not already inside AT_CHECK, to make sure that these calls succeed. Signed-off-by: Ben Pfaff --- tests/ovn-controller-vtep.at | 8 +-- tests/ovn-ic.at | 3 +- tests/ovn-northd.at | 36 ++++++------ tests/ovn.at | 104 +++++++++++++++++++++-------------- 4 files changed, 87 insertions(+), 64 deletions(-) diff --git a/tests/ovn-controller-vtep.at b/tests/ovn-controller-vtep.at index f0598fa4dc95..d3895a60f53c 100644 --- a/tests/ovn-controller-vtep.at +++ b/tests/ovn-controller-vtep.at @@ -375,7 +375,7 @@ AT_CHECK([ovs-vsctl --columns=options list Interface bfd1.2.3.5 | cut -d ':' -f2 ]) # adds another mac to logical switch port. -AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:02 f0:ab:cd:ef:01:03]) +AT_CHECK([ovn-nbctl --wait=sb lsp-set-addresses vif0 f0:ab:cd:ef:01:02 f0:ab:cd:ef:01:03]) OVS_WAIT_UNTIL([test -n "`vtep-ctl list Ucast_Macs_Remote | grep 03`"]) AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl @@ -400,7 +400,7 @@ AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr - ]) # removes one mac to logical switch port. -AT_CHECK([ovn-nbctl lsp-set-addresses vif0 f0:ab:cd:ef:01:03]) +AT_CHECK([ovn-nbctl --wait=sb lsp-set-addresses vif0 f0:ab:cd:ef:01:03]) OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 02`"]) AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl "f0:ab:cd:ef:01:03" @@ -408,7 +408,7 @@ AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr - # migrates mac to logical switch port vif1 on 'br-void'. AT_CHECK([ovn-nbctl lsp-set-addresses vif0]) -AT_CHECK([ovn-nbctl lsp-set-addresses vif1 f0:ab:cd:ef:01:03]) +AT_CHECK([ovn-nbctl --wait=sb lsp-set-addresses vif1 f0:ab:cd:ef:01:03]) OVS_WAIT_UNTIL([test -z "`vtep-ctl --columns=MAC list Ucast_Macs_Remote | grep 03`"]) AT_CHECK([vtep-ctl --columns=MAC list Ucast_Macs_Remote | cut -d ':' -f2- | tr -d ' ' | sort], [0], [dnl ]) @@ -454,7 +454,7 @@ AT_CHECK([sed -n 's/^.*\(|WARN|.*\)$/\1/p' ovn-controller-vtep.log | sed 's/([[- ]) # deletes vif1. -AT_CHECK([ovn-nbctl lsp-del vif1]) +AT_CHECK([ovn-nbctl --wait=sb lsp-del vif1]) # adds another lswitch 'br-void' in ovn-nb database. AT_CHECK([ovn-nbctl ls-add br-void]) diff --git a/tests/ovn-ic.at b/tests/ovn-ic.at index 1d40ce958d6c..0638af401295 100644 --- a/tests/ovn-ic.at +++ b/tests/ovn-ic.at @@ -44,6 +44,7 @@ wait_row_count ic-sb:Datapath_Binding 1 transit_switch=ts2 check_column "ts1 ts2" ic-sb:Datapath_Binding transit_switch check_column "ts1 ts2" nb:Logical_Switch name +ovn-nbctl --wait=hv sync # Check SB DP key ts1_key=$(fetch_column ic-sb:Datapath_Binding tunnel_key transit_switch=ts1) @@ -143,7 +144,7 @@ ovn-nbctl lrp-add lr1 lrp-lr1-ts1 aa:aa:aa:aa:aa:01 169.254.100.1/24 ovn-nbctl lsp-add ts1 lsp-ts1-lr1 ovn-nbctl lsp-set-addresses lsp-ts1-lr1 router ovn-nbctl lsp-set-type lsp-ts1-lr1 router -ovn-nbctl lsp-set-options lsp-ts1-lr1 router-port=lrp-lr1-ts1 +ovn-nbctl --wait=hv lsp-set-options lsp-ts1-lr1 router-port=lrp-lr1-ts1 AT_CHECK([ovn_as az2 ovn-nbctl show | uuidfilt], [0], [dnl switch <0> (ts1) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 869bcd6f6cba..90f3c8f19241 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -304,10 +304,10 @@ check_row_count HA_Chassis 0 # Create a logical router port and attach ha chassis group. ovn-nbctl lr-add lr0 -ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 +check ovn-nbctl --wait=sb lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1` -ovn-nbctl set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid +check ovn-nbctl --wait=sb set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid wait_row_count HA_Chassis_Group 1 name=hagrp1 @@ -371,7 +371,7 @@ wait_row_count HA_Chassis_Group 1 name=hagrp1 wait_row_count HA_Chassis 3 # Create a Gateway chassis. ovn-northd should ignore this. -ovn-nbctl lrp-set-gateway-chassis lr0-public ch-1 20 +check ovn-nbctl --wait=sb lrp-set-gateway-chassis lr0-public ch1 20 # There should be only 1 HA chassis group in SB DB with the # name hagrp1. @@ -409,7 +409,7 @@ ovn-nbctl lrp-add lr0 lr0-sw0 00:00:20:20:12:14 10.0.0.1/24 ovn-nbctl lsp-add sw0 sw0-lr0 ovn-nbctl lsp-set-type sw0-lr0 router ovn-nbctl lsp-set-addresses sw0-lr0 router -ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 +check ovn-nbctl --wait=sb lsp-set-options sw0-lr0 router-port=lr0-sw0 ovn-sbctl lsp-bind sw0-p1 comp1 wait_row_count nb:Logical_Switch_Port 1 name=sw0-p1 up=true @@ -437,7 +437,7 @@ ovn-nbctl lrp-add lr1 lr1-sw1 00:00:20:20:12:15 20.0.0.1/24 ovn-nbctl lsp-add sw1 sw1-lr1 ovn-nbctl lsp-set-type sw1-lr1 router ovn-nbctl lsp-set-addresses sw1-lr1 router -ovn-nbctl lsp-set-options sw1-lr1 router-port=lr1-sw1 +check ovn-nbctl --wait=sb lsp-set-options sw1-lr1 router-port=lr1-sw1 # Bind sw1-p1 in comp1. ovn-sbctl lsp-bind sw1-p1 comp1 @@ -452,7 +452,7 @@ ovn-nbctl lrp-add lr1 lr1-sw0 00:00:20:20:12:16 10.0.0.10/24 ovn-nbctl lsp-add sw0 sw0-lr1 ovn-nbctl lsp-set-type sw0-lr1 router ovn-nbctl lsp-set-addresses sw0-lr1 router -ovn-nbctl lsp-set-options sw0-lr1 router-port=lr1-sw0 +check ovn-nbctl --wait=sb lsp-set-options sw0-lr1 router-port=lr1-sw0 # Both comp1 and comp2 should be in 'ref_chassis' as sw1 is indirectly # connected to lr0 @@ -473,7 +473,7 @@ ovn-nbctl lrp-add lr2 lr2-sw2 00:00:20:20:12:17 30.0.0.1/24 ovn-nbctl lsp-add sw2 sw2-lr2 ovn-nbctl lsp-set-type sw2-lr2 router ovn-nbctl lsp-set-addresses sw2-lr2 router -ovn-nbctl lsp-set-options sw2-lr2 router-port=lr2-sw2 +check ovn-nbctl --wait=sb lsp-set-options sw2-lr2 router-port=lr2-sw2 # Bind sw2-p1 to comp1 ovn-sbctl lsp-bind sw2-p1 comp1 @@ -488,14 +488,14 @@ ovn-nbctl lrp-add lr2 lr2-sw1 00:00:20:20:12:18 20.0.0.10/24 ovn-nbctl lsp-add sw1 sw1-lr2 ovn-nbctl lsp-set-type sw1-lr2 router ovn-nbctl lsp-set-addresses sw1-lr2 router -ovn-nbctl lsp-set-options sw1-lr2 router-port=lr2-sw1 +check ovn-nbctl --wait=sb lsp-set-options sw1-lr2 router-port=lr2-sw1 # sw2-p1 is indirectly connected to lr0. So comp1 (and comp2) should be in # 'ref_chassis' wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # Create sw0-p2 and bind it to comp1 -ovn-nbctl lsp-add sw0 sw0-p2 +check ovn-nbctl --wait=sb lsp-add sw0 sw0-p2 ovn-sbctl lsp-bind sw0-p2 comp1 wait_row_count nb:Logical_Switch_Port 1 name=sw0-p2 up=true wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis @@ -539,7 +539,7 @@ ovn-nbctl lsp-set-addresses sw0-pext1 "00:00:00:00:00:03 10.0.0.3" ovn-nbctl lsp-set-addresses sw0-pext2 "00:00:00:00:00:03 10.0.0.4" ovn-nbctl lsp-set-addresses sw0-p1 "00:00:00:00:00:03 10.0.0.5" -ovn-nbctl --wait=sb ha-chassis-group-add hagrp1 +check ovn-nbctl --wait=sb ha-chassis-group-add hagrp1 ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30 ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20 @@ -589,7 +589,7 @@ ha_chassis_group=$hagrp1_uuid wait_row_count Port_Binding 0 logical_port=sw0-p1 'chassis!=[[]]' # Clear ha_chassis_group for sw0-pext1 -ovn-nbctl --wait=sb clear logical_switch_port sw0-pext1 ha_chassis_group +check ovn-nbctl --wait=sb clear logical_switch_port sw0-pext1 ha_chassis_group wait_row_count Port_Binding 0 logical_port=sw0-pext1 'chassis!=[[]]' @@ -685,9 +685,9 @@ ovn-nbctl ls-add S1 ovn-nbctl lsp-add S1 S1-R1 ovn-nbctl lsp-set-type S1-R1 router ovn-nbctl lsp-set-addresses S1-R1 router -ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1 +ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1 -ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1 +check ovn-nbctl --wait=sb lrp-set-gateway-chassis R1-S1 gw1 ovn-nbctl lrp-set-redirect-type R1-S1 bridged wait_row_count Port_Binding 1 logical_port=cr-R1-S1 options:redirect-type=bridged @@ -708,9 +708,9 @@ ovn-nbctl ls-add S1 ovn-nbctl lsp-add S1 S1-R1 ovn-nbctl lsp-set-type S1-R1 router ovn-nbctl lsp-set-addresses S1-R1 router -ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1 +ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1 -ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1 +check ovn-nbctl --wait=sb lrp-set-gateway-chassis R1-S1 gw1 # IPV4 ovn-nbctl lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 @@ -799,9 +799,9 @@ ovn-nbctl ls-add S1 ovn-nbctl lsp-add S1 S1-R1 ovn-nbctl lsp-set-type S1-R1 router ovn-nbctl lsp-set-addresses S1-R1 router -ovn-nbctl --wait=sb lsp-set-options S1-R1 router-port=R1-S1 +ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1 -ovn-nbctl lrp-set-gateway-chassis R1-S1 gw1 +check ovn-nbctl --wait=sb lrp-set-gateway-chassis R1-S1 gw1 uuid=`ovn-sbctl --columns=_uuid --bare find Port_Binding logical_port=cr-R1-S1` echo "CR-LRP UUID is: " $uuid @@ -1272,7 +1272,7 @@ ovn-nbctl lr-lb-add lr0 lb4 ovn-nbctl lr-nat-add lr0 snat 192.168.2.1 10.0.0.0/24 ovn-nbctl lr-nat-add lr0 dnat_and_snat 192.168.2.4 10.0.0.4 -ovn-nbctl lr-nat-add lr0 dnat 192.168.2.5 10.0.0.5 +check ovn-nbctl --wait=sb lr-nat-add lr0 dnat 192.168.2.5 10.0.0.5 OVS_WAIT_UNTIL([test 1 = $(ovn-sbctl dump-flows lr0 | grep lr_in_unsnat | \ grep "ip4 && ip4.dst == 192.168.2.1 && tcp && tcp.dst == 8080" -c) ]) diff --git a/tests/ovn.at b/tests/ovn.at index 46f13f46617b..912f84c25dbb 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1782,6 +1782,7 @@ get_lsp_uuid () { ovn-nbctl create Port_Group name=pg1 ports=`get_lsp_uuid lp22`,`get_lsp_uuid lp33` ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1238 && outport == @pg1' drop +check ovn-nbctl --wait=hv sync # Pre-populate the hypervisors' ARP tables so that we don't lose any # packets for ARP resolution (native tunneling doesn't queue packets @@ -3559,6 +3560,8 @@ for i in 1 2 3; do done done +check ovn-nbctl --wait=hv sync + # Pre-populate the hypervisors' ARP tables so that we don't lose any # packets for ARP resolution (native tunneling doesn't queue packets # for ARP resolution). @@ -3566,7 +3569,6 @@ OVN_POPULATE_ARP # Allow some time for ovn-northd and ovn-controller to catch up. # XXX This should be more systematic. -sleep 1 # test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT... # @@ -5775,7 +5777,7 @@ cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) # Now add the dhcp option T1 to the dhcp options. -ovn-nbctl set dhcp_options ${d1} options:T1=4000 +check ovn-nbctl --wait=hv set dhcp_options ${d1} options:T1=4000 reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 @@ -6649,7 +6651,7 @@ ls2_p1_ip=172.16.1.2 ls3_p1_mac=00:00:00:01:02:05 # Create a drop policy -ovn-nbctl lr-policy-add R1 10 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" drop +check ovn-nbctl --wait=hv lr-policy-add R1 10 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" drop # Check logical flow AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "192.168.1.0" | wc -l], [0], [dnl @@ -6677,7 +6679,7 @@ rcvd_packet=`cat vif2.packets` AT_FAIL_IF([rcvd_packet = ""]) # Override drop policy with allow -ovn-nbctl lr-policy-add R1 20 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" allow +check ovn-nbctl --wait=hv lr-policy-add R1 20 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" allow # Check logical flow AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "192.168.1.0" | wc -l], [0], [dnl @@ -6691,6 +6693,7 @@ packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac && as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet" # Check if packet hit the allow policy +sleep 1 AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | \ grep "192.168.1.0" | \ grep "priority=20" | wc -l], [0], [dnl @@ -6706,7 +6709,7 @@ echo $expected | ovstest test-ovn expr-to-packets > expected OVN_CHECK_PACKETS([pbr-hv/vif2-tx.pcap], [expected]) # Override allow policy with reroute -ovn-nbctl lr-policy-add R1 30 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" reroute 20.20.1.2 +check ovn-nbctl --wait=hv lr-policy-add R1 30 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" reroute 20.20.1.2 # Check logical flow AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | \ @@ -6720,6 +6723,7 @@ packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac && ip4 && ip.ttl==64 && ip4.src==$ls1_p1_ip && ip4.dst==$ls2_p1_ip && udp && udp.src==53 && udp.dst==4369" as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet" +sleep 1 echo "southbound flows" @@ -6834,7 +6838,7 @@ ls2_p1_ip=2002::2 ls3_p1_mac=00:00:00:01:02:05 # Create a drop policy -ovn-nbctl lr-policy-add R1 10 "ip6.src==2001::/64 && ip6.dst==2002::/64" drop +check ovn-nbctl --wait=sb lr-policy-add R1 10 "ip6.src==2001::/64 && ip6.dst==2002::/64" drop # Check logical flow AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l], [0], [dnl @@ -6862,7 +6866,7 @@ rcvd_packet=`cat vif2.packets` AT_FAIL_IF([rcvd_packet = ""]) # Override drop policy with allow -ovn-nbctl lr-policy-add R1 20 "ip6.src==2001::/64 && ip6.dst==2002::/64" allow +check ovn-nbctl --wait=sb lr-policy-add R1 20 "ip6.src==2001::/64 && ip6.dst==2002::/64" allow # Check logical flow AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l], [0], [dnl @@ -6891,7 +6895,7 @@ echo $expected | ovstest test-ovn expr-to-packets > expected OVN_CHECK_PACKETS([pbr-hv/vif2-tx.pcap], [expected]) # Override allow policy with reroute -ovn-nbctl lr-policy-add R1 30 "ip6.src==2001::/64 && ip6.dst==2002::/64" reroute 2003::2 +check ovn-nbctl --wait=sb lr-policy-add R1 30 "ip6.src==2001::/64 && ip6.dst==2002::/64" reroute 2003::2 # Check logical flow AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | \ @@ -6905,6 +6909,7 @@ packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac && ip6 && ip.ttl==64 && ip6.src==$ls1_p1_ip && ip6.dst==$ls2_p1_ip && udp && udp.src==53 && udp.dst==4369" as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet" +sleep 1 echo "southbound flows" @@ -7921,7 +7926,7 @@ AT_CHECK([ovs-vsctl add-port br-eth0 snoopvif -- set Interface snoopvif options: AT_CHECK([ovn-nbctl lsp-add ls0 ln_port]) AT_CHECK([ovn-nbctl lsp-set-addresses ln_port unknown]) AT_CHECK([ovn-nbctl lsp-set-type ln_port localnet]) -AT_CHECK([ovn-nbctl lsp-set-options ln_port network_name=physnet1]) +AT_CHECK([ovn-nbctl --wait=hv lsp-set-options ln_port network_name=physnet1]) # Wait until the patch ports are created in hv1 to connect br-int to br-eth0 OVS_WAIT_UNTIL([test 1 = `as hv1 ovs-vsctl show | \ @@ -8419,10 +8424,12 @@ ovn-nbctl --wait=sb sync # Add an ACL that rate-limits logs at 10 per second. ovn-nbctl meter-add http-rl1 drop 10 pktps ovn-nbctl --log --severity=alert --meter=http-rl1 --name=http-acl1 acl-add lsw0 to-lport 1000 'tcp.dst==80' drop +check ovn-nbctl --wait=hv sync # Add an ACL that rate-limits logs at 5 per second. ovn-nbctl meter-add http-rl2 drop 5 pktps ovn-nbctl --log --severity=alert --meter=http-rl2 --name=http-acl2 acl-add lsw0 to-lport 1000 'tcp.dst==81' allow +check ovn-nbctl --wait=hv sync # Add an ACL that doesn't rate-limit logs. ovn-nbctl --log --severity=alert --name=http-acl3 acl-add lsw0 to-lport 1000 'tcp.dst==82' drop @@ -8637,7 +8644,7 @@ AT_CHECK([as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l], ]) # check meter with chassis not resident -ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp3" && is_chassis_resident("lp3")' rate=11123 burst=111230 +ovn-nbctl --wait=hv qos-add lsw0 to-lport 1001 'inport=="lp3" && is_chassis_resident("lp3")' rate=11123 burst=111230 as hv check_row_count nb:QoS 1 # check no meter table @@ -8651,7 +8658,7 @@ ovn-nbctl qos-del lsw0 ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp1" && is_chassis_resident("lp1")' rate=100000 burst=100000 ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp2" && is_chassis_resident("lp2")' rate=100000 burst=100000 ovn-nbctl qos-add lsw0 to-lport 1002 'inport=="lp1" && is_chassis_resident("lp1")' rate=100001 burst=100001 -ovn-nbctl qos-add lsw0 to-lport 1002 'inport=="lp2" && is_chassis_resident("lp2")' rate=100001 burst=100001 +check ovn-nbctl --wait=hv qos-add lsw0 to-lport 1002 'inport=="lp2" && is_chassis_resident("lp2")' rate=100001 burst=100001 AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep meter | wc -l], [0], [4 ]) @@ -10820,7 +10827,7 @@ OVS_WAIT_UNTIL([test 1 = `ovn-sbctl dump-flows foo | grep ls_in_l2_lkup | \ grep rp-foo | grep -v is_chassis_resident | grep priority=50 -c`]) # Set the option 'reside-on-redirect-chassis' for foo -ovn-nbctl set logical_router_port foo options:reside-on-redirect-chassis=true +check ovn-nbctl --wait=hv set logical_router_port foo options:reside-on-redirect-chassis=true # Check that there is a logical flow in logical switch foo's pipeline # to set the outport to rp-foo with the condition is_chassis_redirect. ovn-sbctl dump-flows foo @@ -13508,7 +13515,7 @@ ovn-nbctl create Address_Set name=set2 \ addresses=\"10.0.0.7\",\"10.0.0.8\",\"10.0.0.9\" ovn-nbctl acl-add ls1 to-lport 1001 \ 'ip4 && ip4.src == $set1 && ip4.dst == $set1' allow -ovn-nbctl acl-add ls1 to-lport 1001 \ +check ovn-nbctl --wait=hv acl-add ls1 to-lport 1001 \ 'ip4 && ip4.src == $set1 && ip4.dst == $set2' drop # test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT... @@ -13982,12 +13989,12 @@ test_packet() { # Test drop rule # -------------- ovn-nbctl acl-del lsw0 -ovn-nbctl --log --severity=info --name=drop-acl acl-add lsw0 to-lport 5000 'outport == @pg1 && eth.src == $set1 && eth.type == 0x1234' drop +check ovn-nbctl --wait=hv --log --severity=info --name=drop-acl acl-add lsw0 to-lport 5000 'outport == @pg1 && eth.src == $set1 && eth.type == 0x1234' drop for sf in 0 1; do if test ${sf} = 1; then # Add a stateful rule and re-run the check to make sure the # drop rule is still effective.. - ovn-nbctl acl-add lsw0 from-lport 2000 "inport == lp31 && ip" allow-related + ovn-nbctl --wait=hv acl-add lsw0 from-lport 2000 "inport == lp31 && ip" allow-related fi for is in 1 2 3; do s=${is}1 @@ -14021,12 +14028,12 @@ ovn-nbctl acl-del lsw0 # drop all packets to 11 and 21. ovn-nbctl acl-add lsw0 to-lport 5000 'outport == @pg1 && eth.src == $set1' drop # allow 0x1234 between 11 and 21 -ovn-nbctl --log --severity=info --name=allow-acl acl-add lsw0 to-lport 6000 'outport == @pg1 && eth.src == $set1 && eth.type == 0x1234' allow +check ovn-nbctl --wait=hv --log --severity=info --name=allow-acl acl-add lsw0 to-lport 6000 'outport == @pg1 && eth.src == $set1 && eth.type == 0x1234' allow for sf in 0 1; do if test ${sf} = 1; then # Add a stateful rule and re-run the check to make sure the # allow rule is still effective.. - ovn-nbctl acl-add lsw0 from-lport 2000 "inport == lp31 && ip" allow-related + check ovn-nbctl --wait=hv acl-add lsw0 from-lport 2000 "inport == lp31 && ip" allow-related fi for is in 1 2 3; do s=${is}1 @@ -15375,17 +15382,17 @@ ovn-nbctl lsp-add sw1 sw1-p1 ovn-nbctl lsp-add sw1 sw1-p2 ovn-nbctl lsp-add sw1 sw1-p3 ovn-nbctl lsp-add sw1 sw1-p4 +ovn-nbctl --wait=sb lsp-add sw1 sw1-p5 -ovn-nbctl lsp-set-addresses sw1-p1 "00:00:00:00:00:01 10.0.0.1 aef0::1" "00:00:00:00:00:02 10.0.0.2 aef0::2" -ovn-nbctl lsp-set-addresses sw1-p2 "00:00:00:00:00:03 dynamic" -ovn-nbctl lsp-set-addresses sw1-p3 "dynamic" -ovn-nbctl lsp-set-addresses sw1-p4 "router" -ovn-nbctl lsp-set-addresses sw1-p5 "unknown" +check ovn-nbctl --wait=sb lsp-set-addresses sw1-p1 "00:00:00:00:00:01 10.0.0.1 aef0::1" "00:00:00:00:00:02 10.0.0.2 aef0::2" +check ovn-nbctl --wait=sb lsp-set-addresses sw1-p2 "00:00:00:00:00:03 dynamic" +check ovn-nbctl --wait=sb lsp-set-addresses sw1-p3 "dynamic" +check ovn-nbctl --wait=sb lsp-set-addresses sw1-p4 "router" +check ovn-nbctl --wait=sb lsp-set-addresses sw1-p5 "unknown" ovn-nbctl list logical_switch_port # Now try to add duplicate addresses on a new port. These should all fail -ovn-nbctl --wait=sb lsp-add sw1 sw1-p5 AT_CHECK([ovn-nbctl lsp-set-addresses sw1-p5 "00:00:00:00:00:04 10.0.0.1"], [1], [], [ovn-nbctl: Error on switch sw1: duplicate IPv4 address '10.0.0.1' found on logical switch port 'sw1-p1' ]) @@ -16576,6 +16583,7 @@ send_arp_reply 1 1 $eth_src $eth_dst $spa $tpa OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \ logical_port=sw0-vir) = x$hv1_ch_uuid], [0], []) +sleep 1 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = xsw0-p1]) @@ -16592,6 +16600,7 @@ as hv1 ovs-vsctl del-port hv1-vif1 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \ logical_port=sw0-vir) = x], [0], []) +sleep 1 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = x]) @@ -17044,7 +17053,7 @@ ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys OVN_POPULATE_ARP # Enable IGMP snooping on sw1. -ovn-nbctl set Logical_Switch sw1 \ +check ovn-nbctl --wait=hv set Logical_Switch sw1 \ other_config:mcast_querier="false" \ other_config:mcast_snoop="true" @@ -17055,7 +17064,7 @@ OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected]) OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected]) -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync # Inject IGMP Join for 239.0.1.68 on sw1-p11. send_igmp_v3_report hv1-vif1 hv1 \ @@ -17072,6 +17081,7 @@ OVS_WAIT_UNTIL([ total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` test "${total_entries}" = "2" ]) +check ovn-nbctl --wait=hv sync # Send traffic and make sure it gets forwarded only on the two ports that # joined. @@ -17101,6 +17111,7 @@ send_igmp_v3_report hv1-vif1 hv1 \ # Check IGMP_Group table on both HV. wait_row_count IGMP_Group 1 address=239.0.1.68 +check ovn-nbctl --wait=hv sync # Send traffic and make sure it gets forwarded only on the port that joined. as hv1 reset_pcap_file hv1-vif1 hv1/vif1 @@ -17126,6 +17137,7 @@ OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) # Flush IGMP groups. ovn-sbctl ip-multicast-flush sw1 wait_row_count IGMP_Group 0 address=239.0.1.68 +check ovn-nbctl --wait=hv sync # Check that traffic for 224.0.0.X is flooded even if some hosts register for # it. @@ -17183,6 +17195,8 @@ ovn-nbctl set Logical_Switch sw3 \ other_config:mcast_querier="false" \ other_config:mcast_snoop="true" +check ovn-nbctl --wait=hv sync + # Send traffic from sw3 and make sure rtr doesn't relay it. > expected_empty @@ -17228,6 +17242,7 @@ send_igmp_v3_report hv2-vif3 hv2 \ # Check that the IGMP Group is learned by all switches. wait_row_count IGMP_Group 2 address=239.0.1.68 +check ovn-nbctl --wait=hv sync # Send traffic from sw3 and make sure it is relayed by rtr. # to ports that joined. @@ -17277,6 +17292,7 @@ OVS_WAIT_UNTIL([ total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` test "${total_entries}" = "3" ]) +check ovn-nbctl --wait=hv sync # Send traffic from sw3 and make sure it is relayed by rtr # to ports that joined. @@ -17340,6 +17356,7 @@ OVS_WAIT_UNTIL([ total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` test "${total_entries}" = "0" ]) +check ovn-nbctl --wait=hv sync as hv1 reset_pcap_file hv1-vif1 hv1/vif1 as hv1 reset_pcap_file hv1-vif2 hv1/vif2 @@ -17378,6 +17395,7 @@ OVS_WAIT_UNTIL([ total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` test "${total_entries}" = "1" ]) +check ovn-nbctl --wait=hv sync # Send traffic from sw1-p21 send_ip_multicast_pkt hv2-vif1 hv2 \ @@ -17393,8 +17411,6 @@ store_ip_multicast_pkt \ $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \ e518e518000a3b3a0000 expected_routed -# Sleep a bit to make sure no duplicate traffic is received -sleep 1 # Check that traffic is switched to sw1-p11 and sw1-p12 # Check that IGMP join is flooded on sw1-p21 @@ -17700,7 +17716,7 @@ OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected]) OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected]) -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync # Inject MLD Join for ff0a:dead:beef::1 on sw1-p11. send_mld_v2_report hv1-vif1 hv1 \ @@ -17716,6 +17732,9 @@ send_mld_v2_report hv2-vif1 hv2 \ # Check that the IP multicast group is learned on both hv. wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"' +# This gives the ovn-controller nodes a chance to see the new IGMP_Group. +check ovn-nbctl --wait=hv sync + # Send traffic and make sure it gets forwarded only on the two ports that # joined. > expected @@ -17813,7 +17832,7 @@ OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected]) # Enable multicast snooping and querier on sw2 and set query interval to # minimum. -ovn-nbctl set Logical_Switch sw2 \ +check ovn-nbctl --wait=hv set Logical_Switch sw2 \ other_config:mcast_snoop="true" \ other_config:mcast_querier="true" \ other_config:mcast_query_interval=1 \ @@ -17824,7 +17843,6 @@ ovn-nbctl set Logical_Switch sw2 \ > expected store_mld_query 0000000002fe fe8000000000000000000000000000fe expected store_mld_query 0000000002fe fe8000000000000000000000000000fe expected -sleep 1 OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected]) OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected]) @@ -17834,7 +17852,7 @@ ovn-nbctl set Logical_Switch sw2 \ other_config:mcast_querier="false" # Enable multicast snooping on sw3. -ovn-nbctl set Logical_Switch sw3 \ +check ovn-nbctl --wait=sb set Logical_Switch sw3 \ other_config:mcast_querier="false" \ other_config:mcast_snoop="true" @@ -17868,8 +17886,7 @@ OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) # Enable multicast relay on rtr -ovn-nbctl set logical_router rtr \ - options:mcast_relay="true" +check ovn-nbctl --wait=sb set logical_router rtr options:mcast_relay="true" # Inject MLD Join for ff0a:dead:beef::1 on sw1-p11. send_mld_v2_report hv1-vif1 hv1 \ @@ -18045,6 +18062,7 @@ send_mld_v2_report hv1-vif2 hv1 \ # Check that the IP multicast group is learned. wait_row_count IGMP_Group 1 address='"ff0a:dead:beef::1"' +check ovn-nbctl --wait=hv sync # Send traffic from sw1-p21 send_ip_multicast_pkt hv2-vif1 hv2 \ @@ -18295,6 +18313,8 @@ m4_define([DVR_N_S_ARP_HANDLING], ovn-nbctl lrp-set-gateway-chassis router-to-underlay hv3 ovn-nbctl --wait=sb sync + wait_row_count Port_Binding 1 logical_port=cr-router-to-underlay + # Dump a bunch of info helpful for debugging if there's a failure. echo "------ OVN dump ------" @@ -19833,6 +19853,7 @@ ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.111 42.42.42.1 ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::111 42::1 ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10.0.0.222 42.42.42.2 ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10::222 42::2 +check ovn-nbctl --wait=hv sync # Configure FIP1 and FIP2 on rtr1 for sw1-p1 and sw1-p2. ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.121 20.0.0.11 sw1-p1 00:00:00:01:00:00 @@ -20147,6 +20168,7 @@ for az in `seq 1 $n_az`; do ovn-nbctl lsp-set-options lsp-ts$i-lr$az-$i router-port=lrp-lr$az-$i-ts$i ovn-nbctl lrp-set-gateway-chassis lrp-lr$az-$i-ts$i gw$az done + check ovn-nbctl --wait=hv sync done # Pre-populate the hypervisors' ARP tables so that we don't lose any @@ -20379,10 +20401,7 @@ ovs-vsctl add-port br-int vif3 -- set Interface vif3 external-ids:iface-id=lsp22 # Add a forwarding group on ls2 with lsp21 and lsp22 as child ports # virtual IP - 172.16.1.11, virtual MAC - 00:11:de:ad:be:ef -ovn-nbctl fwd-group-add fwd_grp1 ls2 172.16.1.11 00:11:de:ad:be:ef lsp21 lsp22 - -# Allow some time for ovn-northd and ovn-controller to catch up. -sleep 1 +check ovn-nbctl --wait=hv fwd-group-add fwd_grp1 ls2 172.16.1.11 00:11:de:ad:be:ef lsp21 lsp22 # Check logical flow AT_CHECK([ovn-sbctl dump-flows | grep ls_in_l2_lkup | grep fwd_group | wc -l], [0], [dnl @@ -20426,10 +20445,7 @@ ovn-nbctl fwd-group-del fwd_grp1 # Add a forwarding group with liveness on ls2 with lsp21 and lsp22 as child # ports virtual IP - 172.16.1.11, virtual MAC - 00:11:de:ad:be:ef -ovn-nbctl --liveness fwd-group-add fwd_grp1 ls2 172.16.1.11 00:11:de:ad:be:ef lsp21 lsp22 - -# Allow some time for ovn-northd and ovn-controller to catch up. -sleep 1 +check ovn-nbctl --wait=hv --liveness fwd-group-add fwd_grp1 ls2 172.16.1.11 00:11:de:ad:be:ef lsp21 lsp22 # Verify openflow group members ofport_lsp21=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-hv2-0) @@ -20744,6 +20760,7 @@ ovn-nbctl lsp-set-options ln-public network_name=public ovn-nbctl lrp-set-gateway-chassis lr0-public hv1 20 ovn-nbctl lr-nat-add lr0 snat 172.168.0.100 10.0.0.0/24 +check ovn-nbctl --wait=hv sync lr0_dp_uuid=$(ovn-sbctl --bare --columns _uuid list datapath_binding lr0) ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip=172.168.0.120 \ logical_port=lr0-public mac="10\:54\:00\:00\:00\:03" @@ -20793,6 +20810,7 @@ OVS_WAIT_UNTIL([ ]) as hv1 ovs-ofctl dump-flows br-int table=20 | grep NXM_NX_PKT_MARK +check ovn-nbctl --wait=hv sync OVS_WAIT_UNTIL([ test 1 -eq $(as hv1 ovs-ofctl dump-flows br-int table=20 | \ @@ -20815,6 +20833,7 @@ AT_CHECK([as hv1 ovs-ofctl --protocols=OpenFlow13 add-flows br-phys flows.txt]) ip_to_hex() { printf "%02x%02x%02x%02x" "$@" } +sleep 5 send_ipv4_pkt() { local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 @@ -22363,6 +22382,7 @@ OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [1.expected]) # Delete one of the ACLs. ovn-nbctl acl-del ls1 to-lport 1001 \ 'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' +check ovn-nbctl --wait=hv sync test_ip 2 f00000000002 f00000000001 $sip $dip 1 OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [1.expected]) @@ -22375,6 +22395,7 @@ ovn-nbctl acl-add ls1 to-lport 1001 \ # Delete the ACL that has "allow" action ovn-nbctl acl-del ls1 to-lport 1001 \ 'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' +check ovn-nbctl --wait=hv sync # Packet should be dropped test_ip 2 f00000000002 f00000000001 $sip $dip @@ -22385,6 +22406,7 @@ ovn-nbctl acl-add ls1 to-lport 1001 \ 'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' allow ovn-nbctl acl-del ls1 to-lport 1001 \ 'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' +check ovn-nbctl --wait=hv sync # Packet should be received test_ip 2 f00000000002 f00000000001 $sip $dip 1 From patchwork Fri Oct 30 00:24:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390527 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkV5MY2z9sSf for ; Fri, 30 Oct 2020 11:25:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 4C41E86B5B; Fri, 30 Oct 2020 00:25:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R98p_dLNXc7U; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 852CA86A6C; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6C875C0859; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id BA321C0051 for ; Fri, 30 Oct 2020 00:25:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A469D867D1 for ; Fri, 30 Oct 2020 00:25:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3Jy6ETwywlPi for ; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 312C686685 for ; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id E4CC940008; Fri, 30 Oct 2020 00:24:58 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:35 -0700 Message-Id: <20201030002447.936548-4-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 04/16] tests: Improve logging in test framework. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff --- tests/ofproto-macros.at | 5 ++++- tests/ovn-macros.at | 16 ++++++++++++++-- tests/ovn.at | 10 +++++----- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index 6c4ff60e7db5..a6e89a951347 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -54,7 +54,9 @@ m4_define([PARSE_LISTENING_PORT], [OVS_WAIT_UNTIL([$2=`sed -n 's/.*0:.*: listening on port \([[0-9]]*\)$/\1/p' "$1"` && test X != X"[$]$2"])]) start_daemon () { - "$@" -vconsole:off --detach --no-chdir --pidfile --log-file + set "$@" -vconsole:off --detach --no-chdir --pidfile --log-file + echo "$@" + "$@" pidfile="$OVS_RUNDIR"/$1.pid on_exit "test -e \"$pidfile\" && kill \`cat \"$pidfile\"\`" } @@ -99,6 +101,7 @@ sim_add () { # Start ovs-vswitchd as $1 start_daemon ovs-vswitchd --enable-dummy=system -vvconn -vofproto_dpif -vunixctl + as $1 ovs-appctl vlog/disable-rate-limit vconn } # "as $1" sets the OVS_*DIR environment variables to point to $ovs_base/$1. diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index be596caf33d0..5b9c2dee6812 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -3,6 +3,8 @@ # Gracefully terminate vswitch daemons in the # specified sandbox. m4_define([OVN_CLEANUP_VSWITCH],[ + echo + echo "$1: clean up vswitch" as $1 OVS_APP_EXIT_AND_WAIT([ovs-vswitchd]) OVS_APP_EXIT_AND_WAIT([ovsdb-server]) @@ -15,6 +17,8 @@ m4_define([OVN_CLEANUP_VSWITCH],[ # as a special case, and is assumed to have ovn-controller-vtep # and ovs-vtep daemons running instead of ovn-controller. m4_define([OVN_CLEANUP_SBOX],[ + echo + echo "$1: clean up sandbox" as $1 if test "$1" = "vtep"; then OVS_APP_EXIT_AND_WAIT([ovn-controller-vtep]) @@ -33,6 +37,9 @@ m4_define([OVN_CLEANUP],[ m4_foreach([sbox], [$@], [ OVN_CLEANUP_SBOX([sbox]) ]) + + echo + echo "clean up OVN" as ovn-sb OVS_APP_EXIT_AND_WAIT([ovsdb-server]) @@ -53,6 +60,8 @@ m4_define([OVN_CLEANUP],[ # Gracefully terminate all OVN daemons, including those in the # specified sandbox instances. m4_define([OVN_CLEANUP_AZ],[ + echo + echo "$1: clean up availability zone" as $1/ovn-sb OVS_APP_EXIT_AND_WAIT([ovsdb-server]) @@ -77,6 +86,9 @@ m4_define([OVN_CLEANUP_IC],[ m4_foreach([az], [$@], [ OVN_CLEANUP_AZ([az]) ]) + + echo + echo "clean up interconnection" as ovn-ic-sb OVS_APP_EXIT_AND_WAIT([ovsdb-server]) @@ -99,7 +111,7 @@ m4_divert_push([PREPARE_TESTS]) # # Usually invoked from ovn_start. ovn_init_db () { - echo "creating $1 database" + echo "${AZ:+$AZ: }creating $1 database" local as_d=$1 if test -n "$2"; then as_d=$2/$as_d @@ -108,7 +120,7 @@ ovn_init_db () { mkdir "$d" || return 1 : > "$d"/.$1.db.~lock~ as $as_d ovsdb-tool create "$d"/$1.db "$abs_top_srcdir"/$1.ovsschema - as $as_d start_daemon ovsdb-server --remote=punix:"$d"/$1.sock "$d"/$1.db + as $as_d start_daemon ovsdb-server -vjsonrpc --remote=punix:"$d"/$1.sock "$d"/$1.db local var=`echo $1_db | tr a-z- A-Z_` AS_VAR_SET([$var], [unix:"$d"/$1.sock]); export $var } diff --git a/tests/ovn.at b/tests/ovn.at index 912f84c25dbb..93436de4f027 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -12,7 +12,7 @@ m4_divert_text([PREPARE_TESTS], [ovn_check_packets__ () { echo - echo "checking packets in $1 against $2:" + echo "$3: checking packets in $1 against $2:" rcv_pcap=$1 rcv_text=`echo "$rcv_pcap.packets" | sed 's/\.pcap//'` exp_text=$2 @@ -25,7 +25,7 @@ m4_divert_text([PREPARE_TESTS], sort $exp_text > expout } ovn_check_packets_remove_broadcast__ () { - echo "checking packets in $1 against $2:" + echo "$3: checking packets in $1 against $2:" rcv_pcap=$1 rcv_text=`echo "$rcv_pcap.packets" | sed 's/\.pcap//'` exp_text=$2 @@ -41,15 +41,15 @@ m4_divert_text([PREPARE_TESTS], ]) m4_define([OVN_CHECK_PACKETS], - [ovn_check_packets__ "$1" "$2" + [ovn_check_packets__ "$1" "$2" "__file__:__line__" AT_CHECK([sort $rcv_text], [0], [expout])]) m4_define([OVN_CHECK_PACKETS_REMOVE_BROADCAST], - [ovn_check_packets_remove_broadcast__ "$1" "$2" + [ovn_check_packets_remove_broadcast__ "$1" "$2" "__file__:__line__" AT_CHECK([sort $rcv_text], [0], [expout])]) m4_define([OVN_CHECK_PACKETS_CONTAIN], - [ovn_check_packets__ "$1" "$2" + [ovn_check_packets__ "$1" "$2" "__file__:__line__" AT_CHECK([sort $rcv_text | comm --nocheck-order -2 -3 expout -], [0], [])]) AT_BANNER([OVN components]) From patchwork Fri Oct 30 00:24:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390529 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkb559bz9sSf for ; Fri, 30 Oct 2020 11:25:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id D120987565; Fri, 30 Oct 2020 00:25:07 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JxaXtU8p7GuD; Fri, 30 Oct 2020 00:25:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 4BAB5874DC; Fri, 30 Oct 2020 00:25:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 1CA42C1AD4; Fri, 30 Oct 2020 00:25:05 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 11790C0051 for ; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id F3AB086A6C for ; Fri, 30 Oct 2020 00:25:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id toxLZ3eL2WYa for ; Fri, 30 Oct 2020 00:25:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id CADD98641E for ; Fri, 30 Oct 2020 00:25:02 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 439B940002; Fri, 30 Oct 2020 00:24:59 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:36 -0700 Message-Id: <20201030002447.936548-5-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 05/16] tests: Comment out pointless bits of "1 LR with HA distributed..." test. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" It would be even better to actually fix these so that they are correct, but I don't entirely understand what's going on. Signed-off-by: Ben Pfaff --- tests/ovn.at | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index 93436de4f027..2d19f07725eb 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -11842,9 +11842,18 @@ OVS_WAIT_UNTIL([as gw2 ovs-ofctl dump-flows br-int table=9 | grep arp_tpa=192.16 ]]) # check that the chassis redirect port has been claimed by the gw1 chassis -OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \ -logical_port=cr-outside | grep $gw1_chassis | wc -l], [0],[[1 -]]) +# +# 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 @@ -11875,9 +11884,18 @@ grep active_backup | grep slaves:$hv2_gw2_ofport,$hv2_gw1_ofport \ ]) # check that the chassis redirect port has been reclaimed by the gw2 chassis -OVS_WAIT_UNTIL([ovn-sbctl --columns chassis --bare find Port_Binding \ -logical_port=cr-outside | grep $gw2_chassis | wc -l], [0],[[1 -]]) +# +# 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 # check BFD enablement on tunnel ports from gw1 ######### as gw1 From patchwork Fri Oct 30 00:24:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkh1n6Vz9sSf for ; Fri, 30 Oct 2020 11:25:16 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CF35D87542; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LivGghxJYfEL; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 394D687518; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 21732C0859; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2F9CFC1AD4 for ; Fri, 30 Oct 2020 00:25:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 218B222FEE for ; Fri, 30 Oct 2020 00:25:09 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6WMP-6fC5YKK for ; Fri, 30 Oct 2020 00:25:05 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by silver.osuosl.org (Postfix) with ESMTPS id E0D4022925 for ; Fri, 30 Oct 2020 00:25:03 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 9502E40005; Fri, 30 Oct 2020 00:25:01 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:37 -0700 Message-Id: <20201030002447.936548-6-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 06/16] tests: Remove incorrect check in "ovn -- external logical port" X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This check passed because it checked the exit status of "wc -l", which always succeeds. It meant to check what "wc -l" output, but if it's fixed to do that, then the test fails because it's checking something that's wrong. Thus, this commit just removes the check. Signed-off-by: Ben Pfaff --- tests/ovn.at | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index 2d19f07725eb..2d760cf6c06c 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -14518,11 +14518,6 @@ ovn-nbctl ha-chassis-group-add-chassis hagrp1 hv1 30 hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name="hagrp1"` -# There should be 1 HA_Chassis rows with chassis sets -OVS_WAIT_UNTIL([ovn-sbctl list ha_chassis | grep chassis | awk '{print $3}' \ -| grep '-' | wc -l ], [0], [1 -]) - as hv1 ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 From patchwork Fri Oct 30 00:24:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390531 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkj3j5Xz9sSn for ; Fri, 30 Oct 2020 11:25:17 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 0ED0686B3A; Fri, 30 Oct 2020 00:25:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vKwGc3Tz5Pc4; Fri, 30 Oct 2020 00:25:13 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 2811386A04; Fri, 30 Oct 2020 00:25:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id E0AD8C0051; Fri, 30 Oct 2020 00:25:09 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 789E1C0051 for ; Fri, 30 Oct 2020 00:25:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 68A1886B4F for ; Fri, 30 Oct 2020 00:25:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ChEH3dGafFK7 for ; Fri, 30 Oct 2020 00:25:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 3A1FF86B54 for ; Fri, 30 Oct 2020 00:25:05 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id ED4F640007; Fri, 30 Oct 2020 00:25:02 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:38 -0700 Message-Id: <20201030002447.936548-7-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 07/16] tests: Remove broken "dhcpv4 : 1 HV, 2 LS, 2 LSP/LS" bits. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" These calls to test_dhcp in the "ovn -- dhcpv4 : 1 HV, 2 LS, 2 LSPs/LS" test passed bad arguments that just caused errors in the shell function and didn't do anything useful. I guess that's probably why the checks for their results were commented out. Signed-off-by: Ben Pfaff --- tests/ovn.at | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index 2d760cf6c06c..a15840b3e429 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -5569,23 +5569,9 @@ reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected rm -f 2.expected -# Send DHCPv4 packet on ls2-lp1. It doesn't have any DHCPv4 options defined. -# ls2-lp2 (vif4-tx.pcap) should receive the DHCPv4 request packet once. - -ciaddr=`ip_to_hex 0 0 0 0` -test_dhcp 3 f00000000003 01 0 $ciaddr 0 0 0 4 0 - -# Send DHCPv4 packet on ls2-lp2. "router" DHCPv4 option is not defined for -# this lport. -ciaddr=`ip_to_hex 0 0 0 0` -test_dhcp 4 f00000000004 01 0 $ciaddr 0 0 0 3 0 - # NXT_RESUMEs should be 4. OVS_WAIT_UNTIL([test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [3.expected]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [4.expected]) - # Send DHCPREQUEST in the RENEWING/REBINDING state with ip4.src set to 10.0.0.6 # and ip4.dst set to 10.0.0.1. offer_ip=`ip_to_hex 10 0 0 6` From patchwork Fri Oct 30 00:24:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390537 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjl81xnRz9sSf for ; Fri, 30 Oct 2020 11:25:40 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id CB51086C4F; Fri, 30 Oct 2020 00:25:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id x20H6yphr3Cx; Fri, 30 Oct 2020 00:25:36 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 38AEC86D19; Fri, 30 Oct 2020 00:25:27 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 06FD0C1DA7; Fri, 30 Oct 2020 00:25:27 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7AF4BC1D83 for ; Fri, 30 Oct 2020 00:25:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7198822E94 for ; Fri, 30 Oct 2020 00:25:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yx66SIUxIGXc for ; Fri, 30 Oct 2020 00:25:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by silver.osuosl.org (Postfix) with ESMTPS id 8AC6622F05 for ; Fri, 30 Oct 2020 00:25:06 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 4A1E240003; Fri, 30 Oct 2020 00:25:04 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:39 -0700 Message-Id: <20201030002447.936548-8-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 08/16] tests: Improve "ovn -- dhcpv4 : 1 HV, 2 LS, 2 LSPs/LS" test. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff --- tests/ovn.at | 60 +++++++++++++++++++++------------------------------- 1 file changed, 24 insertions(+), 36 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index a15840b3e429..c300a4477207 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -5244,64 +5244,64 @@ AT_CLEANUP AT_SETUP([ovn -- dhcpv4 : 1 HV, 2 LS, 2 LSPs/LS]) ovn_start -ovn-nbctl ls-add ls1 +check ovn-nbctl ls-add ls1 -ovn-nbctl lsp-add ls1 ls1-lp1 \ +check ovn-nbctl lsp-add ls1 ls1-lp1 \ -- lsp-set-addresses ls1-lp1 "f0:00:00:00:00:01 10.0.0.4" -ovn-nbctl lsp-set-port-security ls1-lp1 "f0:00:00:00:00:01 10.0.0.4" +check ovn-nbctl lsp-set-port-security ls1-lp1 "f0:00:00:00:00:01 10.0.0.4" -ovn-nbctl lsp-add ls1 ls1-lp2 \ +check ovn-nbctl lsp-add ls1 ls1-lp2 \ -- lsp-set-addresses ls1-lp2 "f0:00:00:00:00:02 10.0.0.6 20.0.0.4" -ovn-nbctl lsp-set-port-security ls1-lp2 "f0:00:00:00:00:02 10.0.0.6 20.0.0.4" +check ovn-nbctl lsp-set-port-security ls1-lp2 "f0:00:00:00:00:02 10.0.0.6 20.0.0.4" -ovn-nbctl ls-add ls2 -ovn-nbctl lsp-add ls2 ls2-lp1 \ +check ovn-nbctl ls-add ls2 +check ovn-nbctl lsp-add ls2 ls2-lp1 \ -- lsp-set-addresses ls2-lp1 "f0:00:00:00:00:03 30.0.0.6 40.0.0.4" -ovn-nbctl lsp-set-port-security ls2-lp1 "f0:00:00:00:00:03 30.0.0.6 40.0.0.4" -ovn-nbctl lsp-add ls2 ls2-lp2 \ +check ovn-nbctl lsp-set-port-security ls2-lp1 "f0:00:00:00:00:03 30.0.0.6 40.0.0.4" +check ovn-nbctl lsp-add ls2 ls2-lp2 \ -- lsp-set-addresses ls2-lp2 "f0:00:00:00:00:04 30.0.0.7" -ovn-nbctl lsp-set-port-security ls2-lp2 "f0:00:00:00:00:04 30.0.0.7" +check ovn-nbctl lsp-set-port-security ls2-lp2 "f0:00:00:00:00:04 30.0.0.7" d1="$(ovn-nbctl create DHCP_Options cidr=10.0.0.0/24 \ options="\"server_id\"=\"10.0.0.1\" \"server_mac\"=\"ff:10:00:00:00:01\" \ \"lease_time\"=\"3600\" \"router\"=\"10.0.0.1\"")" -ovn-nbctl lsp-set-dhcpv4-options ls1-lp1 ${d1} -ovn-nbctl lsp-set-dhcpv4-options ls1-lp2 ${d1} +check ovn-nbctl lsp-set-dhcpv4-options ls1-lp1 ${d1} +check ovn-nbctl lsp-set-dhcpv4-options ls1-lp2 ${d1} d2="$(ovn-nbctl create DHCP_Options cidr=30.0.0.0/24 \ options="\"server_id\"=\"30.0.0.1\" \"server_mac\"=\"ff:10:00:00:00:02\" \ \"lease_time\"=\"3600\"")" -ovn-nbctl lsp-set-dhcpv4-options ls2-lp2 ${d2} +check ovn-nbctl lsp-set-dhcpv4-options ls2-lp2 ${d2} net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=ls1-lp1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=ls1-lp2 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ ofport-request=2 -ovs-vsctl -- add-port br-int hv1-vif3 -- \ +check ovs-vsctl -- add-port br-int hv1-vif3 -- \ set interface hv1-vif3 external-ids:iface-id=ls2-lp1 \ options:tx_pcap=hv1/vif3-tx.pcap \ options:rxq_pcap=hv1/vif3-rx.pcap \ ofport-request=3 -ovs-vsctl -- add-port br-int hv1-vif4 -- \ +check ovs-vsctl -- add-port br-int hv1-vif4 -- \ set interface hv1-vif4 external-ids:iface-id=ls2-lp2 \ options:tx_pcap=hv1/vif4-tx.pcap \ options:rxq_pcap=hv1/vif4-rx.pcap \ @@ -5327,6 +5327,7 @@ test_dhcp() { src_ip=`ip_to_hex 0 0 0 0` dst_ip=`ip_to_hex 255 255 255 255` fi + echo "inport=$inport src_mac=$src_mac dhcp_type=$dhcp_type broadcast=$broadcast ciaddr=$ciaddr offer_ip=$offer_ip request_ip=$request_ip use_ip=$use_ip src_ip=$src_ip dst_ip=$dst_ip" if test $request_ip != 0; then if test $eth_boot != 0; then @@ -5439,16 +5440,16 @@ test_dhcp() { echo $request >> $outport.expected done fi - as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request + check as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request } reset_pcap_file() { local iface=$1 local pcap_file=$2 - ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ options:rxq_pcap=dummy-rx.pcap rm -f ${pcap_file}*.pcap - ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ options:rxq_pcap=${pcap_file}-rx.pcap } @@ -5460,21 +5461,8 @@ AT_CAPTURE_FILE([ofctl_monitor0.log]) as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \ --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log -echo "---------NB dump-----" -ovn-nbctl show -echo "---------------------" -echo "---------SB dump-----" -ovn-sbctl list datapath_binding -echo "---------------------" -ovn-sbctl list logical_flow -echo "---------------------" - -echo "---------------------" -ovn-sbctl dump-flows -echo "---------------------" - -echo "------ hv1 dump ----------" -as hv1 ovs-ofctl dump-flows br-int +AT_CAPTURE_FILE([sbflows]) +ovn-sbctl dump-flows > sbflows # Send DHCPDISCOVER. offer_ip=`ip_to_hex 10 0 0 4` From patchwork Fri Oct 30 00:24:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390532 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkn4HYsz9sSf for ; Fri, 30 Oct 2020 11:25:21 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id ABC0986C73; Fri, 30 Oct 2020 00:25:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aN_uGpzaQ-Aw; Fri, 30 Oct 2020 00:25:17 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 7C54986B0E; Fri, 30 Oct 2020 00:25:15 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 64B39C0051; Fri, 30 Oct 2020 00:25:15 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists.linuxfoundation.org (Postfix) with ESMTP id 04B4CC0859 for ; Fri, 30 Oct 2020 00:25:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E5FC186BEC for ; Fri, 30 Oct 2020 00:25:10 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pUezudl9CSkS for ; Fri, 30 Oct 2020 00:25:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by fraxinus.osuosl.org (Postfix) with ESMTPS id E3AD786B0E for ; Fri, 30 Oct 2020 00:25:07 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id A9F604000A; Fri, 30 Oct 2020 00:25:05 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:40 -0700 Message-Id: <20201030002447.936548-9-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 09/16] tests: Rewrite "nb_cfg timestamp" test. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This form makes it easier to understand and modify. Signed-off-by: Ben Pfaff --- tests/ovn.at | 84 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 65 insertions(+), 19 deletions(-) diff --git a/tests/ovn.at b/tests/ovn.at index c300a4477207..ab92d9d6ae8f 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -21972,8 +21972,8 @@ AT_CLEANUP AT_SETUP([ovn -- nb_cfg timestamp]) ovn_start -ovn-nbctl ls-add s2 -ovn-nbctl ls-add join +check ovn-nbctl ls-add s2 +check ovn-nbctl ls-add join net_add n1 @@ -21981,34 +21981,80 @@ n=10 for i in $(seq 1 $n); do sim_add hv$i as hv$i - ovs-vsctl add-br br-phys + check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.$i done -AT_FAIL_IF([test x$(ovn-nbctl get nb_global . nb_cfg_timestamp) != x0]) -ovn-nbctl --wait=hv ls-add s1 -AT_CHECK([ovn-nbctl get nb_global . nb_cfg], [0], [1 -]) -AT_CHECK([test x$(ovn-nbctl get nb_global . nb_cfg_timestamp) != x0]) -AT_CHECK([test x$(ovn-nbctl get nb_global . sb_cfg_timestamp) != x0]) -AT_CHECK([test x$(ovn-nbctl get nb_global . hv_cfg_timestamp) != x0]) +# get_cfg IDX +# +# Fetches data fields into shell variables: +# - nb_cfg into nbs$IDX +# - nb_cfg_timestamp into nbt$IDX +# - sb_cfg into sbs$IDX +# - sb_cfg_timestamp into sbt$IDX +# - hv_cfg into hvs$IDX +# - hv_cfg_timestamp into hvt$IDX +get_cfg() { + local i=$1 + set -- $(ovn-nbctl get nb_global . nb_cfg nb_cfg_timestamp sb_cfg sb_cfg_timestamp hv_cfg hv_cfg_timestamp) + AS_VAR_SET([nbs$i], [$1]) + AS_VAR_SET([nbt$i], [$2]) + AS_VAR_SET([sbs$i], [$3]) + AS_VAR_SET([sbt$i], [$4]) + AS_VAR_SET([hvs$i], [$5]) + AS_VAR_SET([hvt$i], [$6]) + if test "$i" = 1; then + printf '\n-- %s\n' "$i. *_cfg(*_cfg_timestamp): nb=$1($2) sb=$3($4) hv=$5($6)" + else + AS_VAR_ARITH([p], [$i - 1]) + AS_VAR_COPY([nbtp], [nbt$p]) + AS_VAR_COPY([sbtp], [sbt$p]) + AS_VAR_COPY([hvtp], [hvt$p]) + AS_VAR_ARITH([nbtdelta], [$2 - $nbtp]) + AS_VAR_ARITH([sbtdelta], [$4 - $sbtp]) + AS_VAR_ARITH([hvtdelta], [$6 - $hvtp]) + printf "\n-- $i. *_cfg(*_cfg_timestamp): nb=$1(%+d) sb=$3(%+d) hv=$5(%+d)\n" $nbtdelta $sbtdelta $hvtdelta + fi +} -# kill ovn-controller on chassis hv3, so that it wont update nb_cfg -as hv3 ovn-appctl -t ovn-controller exit --restart +# Check initial timestamps +get_cfg 1 +check test "$nbs1" = 0 +check test "$sbs1" = 0 +check test "$hvs1" = 0 -ovn-nbctl --timeout=1 --wait=hv sync -AT_CHECK([ovn-nbctl get nb_global . nb_cfg], [0], [2 -]) -AT_CHECK([ovn-sbctl --bare --columns=nb_cfg find chassis_private name=hv3], [0], [1 -]) +# Force a sequence number change and check the new timestamps +ovn-nbctl --wait=hv ls-add s1 +get_cfg 2 +check test "$nbs2" = 1 +check test "$nbt2" -gt 0 +check test "$sbt2" -gt 0 +check test "$hvt2" -gt 0 + +# Kill ovn-controller on chassis hv3, so that it won't update nb_cfg. +# Then wait for 9 out of 10 +sleep 1 +check as hv3 ovn-appctl -t ovn-controller exit --restart +ovn-nbctl --wait=sb sync +wait_row_count Chassis_Private 9 name!=hv3 nb_cfg=2 +check_row_count Chassis_Private 1 name=hv3 nb_cfg=1 + +get_cfg 3 +check test "$nbs3" = 2 +check test "$nbt3" -gt "$nbt2" +check test "$sbt3" -gt "$sbt2" +check test "$hvt3" -gt 0 # start ovn-controller on hv3 again, so that it will update nb_cfg with latest # timestamp (hv3 will be the slowest one). as hv3 start_daemon ovn-controller -OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns=nb_cfg find chassis_private name=hv3) == x2]) +wait_row_count Chassis_Private 1 name=hv3 nb_cfg=2 + +get_cfg 4 hv3_ts=$(ovn-sbctl --bare --columns=nb_cfg_timestamp find chassis_private name=hv3) +echo hv3_ts=$hv3_ts hv_cfg_ts=$(ovn-nbctl get nb_global . hv_cfg_timestamp) -AT_CHECK([test x$hv3_ts == x$hv_cfg_ts]) +check test "$hv3_ts" = "$hvt4" AT_CHECK([test x$(ovn-nbctl --print-wait-time --wait=sb sync | grep ms | wc -l) == x2]) AT_CHECK([test x$(ovn-nbctl --print-wait-time --wait=hv sync | grep ms | wc -l) == x3]) From patchwork Fri Oct 30 00:24:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390536 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjl71VJ6z9sSf for ; Fri, 30 Oct 2020 11:25:39 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6D8ED875FD; Fri, 30 Oct 2020 00:25:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oyiFi6MTPUF2; Fri, 30 Oct 2020 00:25:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id BE0688742C; Fri, 30 Oct 2020 00:25:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 641F2C1DCC; Fri, 30 Oct 2020 00:25:28 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4E488C0051 for ; Fri, 30 Oct 2020 00:25:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 29FB9231A1 for ; Fri, 30 Oct 2020 00:25:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vy0B-1zsvTVm for ; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by silver.osuosl.org (Postfix) with ESMTPS id 4FE7122925 for ; Fri, 30 Oct 2020 00:25:09 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 0B5B740005; Fri, 30 Oct 2020 00:25:06 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:41 -0700 Message-Id: <20201030002447.936548-10-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 10/16] tests: Improve "Load balancer health check and Service Monitor sync". X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This test wasn't very debuggable when it failed because it didn't output the full flow table. This commit improves on that. This commit also removes dependencies on southbound flow table numbers, and adds a lot of checks for various commands that didn't have them. Signed-off-by: Ben Pfaff --- tests/ovn-northd.at | 142 ++++++++++++++++++++++++-------------------- 1 file changed, 79 insertions(+), 63 deletions(-) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 90f3c8f19241..c94a175dfb3d 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -1065,16 +1065,17 @@ AT_SETUP([ovn -- check Load balancer health check and Service Monitor sync]) AT_SKIP_IF([test $HAVE_PYTHON = no]) ovn_start -ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 +check ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 -ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1 -ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1 +check ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1 +check ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1 wait_row_count Service_Monitor 0 -ovn-nbctl --wait=sb -- --id=@hc create \ +AT_CHECK([ovn-nbctl --wait=sb -- --id=@hc create \ Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \ -health_check @hc +health_check @hc | uuidfilt], [0], [<0> +]) wait_row_count Service_Monitor 0 @@ -1097,46 +1098,53 @@ wait_row_count Service_Monitor 1 ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2 wait_row_count Service_Monitor 2 -ovn-nbctl --wait=sb ls-lb-add sw0 lb1 +check ovn-nbctl --wait=sb ls-lb-add sw0 lb1 -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +AT_CAPTURE_FILE([sbflows]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows | grep 'priority=120.*ct_lb' | sed 's/table=..//'], 0, [dnl + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) ]) # Delete the Load_Balancer_Health_Check ovn-nbctl --wait=sb clear load_balancer . health_check wait_row_count Service_Monitor 0 -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +AT_CAPTURE_FILE([sbflows2]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows2 | grep 'priority=120.*ct_lb' | sed 's/table=..//'], [0], +[ (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) ]) # Create the Load_Balancer_Health_Check again. ovn-nbctl --wait=sb -- --id=@hc create \ Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \ health_check @hc - wait_row_count Service_Monitor 2 ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +AT_CHECK([cat lflows.txt | sed 's/table=..//'], [0], [dnl + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) ]) # Get the uuid of both the service_monitor -sm_sw0_p1=`ovn-sbctl --bare --columns _uuid find service_monitor logical_port=sw0-p1` -sm_sw1_p1=`ovn-sbctl --bare --columns _uuid find service_monitor logical_port=sw1-p1` +sm_sw0_p1=$(fetch_column Service_Monitor _uuid logical_port=sw0-p1) +sm_sw1_p1=$(fetch_column Service_Monitor _uuid logical_port=sw1-p1) -# Set the service monitor for sw1-p1 to offline -ovn-sbctl set service_monitor $sm_sw1_p1 status=offline +AT_CAPTURE_FILE([sbflows3]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows 3 | grep 'priority=120.*ct_lb' | sed 's/table=..//'], [0], +[ (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +]) +# Set the service monitor for sw1-p1 to offline +check ovn-sbctl set service_monitor sw1-p1 status=offline wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=offline -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80);) +AT_CAPTURE_FILE([sbflows4]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows4 | grep 'priority=120.*ct_lb' | sed 's/table=..//'], [0], +[ (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80);) ]) # Set the service monitor for sw0-p1 to offline @@ -1144,14 +1152,14 @@ ovn-sbctl set service_monitor $sm_sw0_p1 status=offline wait_row_count Service_Monitor 1 logical_port=sw0-p1 status=offline -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl -]) +AT_CAPTURE_FILE([sbflows5]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows5 | grep 'priority=120.*ct_lb'], 1) -ovn-sbctl dump-flows sw0 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" \ -| grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(drop;) +AT_CAPTURE_FILE([sbflows6]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows6 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" | grep priority=120 | sed 's/table=..//'], [0], [dnl + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(drop;) ]) # Set the service monitor for sw0-p1 and sw1-p1 to online @@ -1160,9 +1168,10 @@ ovn-sbctl set service_monitor $sm_sw1_p1 status=online wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=online -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +AT_CAPTURE_FILE([sbflows7]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows7 | grep ct_lb | grep priority=120 | sed 's/table=..//'], 0, +[ (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) ]) # Set the service monitor for sw1-p1 to error @@ -1171,18 +1180,19 @@ wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=error ovn-sbctl dump-flows sw0 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" \ | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80);) +AT_CHECK([cat lflows.txt | sed 's/table=..//'], [0], [dnl + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80);) ]) # Add one more vip to lb1 - -ovn-nbctl set load_balancer . vip:"10.0.0.40\:1000"="10.0.0.3:1000,20.0.0.3:80" +check ovn-nbctl set load_balancer . vip:10.0.0.40\\:1000=10.0.0.3:1000,20.0.0.3:80 # create health_check for new vip - 10.0.0.40 -ovn-nbctl --wait=sb -- --id=@hc create \ -Load_Balancer_Health_Check vip="10.0.0.40\:1000" -- add Load_Balancer . \ -health_check @hc +AT_CHECK( + [ovn-nbctl --wait=sb \ + -- --id=@hc create Load_Balancer_Health_Check vip=10.0.0.40\\:1000 \ + -- add Load_Balancer . health_check @hc | uuidfilt], [0], [<0> +]) # There should be totally 3 rows in service_monitor for - # * 10.0.0.3:80 @@ -1193,52 +1203,58 @@ wait_row_count Service_Monitor 3 wait_row_count Service_Monitor 2 logical_port=sw0-p1 wait_row_count Service_Monitor 1 port=1000 -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80);) - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(backends=10.0.0.3:1000);) +AT_CAPTURE_FILE([sbflows9]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows9 | grep ct_lb | grep priority=120 | sed 's/table=..//'], + 0, +[ (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80);) + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(backends=10.0.0.3:1000);) ]) # Set the service monitor for sw1-p1 to online -ovn-sbctl set service_monitor $sm_sw1_p1 status=online +check ovn-sbctl set service_monitor sw1-p1 status=online wait_row_count Service_Monitor 1 logical_port=sw1-p1 status=online -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(backends=10.0.0.3:1000,20.0.0.3:80);) +AT_CAPTURE_FILE([sbflows10]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw0 | tee sbflows10 | grep ct_lb | grep priority=120 | sed 's/table=..//'], + 0, +[ (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(backends=10.0.0.3:1000,20.0.0.3:80);) ]) # Associate lb1 to sw1 -ovn-nbctl --wait=sb ls-lb-add sw1 lb1 -ovn-sbctl dump-flows sw1 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(backends=10.0.0.3:1000,20.0.0.3:80);) +check ovn-nbctl --wait=sb ls-lb-add sw1 lb1 +AT_CAPTURE_FILE([sbflows11]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows sw1 | tee sbflows11 | grep ct_lb | grep priority=120 | sed 's/table=..//'], + 0, [dnl + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) + (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.40 && tcp.dst == 1000), action=(ct_lb(backends=10.0.0.3:1000,20.0.0.3:80);) ]) # Now create lb2 same as lb1 but udp protocol. -ovn-nbctl lb-add lb2 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 udp -lb2_uuid=`ovn-nbctl lb-list | grep udp | awk '{print $1}'` -ovn-nbctl --wait=sb set load_balancer $lb2_uuid ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2 -ovn-nbctl --wait=sb set load_balancer $lb2_uuid ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2 +check ovn-nbctl lb-add lb2 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 udp +check ovn-nbctl --wait=sb set load_balancer lb2 ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2 +check ovn-nbctl --wait=sb set load_balancer lb2 ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2 -ovn-nbctl -- --id=@hc create Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer $lb2_uuid health_check @hc +AT_CHECK([ovn-nbctl -- --id=@hc create Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer lb2 health_check @hc | uuidfilt], + [0], [<0> +]) -ovn-nbctl ls-lb-add sw0 lb2 -ovn-nbctl ls-lb-add sw1 lb2 -ovn-nbctl lr-lb-add lr0 lb2 +check ovn-nbctl ls-lb-add sw0 lb2 +check ovn-nbctl ls-lb-add sw1 lb2 wait_row_count Service_Monitor 5 # Change the svc_monitor_mac. This should get reflected in service_monitor table rows. -ovn-nbctl set NB_Global . options:svc_monitor_mac="fe:a0:65:a2:01:03" +check ovn-nbctl set NB_Global . options:svc_monitor_mac="fe:a0:65:a2:01:03" wait_row_count Service_Monitor 5 src_mac='"fe:a0:65:a2:01:03"' # Change the source ip for 10.0.0.3 backend ip in lb2 -ovn-nbctl --wait=sb set load_balancer $lb2_uuid ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.100 +check ovn-nbctl --wait=sb set load_balancer lb2 ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.100 wait_row_count Service_Monitor 1 logical_port=sw0-p1 src_ip=10.0.0.100 From patchwork Fri Oct 30 00:24:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390539 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjlF4B67z9sSf for ; Fri, 30 Oct 2020 11:25:45 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2FFC786D3E; Fri, 30 Oct 2020 00:25:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id q8LmofjfgBsi; Fri, 30 Oct 2020 00:25:40 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id E39A186C76; Fri, 30 Oct 2020 00:25:21 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B54BBC1DA6; Fri, 30 Oct 2020 00:25:21 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5C5BEC1AD9 for ; Fri, 30 Oct 2020 00:25:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 30A9386B4D for ; Fri, 30 Oct 2020 00:25:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U7Mu-l-P7P2Z for ; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id DF83E86A94 for ; Fri, 30 Oct 2020 00:25:10 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 6598040007; Fri, 30 Oct 2020 00:25:08 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:42 -0700 Message-Id: <20201030002447.936548-11-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 11/16] tests: Remove spurious check for HAVE_PYTHON. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Nothing sets this variable. Signed-off-by: Ben Pfaff --- tests/ovn-northd.at | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index c94a175dfb3d..7e2cc467e556 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -1062,7 +1062,6 @@ AT_CHECK([ovn-sbctl dump-flows CR | grep lr_in_dnat | grep "ip4.dst == 172.16.1. AT_CLEANUP AT_SETUP([ovn -- check Load balancer health check and Service Monitor sync]) -AT_SKIP_IF([test $HAVE_PYTHON = no]) ovn_start check ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 From patchwork Fri Oct 30 00:24:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjl563Dxz9sSf for ; Fri, 30 Oct 2020 11:25:37 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2D62386D0F; Fri, 30 Oct 2020 00:25:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MjmBW8pOnm39; Fri, 30 Oct 2020 00:25:32 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 72B4086C12; Fri, 30 Oct 2020 00:25:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4995BC1AE2; Fri, 30 Oct 2020 00:25:18 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id D2CF9C0859 for ; Fri, 30 Oct 2020 00:25:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BA4D38753D for ; Fri, 30 Oct 2020 00:25:13 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aRtRnoYCg2TA for ; Fri, 30 Oct 2020 00:25:12 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 7A92787512 for ; Fri, 30 Oct 2020 00:25:12 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 0208F40009; Fri, 30 Oct 2020 00:25:09 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:43 -0700 Message-Id: <20201030002447.936548-12-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 12/16] tests: Fix simple typos in tests. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff --- tests/ovn-northd.at | 4 ++-- tests/ovn.at | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 7e2cc467e556..e43d5f074f12 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -1401,7 +1401,7 @@ ovn-nbctl ls-add ls1 ovn-nbctl ls-add ls2 ovn-nbctl lsp-add ls1 lsp1 ovn-nbctl lsp-add ls2 lsp2 -ovn-nbct --wait=sb sync +ovn-nbctl --wait=sb sync ls1_key=$(ovn-sbctl --columns tunnel_key --bare list Datapath_Binding ls1) ls2_key=$(ovn-sbctl --columns tunnel_key --bare list Datapath_Binding ls2) @@ -1449,7 +1449,7 @@ ovn-nbctl ls-add ls1 ovn-nbctl ls-add ls2 ovn-nbctl lsp-add ls1 lsp1 ovn-nbctl lsp-add ls2 lsp2 -ovn-nbct --wait=sb sync +ovn-nbctl --wait=sb sync ls1_key=$(ovn-sbctl --columns tunnel_key --bare list Datapath_Binding ls1) ls2_key=$(ovn-sbctl --columns tunnel_key --bare list Datapath_Binding ls2) diff --git a/tests/ovn.at b/tests/ovn.at index ab92d9d6ae8f..7709e98eacb9 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -18803,7 +18803,7 @@ send_garp 1 1 $eth_src $eth_dst $spa $tpa OVS_WAIT_UNTIL([test 1 = `as hv1 ovs-ofctl dump-flows br-int table=67 | grep n_packets=1 | wc -l`]) # The packet should not be sent to ovn-controller. The packet -count should be 1 only. +# count should be 1 only. AT_CHECK([test 1 = `cat hv1/ovn-controller.log | grep NXT_PACKET_IN2 | wc -l`]) AT_CHECK([test 1 = `as hv1 ovs-ofctl dump-flows br-int table=10 | grep arp | \ grep controller | grep -v n_packets=0 | wc -l`]) From patchwork Fri Oct 30 00:24:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjkv0hlgz9sSf for ; Fri, 30 Oct 2020 11:25:27 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 614C586CE0; Fri, 30 Oct 2020 00:25:25 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Z7UWFzUifsvp; Fri, 30 Oct 2020 00:25:23 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 05D7286C8D; Fri, 30 Oct 2020 00:25:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id BE616C1D81; Fri, 30 Oct 2020 00:25:19 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 81992C0859 for ; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6670287502 for ; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IjjgR9iblClw for ; Fri, 30 Oct 2020 00:25:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9DA3A874E9 for ; Fri, 30 Oct 2020 00:25:13 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 6207140002; Fri, 30 Oct 2020 00:25:11 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:44 -0700 Message-Id: <20201030002447.936548-13-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 13/16] tests: Spelling fixes in test names. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Signed-off-by: Ben Pfaff --- tests/ovn-northd.at | 2 +- tests/ovn.at | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index e43d5f074f12..7ceefe04572a 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -1,5 +1,5 @@ AT_BANNER([OVN northd]) -AT_SETUP([ovn -- check from NBDB to SBDB]) +AT_SETUP([ovn -- check from NBDB to SBDB]) ovn_start ovn-nbctl create Logical_Router name=R1 diff --git a/tests/ovn.at b/tests/ovn.at index 7709e98eacb9..35f53c06f0d1 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -2610,7 +2610,7 @@ OVN_CLEANUP([hv1],[hv2]) AT_CLEANUP -AT_SETUP([ovn -- 2 HVs, 2 LS, routing works for multiple colacated segments attached to different switches]) +AT_SETUP([ovn -- 2 HVs, 2 LS, routing works for multiple collocated segments attached to different switches]) ovn_start for tag in `seq 10 30`; do @@ -13683,7 +13683,7 @@ grep conjunction.*conjunction.*conjunction | wc -l`]) OVN_CLEANUP([hv1]) AT_CLEANUP -AT_SETUP([ovn -- Superseeding ACLs with conjunction]) +AT_SETUP([ovn -- Superseding ACLs with conjunction]) ovn_start ovn-nbctl ls-add ls1 From patchwork Fri Oct 30 00:24:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390541 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjlX6VQ0z9sSf for ; Fri, 30 Oct 2020 11:26:00 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 77BFE8764F; Fri, 30 Oct 2020 00:25:59 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YaWk8SC1s-75; Fri, 30 Oct 2020 00:25:54 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 907B6875CB; Fri, 30 Oct 2020 00:25:36 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 6D560C1D8B; Fri, 30 Oct 2020 00:25:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B594CC1D84 for ; Fri, 30 Oct 2020 00:25:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9BFAE86D0F for ; Fri, 30 Oct 2020 00:25:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6sqgamNC7CUH for ; Fri, 30 Oct 2020 00:25:27 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 092BF86B10 for ; Fri, 30 Oct 2020 00:25:14 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B89B340005; Fri, 30 Oct 2020 00:25:12 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:45 -0700 Message-Id: <20201030002447.936548-14-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 14/16] tests: Factor out ip_to_hex() common function. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" There was way too much copypasta of this function. The common implementation is more flexible, too. Signed-off-by: Ben Pfaff --- tests/automake.mk | 1 + tests/network-functions.at | 18 ++++ tests/ovn.at | 195 ------------------------------------- tests/testsuite.at | 1 + 4 files changed, 20 insertions(+), 195 deletions(-) create mode 100644 tests/network-functions.at diff --git a/tests/automake.mk b/tests/automake.mk index 26b6d11b491a..b363928fd73d 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -20,6 +20,7 @@ COMMON_MACROS_AT = \ TESTSUITE_AT = \ tests/testsuite.at \ tests/checkpatch.at \ + tests/network-functions.at \ tests/ovn.at \ tests/ovn-northd.at \ tests/ovn-nbctl.at \ diff --git a/tests/network-functions.at b/tests/network-functions.at new file mode 100644 index 000000000000..79aa4d899d88 --- /dev/null +++ b/tests/network-functions.at @@ -0,0 +1,18 @@ +AT_BANNER([test library internal helpers]) + +OVS_START_SHELL_HELPERS +# ip_to_hex 192 168 0 1 -> c0a80001 +# ip_to_hex 192.168.0.1 -> c0a80001 +ip_to_hex() { + if test $# = 1; then + set $(echo $1 | sed 's/\./ /g') + fi + printf "%02x%02x%02x%02x" "$@" +} +OVS_END_SHELL_HELPERS + +AT_SETUP([ip_to_hex]) +AT_KEYWORDS([network-functions]) +AT_CHECK([ip_to_hex 192 168 0 1], [0], [c0a80001]) +AT_CHECK([ip_to_hex 192.168.0.1], [0], [c0a80001]) +AT_CLEANUP diff --git a/tests/ovn.at b/tests/ovn.at index 35f53c06f0d1..245a6feb202b 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -1860,10 +1860,6 @@ test_arp() { fi } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send packets between all pairs of source and destination ports: # # 1. Unicast packets are delivered to exactly one logical switch port @@ -2136,10 +2132,6 @@ test_packet() { done } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send packets between all pairs of source and destination ports: # # 1. Unicast packets are delivered to exactly one logical switch port @@ -3260,9 +3252,6 @@ done # ARP request should not be responded to by logical switch router # type arp responder on HV1 and HV2 and should reach directly to # vif1 and vif2 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} sha=f00000000003 spa=`ip_to_hex 192 168 1 2` tpa=`ip_to_hex 192 168 1 1` @@ -3664,9 +3653,6 @@ as hv1 ovs-ofctl dump-flows br-int # # 2. Broadcast IP packets are delivered to all logical switch ports # except the input port. -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} for is in 1 2 3; do for js in 1 2 3; do for ks in 1 2 3; do @@ -4027,10 +4013,6 @@ test_arp() { fi } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # lp11 send GARP request to announce ownership of 192.168.1.100. sha=f00000000011 @@ -4233,10 +4215,6 @@ test_icmpv6() { done } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # no port security sip=`ip_to_hex 192 168 0 12` tip=`ip_to_hex 192 168 0 13` @@ -4684,9 +4662,6 @@ ovs-vsctl -- add-port br-int vif2 -- \ sleep 1 # Send ip packets between the two ports. -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} # Packet to send. src_mac="f00000010203" @@ -4801,9 +4776,6 @@ ovs-vsctl -- add-port br-int vif2 -- \ sleep 1 # Send ip packets between the two ports. -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} # Packet to send. src_mac="f00000010203" @@ -4951,10 +4923,6 @@ OVN_POPULATE_ARP # XXX This should be more systematic. sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send ip packets between foo1 and alice1 src_mac="f00000010203" dst_mac="000000010203" @@ -5174,10 +5142,6 @@ OVN_POPULATE_ARP # XXX This should be more systematic. sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send ip packets between foo1 and alice1 src_mac="f00000010203" dst_mac="000001010203" @@ -5453,10 +5417,6 @@ options:rxq_pcap=dummy-rx.pcap options:rxq_pcap=${pcap_file}-rx.pcap } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - AT_CAPTURE_FILE([ofctl_monitor0.log]) as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \ --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log @@ -6307,10 +6267,6 @@ ovn-nbctl lsp-add alice alice1 \ # XXX This should be more systematic. sleep 2 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send ip packets between foo1 and alice1 src_mac="f00000010203" dst_mac="000001010203" @@ -6448,9 +6404,6 @@ ovs-vsctl -- add-port br-int vif2 -- \ sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} for i in 1 2; do : > vif$i.expected done @@ -7605,10 +7558,6 @@ ovs-vsctl -- add-port br-int hv1-vif3 -- \ # XXX This should be more systematic. sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send ip packets between foo1 and foo2 src_mac="0a0000a80103" dst_mac="0a0000a80104" @@ -7841,10 +7790,6 @@ as hv1 ovs-ofctl dump-flows echo "---------------------" -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - src_mac="f00000000003" dst_mac="f00000000001" src_ip=`ip_to_hex 192 168 0 2` @@ -8928,10 +8873,6 @@ OVN_POPULATE_ARP # XXX This should be more systematic. sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Test that ovn-controllers create ct-zone entry for container ports. foo1_zoneid=$(as hv1 ovs-vsctl get bridge br-int external_ids:ct-zone-foo1) AT_CHECK([test ! -z $foo1_zoneid]) @@ -9239,9 +9180,6 @@ OVN_POPULATE_ARP # XXX This should be more systematic. sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} trim_zeros() { sed 's/\(00\)\{1,\}$//' } @@ -9354,10 +9292,6 @@ echo "*************************" ovn-sbctl list DNS echo "*************************" -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - reset_pcap_file() { local iface=$1 local pcap_file=$2 @@ -9845,9 +9779,6 @@ AT_CHECK([ovn-nbctl --timeout=3 --wait=sb sync], [0], [ignore]) # Allow some time for ovn-northd and ovn-controller to catch up. ovn-nbctl --wait=hv sync -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} reset_pcap_file() { local iface=$1 @@ -10095,10 +10026,6 @@ wait_column "$hv1_ch_uuid" HA_Chassis_Group ref_chassis # XXX This should be more systematic. sleep 2 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - reset_pcap_file() { local iface=$1 local pcap_file=$2 @@ -10343,9 +10270,6 @@ AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep arp | grep load:0x2- | grep ]) -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} : > hv2-vif1.expected @@ -10837,10 +10761,6 @@ for chassis in hv1 hv2 hv3; do echo "--------------------------" done -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - foo1_ip=$(ip_to_hex 192 168 1 2) gw_ip=$(ip_to_hex 172 16 1 6) dst_ip=$(ip_to_hex 8 8 8 8) @@ -11289,10 +11209,6 @@ OVN_POPULATE_ARP # XXX This should be more systematic. sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send ip packets between foo1 and alice1 src_mac="f00000010203" dst_mac="000000010203" @@ -12860,10 +12776,6 @@ OVN_POPULATE_ARP # allow some time for ovn-northd and ovn-controller to catch up. sleep 1 -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - for i in 1 2 3; do : > vif${i}1.expected done @@ -13067,9 +12979,6 @@ as hv1 ovs-ofctl dump-flows br-int # Send IP packets between all pairs of source and destination ports, # packets matches ACL (pg2 to pg1) should be dropped -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} for is in 1 2 3; do for js in 1 2 3; do for ks in 1 2 3; do @@ -13307,9 +13216,6 @@ as hv1 ovs-ofctl dump-flows br-int # Send IP packets between all pairs of source and destination ports, # packets matches ACL1 but not ACL2 should be dropped -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} for is in 1 2 3; do for js in 1 2 3; do for ks in 1 2 3; do @@ -13530,10 +13436,6 @@ ${dst_ip}0035111100080000 done } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - reset_pcap_file() { local iface=$1 local pcap_file=$2 @@ -13732,10 +13634,6 @@ ${dst_ip}0035111100080000 done } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - reset_pcap_file() { local iface=$1 local pcap_file=$2 @@ -14155,10 +14053,6 @@ test_ip6_packet() { as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - for i in 1 2; do net_add n$i ovn-nbctl ls-add sw$i @@ -14300,10 +14194,6 @@ test_ip6_packet() { as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - for i in 1 2; do net_add n$i ovn-nbctl ls-add sw$i @@ -14784,10 +14674,6 @@ options:rxq_pcap=dummy-rx.pcap options:rxq_pcap=${pcap_file}-rx.pcap } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - AT_CAPTURE_FILE([ofctl_monitor0_hv1.log]) as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \ --pidfile=ovs-ofctl0.pid 2> ofctl_monitor0_hv1.log @@ -15469,10 +15355,6 @@ reset_pcap_file() { options:rxq_pcap=${pcap_file}-rx.pcap } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - test_ip_packet_larger() { local icmp_pmtu_reply_expected=$1 @@ -15750,9 +15632,6 @@ ovn-nbctl lr-nat-add lr0 snat 2002::1 2001::/64 OVN_POPULATE_ARP ovn-nbctl --wait=hv sync -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} src_mac=f00000010203 src_ip=$(ip_to_hex 192 168 1 2) @@ -16210,10 +16089,6 @@ lrp_to_lrp_mac () { esac } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - net_add n1 for i in 1 2; do sim_add hv$i @@ -16445,10 +16320,6 @@ AT_CHECK([cat lflows.txt], [0], [dnl table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 00:00:00:00:00:00; next;) ]) -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"` hv2_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv2"` @@ -16847,10 +16718,6 @@ options:rxq_pcap=dummy-rx.pcap options:rxq_pcap=${pcap_file}-rx.pcap } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # # send_igmp_v3_report INPORT HV ETH_SRC IP_SRC IP_CSUM GROUP REC_TYPE # IGMP_CSUM OUTFILE @@ -18438,10 +18305,6 @@ m4_define([DVR_N_S_PING], esac } - ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" - } - net_add n1 for i in 1 2; do sim_add hv$i @@ -18579,11 +18442,6 @@ m4_define([DVR_N_S_PING], echo router-to-`vif_to_ls ${1}` } - ip_to_hex() { - printf "%02x%02x%02x%02x" "${@}" - } - - test_ip() { # This packet has bad checksums but logical L3 routing doesn't check. local inport=${1} src_mac=${2} dst_mac=${3} src_ip=${4} dst_ip=${5} outport=${6} @@ -18761,10 +18619,6 @@ ovn-nbctl --wait=hv sync as hv1 ovs-appctl -t ovn-controller vlog/set dbg -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # From sw0-p1 send GARP for 10.0.0.30. # ovn-controller should learn the # mac_binding entry @@ -18922,10 +18776,6 @@ ovn-nbctl lsp-set-addresses ln1 unknown ovn-nbctl lsp-set-type ln1 localnet ovn-nbctl lsp-set-options ln1 network_name=phys -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - net_add n1 sim_add hv1 @@ -19035,10 +18885,6 @@ vif_to_hv () { esac } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - net_add n1 for i in 1 2; do sim_add hv$i @@ -19177,11 +19023,6 @@ vif_to_lrp () { echo router-to-`vif_to_ls $1` } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - - test_ip() { # This packet has bad checksums but logical L3 routing doesn't check. local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 outport=$6 @@ -19594,10 +19435,6 @@ AT_CLEANUP AT_SETUP([ovn -- ARP/ND request broadcast limiting]) ovn_start -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - send_arp_request() { local hv=$1 inport=$2 eth_src=$3 spa=$4 tpa=$5 local eth_dst=ffffffffffff @@ -20465,10 +20302,6 @@ options:rxq_pcap=dummy-rx.pcap options:rxq_pcap=${pcap_file}-rx.pcap } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - build_udp() { local sport=$1 dport=$2 chksum=$3 local len=000a @@ -20816,10 +20649,6 @@ table=0, priority=100, pkt_mark=0xffffffff actions=drop ]) AT_CHECK([as hv1 ovs-ofctl --protocols=OpenFlow13 add-flows br-phys flows.txt]) - -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} sleep 5 send_ipv4_pkt() { @@ -21356,10 +21185,6 @@ test_arp() { fi } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - sw0p1_ip=$(ip_to_hex 192 168 1 2) rtr_ip=$(ip_to_hex 192 168 1 1) test_arp 1 1 000000010102 $sw0p1_ip $rtr_ip 000000000001 @@ -21679,10 +21504,6 @@ ovn-nbctl --wait=hv sync AT_CHECK([ovn-sbctl lflow-list | grep lr_in_arp_resolve | grep 10.0.0.1], [1], []) AT_CHECK([ovn-sbctl lflow-list | grep lr_in_arp_resolve | grep 10.0.0.2], [1], []) -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send ip packets from p1 to p2 src_mac="f00000000102" dst_mac="000000000101" @@ -21921,10 +21742,6 @@ sw_key=$(ovn-sbctl --bare --columns tunnel_key list datapath_binding r1) AT_CHECK([ovn-sbctl lflow-list | grep lr_in_arp_resolve | grep 10.0.1.1], [1], []) -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - # Send ip packets from p1 to lrp-r1-s1 src_mac="f00000000102" dst_mac="000000000101" @@ -22227,10 +22044,6 @@ options:rxq_pcap=dummy-rx.pcap options:rxq_pcap=${pcap_file}-rx.pcap } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - send_arp_request() { local eth_src=$1 spa=$2 tpa=$3 local eth_dst=ffffffffffff @@ -22384,10 +22197,6 @@ ${dst_ip}0035111100080000 done } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - reset_pcap_file() { local iface=$1 local pcap_file=$2 @@ -22504,10 +22313,6 @@ ${dst_ip}0035111100080000 done } -ip_to_hex() { - printf "%02x%02x%02x%02x" "$@" -} - reset_pcap_file() { local iface=$1 local pcap_file=$2 diff --git a/tests/testsuite.at b/tests/testsuite.at index 1985923d5bc5..960227dcc75f 100644 --- a/tests/testsuite.at +++ b/tests/testsuite.at @@ -20,6 +20,7 @@ m4_include([tests/ovs-macros.at]) m4_include([tests/ovsdb-macros.at]) m4_include([tests/ofproto-macros.at]) m4_include([tests/ovn-macros.at]) +m4_include([tests/network-functions.at]) m4_include([tests/ovn.at]) m4_include([tests/ovn-performance.at]) From patchwork Fri Oct 30 00:24:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390544 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjmp6ssmz9sSf for ; Fri, 30 Oct 2020 11:27:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 8415F23077; Fri, 30 Oct 2020 00:27:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ui4aRPTafnii; Fri, 30 Oct 2020 00:26:56 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 967BC2E1C0; Fri, 30 Oct 2020 00:25:39 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 76C0FC1AE0; Fri, 30 Oct 2020 00:25:39 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B9DBCC1AD7 for ; Fri, 30 Oct 2020 00:25:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A179F86D13 for ; Fri, 30 Oct 2020 00:25:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZTP+dGY2lWG6 for ; Fri, 30 Oct 2020 00:25:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5ED9C86A04 for ; Fri, 30 Oct 2020 00:25:16 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 1F32440008; Fri, 30 Oct 2020 00:25:13 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:46 -0700 Message-Id: <20201030002447.936548-15-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 15/16] tests: Add some more network helper functions. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" These aren't used much yet. Signed-off-by: Ben Pfaff --- tests/network-functions.at | 151 +++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/tests/network-functions.at b/tests/network-functions.at index 79aa4d899d88..a149e9da4c58 100644 --- a/tests/network-functions.at +++ b/tests/network-functions.at @@ -16,3 +16,154 @@ AT_KEYWORDS([network-functions]) AT_CHECK([ip_to_hex 192 168 0 1], [0], [c0a80001]) AT_CHECK([ip_to_hex 192.168.0.1], [0], [c0a80001]) AT_CLEANUP + +OVS_START_SHELL_HELPERS +# ip_csum WORDS +# +# Calculates the IP checksum of the provided 16-bit words, which +# should be provided as a sequence of hex digits (a multiple of 4 +# digits in length). Prints the checksum on stdout as 4 hex digits. +ip_csum() { + local csum=0 + while test -n "$1"; do + local head=$(expr "$1" : '\(....\)') + csum=$(expr $csum + $(printf %u 0x$head)) + set -- "${1##????}" + done + while test $csum -gt 65535; do + local a=$(expr $csum / 65536) + local b=$(expr $csum % 65536) + csum=$(expr $a + $b) + done + csum=$(expr 65535 - $csum) + printf "%04x" $csum +} +OVS_END_SHELL_HELPERS + +AT_SETUP([ip_csum]) +AT_KEYWORDS([network-functions]) +test_csum() { + AT_CHECK_UNQUOTED([ip_csum $1], [0], [$2]) +} +test_csum 4500003c1c4640004006b1e600000a63ac100a0c ac10 +test_csum 4500003c1c4640004006b1e6ac100a63ac100a0c 0000 +test_csum 4500007600000000400100000a000003aca80003 c3d9 +test_csum 45000076000000004001c3d90a000003aca80003 0000 +AT_CLEANUP + +OVS_START_SHELL_HELPERS +# ip6_pseudoheader IP6_HEADER NEXT_HEADER PAYLOAD_LEN +# +# where: +# IP6_HEADER is the 40-byte IPv6 header as 80 hex digits +# NEXT_HEADER is Next Header in the pseudoheader as 2 hex digits +# PAYLOAD_LEN is the length of everything that follows the IPv6 +# header, as a decimal count of bytes +ip6_pseudoheader() { + local ip6_srcdst=$(expr "$1" : '................\(................................................................\)') + local len=$(printf "%08x" $3) + printf %s "${ip6_srcdst}${len}000000$2" +} +OVS_END_SHELL_HELPERS + +AT_SETUP([ip6_pseudoheader]) +AT_KEYWORDS([network-functions]) +AT_CHECK([ip6_pseudoheader 6000000000203aff''fe8000000000000088c57541aa0c58ee''ff020000000000000000000000000001 3a 32], + [0], + [fe8000000000000088c57541aa0c58eeff020000000000000000000000000001000000200000003a]) +AT_CLEANUP + +OVS_START_SHELL_HELPERS +# icmp6_csum ICMP6_AND_PAYLOAD IP6HEADER +# +# Outputs the checksum for ICMP6_AND_PAYLOAD given that it is inside +# IP6HEADER. Both arguments must be given as hex digits. +icmp6_csum() { + local payload_len=$(expr ${#1} / 2) + ip_csum $(ip6_pseudoheader "$2" 3a $payload_len)$1 +} +# icmp6_csum_inplace ICMP6_AND_PAYLOAD IP6HEADER +# +# Outputs ICMP6_AND_PAYLOAD with the checksum filled in properly. +icmp6_csum_inplace() { + local csum=$(icmp6_csum "$@") + echo "$1" | sed "s/^\(....\)..../\1$csum/" +} +OVS_END_SHELL_HELPERS + +AT_SETUP([icmp6_csum]) +AT_KEYWORDS([network-functions]) +ipv6_src=10000000000000000000000000000003 +ipv6_dst=20000000000000000000000000000002 +payload=0000000000000000000000000000000000000000 # 20 0-bytes +payload=${payload}${payload} # 40 0-bytes +payload=${payload}${payload} # 80 0-bytes +ip6=6000000000583afe${ipv6_src}${ipv6_dst} +AT_CHECK([icmp6_csum 8000000062f00001${payload} $ip6], [0], [ec76]) +AT_CHECK([icmp6_csum 8000ec7662f00001${payload} $ip6], [0], [0000]) +AT_CHECK_UNQUOTED([icmp6_csum_inplace 8000000062f00001${payload} $ip6], [0], + [8000ec7662f00001${payload} +]) +AT_CLEANUP + +OVS_START_SHELL_HELPERS +# hex_to_binary HEXDIGITS +# +# Converts the pairs of HEXDIGITS into bytes and prints them on stdout. +hex_to_binary() { + printf $(while test -n "$1"; do + printf '\\%03o' 0x$(expr "$1" : '\(..\)') + set -- "${1##??}" + done) +} + +# tcpdump_hex TITLE PACKET +# +# Passes PACKET, expressed as pairs of hex digits, to tcpdump, +# printing "TITLE: " as a prefix. +# +if test $HAVE_TCPDUMP = yes; then + tcpdump_hex() { + if test $# -gt 1; then + printf "%s: " "$1" + shift + fi + + local pkt_len=$(expr ${#1} / 2) + (# File header + hex_to_binary a1b2c3d4 # magic number + printf '\0\2' # major version 2 + printf '\0\4' # minor version 4 + printf '\0\0\0\0' # GMT to local correction + printf '\0\0\0\0' # sigfigs + printf '\0\0\5\356' # snaplen 1518 + printf '\0\0\0\1' # Ethernet data link type + + # Packet header + printf '\0\0\0\0' # timestamp seconds + printf '\0\0\0\0' # timestamp subseconds + hex_to_binary $(printf "%08x" $pkt_len) # incl_len + hex_to_binary $(printf "%08x" $pkt_len) # orig_len + + # Packet + hex_to_binary $1 + ) | tcpdump -vvvve -n -t -r- 2>&1 | grep -v 'reading from file -' + } +else + tcpdump_hex() { + if test $# -gt 1; then + printf "%s: " "$1" + shift + fi + echo "(cannot print packet because tcpdump is not installed)" + } +fi +OVS_END_SHELL_HELPERS + +AT_SETUP([tcpdump_hex]) +AT_KEYWORDS([network-functions]) +AT_SKIP_IF([test $HAVE_TCPDUMP = no]) +AT_CHECK([tcpdump_hex title ffffffffffff0011223344550800], [0], [stdout]) +AT_CHECK([grep 'title:' stdout], [0], [ignore]) +AT_CHECK([grep '00:11:22:33:44:55' stdout], [0], [ignore]) +AT_CLEANUP From patchwork Fri Oct 30 00:24:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 1390546 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ovn.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMjrF16M7z9sPB for ; Fri, 30 Oct 2020 11:30:05 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 7EE9A853F8; Fri, 30 Oct 2020 00:30:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1WjnpSHvuKPY; Fri, 30 Oct 2020 00:28:43 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 4443586AAB; Fri, 30 Oct 2020 00:27:24 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 12459C1AD9; Fri, 30 Oct 2020 00:27:24 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3EC4BC0051 for ; Fri, 30 Oct 2020 00:27:22 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1849222C44 for ; Fri, 30 Oct 2020 00:27:22 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cOblUhxVVTmB for ; Fri, 30 Oct 2020 00:25:46 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by silver.osuosl.org (Postfix) with ESMTPS id 40CBB2291D for ; Fri, 30 Oct 2020 00:25:18 +0000 (UTC) X-Originating-IP: 75.54.222.30 Received: from sigfpe.attlocal.net (75-54-222-30.lightspeed.rdcyca.sbcglobal.net [75.54.222.30]) (Authenticated sender: blp@ovn.org) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 83AD640002; Fri, 30 Oct 2020 00:25:15 +0000 (UTC) From: Ben Pfaff To: dev@openvswitch.org Date: Thu, 29 Oct 2020 17:24:47 -0700 Message-Id: <20201030002447.936548-16-blp@ovn.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201030002447.936548-1-blp@ovn.org> References: <20201030002447.936548-1-blp@ovn.org> MIME-Version: 1.0 Cc: Ben Pfaff Subject: [ovs-dev] [PATCH ovn 16/16] tests: Miscellaneous improvements. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" - Add "check" to a lot of commands, to ensure that they succeed. - Dump flows to files instead of to stdout, to make them easier to compare between different runs. - Compare all the packets that should be sent for a given run, rather than just comparing them for a single interface. This gives a better overview on failure (did everything fail? or just one packet for a given interface?) - Better comments and log messages. Signed-off-by: Ben Pfaff --- tests/ovn-northd.at | 284 +++--- tests/ovn.at | 2308 ++++++++++++++++++++++++------------------- 2 files changed, 1425 insertions(+), 1167 deletions(-) diff --git a/tests/ovn-northd.at b/tests/ovn-northd.at index 7ceefe04572a..ae845e4eafd4 100644 --- a/tests/ovn-northd.at +++ b/tests/ovn-northd.at @@ -280,22 +280,22 @@ AT_CLEANUP AT_SETUP([ovn -- check HA_Chassis_Group propagation from NBDB to SBDB]) ovn_start -ovn-nbctl --wait=sb ha-chassis-group-add hagrp1 +check ovn-nbctl --wait=sb ha-chassis-group-add hagrp1 # ovn-northd should not create HA chassis group and HA chassis rows # unless the HA chassis group in OVN NB DB is associated to # a logical router port or logical port of type external. check_row_count HA_Chassis_Group 0 name=hagrp1 -ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30 -ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20 -ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10 +check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30 +check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20 +check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10 # There should be no HA_Chassis rows in SB DB. check_row_count HA_Chassis 0 # Add chassis ch1. -ovn-sbctl chassis-add ch1 geneve 127.0.0.2 +check ovn-sbctl chassis-add ch1 geneve 127.0.0.2 wait_row_count Chassis 1 name=ch1 @@ -303,16 +303,21 @@ wait_row_count Chassis 1 name=ch1 check_row_count HA_Chassis 0 # Create a logical router port and attach ha chassis group. -ovn-nbctl lr-add lr0 +check ovn-nbctl lr-add lr0 check ovn-nbctl --wait=sb lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 hagrp1_uuid=`ovn-nbctl --bare --columns _uuid find ha_chassis_group name=hagrp1` +echo "hagrp1_uuid=$hagrp1_uuid" check ovn-nbctl --wait=sb set logical_router_port lr0-public ha_chassis_group=$hagrp1_uuid wait_row_count HA_Chassis_Group 1 name=hagrp1 check_row_count HA_Chassis 3 +# ovn-northd has a weird history regarding HA_Chassis and missing +# Chassis records, see commit f879850b5f2c ("ovn-northd: Fix the +# HA_Chassis sync issue in OVN SB DB"). +# # Make sure that ovn-northd doesn't recreate the ha_chassis # records if the chassis record is missing in SB DB. ha_ch_list=$(fetch_column HA_Chassis _uuid) @@ -326,10 +331,10 @@ check_row_count HA_Chassis 2 'chassis=[[]]' check_row_count HA_Chassis 1 'chassis!=[[]]' # Create another logical router port and associate to the same ha_chasis_group -ovn-nbctl lr-add lr1 -ovn-nbctl lrp-add lr1 lr1-public 00:00:20:20:12:14 182.168.0.100/24 +check ovn-nbctl lr-add lr1 +check ovn-nbctl lrp-add lr1 lr1-public 00:00:20:20:12:14 182.168.0.100/24 -ovn-nbctl set logical_router_port lr1-public ha_chassis_group=$hagrp1_uuid +check ovn-nbctl set logical_router_port lr1-public ha_chassis_group=$hagrp1_uuid # We should still have 1 HA chassis group and 3 HA chassis in SB DB. wait_row_count HA_Chassis_Group 1 name=hagrp1 @@ -397,18 +402,18 @@ wait_row_count HA_Chassis 2 # Test if 'ref_chassis' column is properly set or not in # SB DB ha_chassis_group. -ovn-nbctl ls-add sw0 -ovn-nbctl lsp-add sw0 sw0-p1 - -ovn-sbctl chassis-add ch2 geneve 127.0.0.3 -ovn-sbctl chassis-add ch3 geneve 127.0.0.4 -ovn-sbctl chassis-add comp1 geneve 127.0.0.5 -ovn-sbctl chassis-add comp2 geneve 127.0.0.6 - -ovn-nbctl lrp-add lr0 lr0-sw0 00:00:20:20:12:14 10.0.0.1/24 -ovn-nbctl lsp-add sw0 sw0-lr0 -ovn-nbctl lsp-set-type sw0-lr0 router -ovn-nbctl lsp-set-addresses sw0-lr0 router +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0-p1 + +check ovn-sbctl chassis-add ch2 geneve 127.0.0.3 +check ovn-sbctl chassis-add ch3 geneve 127.0.0.4 +check ovn-sbctl chassis-add comp1 geneve 127.0.0.5 +check ovn-sbctl chassis-add comp2 geneve 127.0.0.6 + +check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:20:20:12:14 10.0.0.1/24 +check ovn-nbctl lsp-add sw0 sw0-lr0 +check ovn-nbctl lsp-set-type sw0-lr0 router +check ovn-nbctl lsp-set-addresses sw0-lr0 router check ovn-nbctl --wait=sb lsp-set-options sw0-lr0 router-port=lr0-sw0 ovn-sbctl lsp-bind sw0-p1 comp1 @@ -418,6 +423,7 @@ comp1_ch_uuid=$(fetch_column Chassis _uuid name=comp1) comp2_ch_uuid=$(fetch_column Chassis _uuid name=comp2) ch2_ch_uuid=$comp1_ch_uuid +# Check ref_chassis. echo "comp1_ch_uuid = $comp1_ch_uuid" wait_column "$comp1_ch_uuid" HA_Chassis_Group ref_chassis @@ -440,7 +446,7 @@ ovn-nbctl lsp-set-addresses sw1-lr1 router check ovn-nbctl --wait=sb lsp-set-options sw1-lr1 router-port=lr1-sw1 # Bind sw1-p1 in comp1. -ovn-sbctl lsp-bind sw1-p1 comp1 +check ovn-sbctl lsp-bind sw1-p1 comp1 # Wait until sw1-p1 is up wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=true @@ -448,10 +454,10 @@ wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=true wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Now attach sw0 to lr1 -ovn-nbctl lrp-add lr1 lr1-sw0 00:00:20:20:12:16 10.0.0.10/24 -ovn-nbctl lsp-add sw0 sw0-lr1 -ovn-nbctl lsp-set-type sw0-lr1 router -ovn-nbctl lsp-set-addresses sw0-lr1 router +check ovn-nbctl lrp-add lr1 lr1-sw0 00:00:20:20:12:16 10.0.0.10/24 +check ovn-nbctl lsp-add sw0 sw0-lr1 +check ovn-nbctl lsp-set-type sw0-lr1 router +check ovn-nbctl lsp-set-addresses sw0-lr1 router check ovn-nbctl --wait=sb lsp-set-options sw0-lr1 router-port=lr1-sw0 # Both comp1 and comp2 should be in 'ref_chassis' as sw1 is indirectly @@ -466,17 +472,17 @@ wait_row_count nb:Logical_Switch_Port 1 name=sw1-p1 up=false wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Create sw2 and attach it to lr2 -ovn-nbctl ls-add sw2 -ovn-nbctl lsp-add sw2 sw2-p1 -ovn-nbctl lr-add lr2 -ovn-nbctl lrp-add lr2 lr2-sw2 00:00:20:20:12:17 30.0.0.1/24 -ovn-nbctl lsp-add sw2 sw2-lr2 -ovn-nbctl lsp-set-type sw2-lr2 router -ovn-nbctl lsp-set-addresses sw2-lr2 router +check ovn-nbctl ls-add sw2 +check ovn-nbctl lsp-add sw2 sw2-p1 +check ovn-nbctl lr-add lr2 +check ovn-nbctl lrp-add lr2 lr2-sw2 00:00:20:20:12:17 30.0.0.1/24 +check ovn-nbctl lsp-add sw2 sw2-lr2 +check ovn-nbctl lsp-set-type sw2-lr2 router +check ovn-nbctl lsp-set-addresses sw2-lr2 router check ovn-nbctl --wait=sb lsp-set-options sw2-lr2 router-port=lr2-sw2 # Bind sw2-p1 to comp1 -ovn-sbctl lsp-bind sw2-p1 comp1 +check ovn-sbctl lsp-bind sw2-p1 comp1 # Wait until sw2-p1 is up wait_row_count nb:Logical_Switch_Port 1 name=sw2-p1 up=true @@ -484,10 +490,10 @@ wait_row_count nb:Logical_Switch_Port 1 name=sw2-p1 up=true wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Now attach sw1 to lr2. With this sw2-p1 is indirectly connected to lr0. -ovn-nbctl lrp-add lr2 lr2-sw1 00:00:20:20:12:18 20.0.0.10/24 -ovn-nbctl lsp-add sw1 sw1-lr2 -ovn-nbctl lsp-set-type sw1-lr2 router -ovn-nbctl lsp-set-addresses sw1-lr2 router +check ovn-nbctl lrp-add lr2 lr2-sw1 00:00:20:20:12:18 20.0.0.10/24 +check ovn-nbctl lsp-add sw1 sw1-lr2 +check ovn-nbctl lsp-set-type sw1-lr2 router +check ovn-nbctl lsp-set-addresses sw1-lr2 router check ovn-nbctl --wait=sb lsp-set-options sw1-lr2 router-port=lr2-sw1 # sw2-p1 is indirectly connected to lr0. So comp1 (and comp2) should be in @@ -507,13 +513,13 @@ wait_column "$exp_ref_ch_list" HA_Chassis_Group ref_chassis # Delete lr1-sw0. comp1 should be deleted from ref_chassis as there is no link # from sw1 and sw2 to lr0. -ovn-nbctl lrp-del lr1-sw0 +check ovn-nbctl lrp-del lr1-sw0 wait_column "$comp2_ch_uuid" HA_Chassis_Group ref_chassis # Set redirect-chassis option to lr0-public. It should be ignored # (because redirect-chassis is obsolete). -ovn-nbctl set logical_router_port lr0-public options:redirect-chassis=ch1 +check ovn-nbctl set logical_router_port lr0-public options:redirect-chassis=ch1 wait_row_count HA_Chassis_Group 1 wait_row_count HA_Chassis_Group 1 name=lr0-public @@ -521,29 +527,29 @@ wait_row_count HA_Chassis_Group 1 name=lr0-public wait_row_count HA_Chassis 2 # Delete the gateway chassis. -ovn-nbctl clear logical_router_port lr0-public gateway_chassis +check ovn-nbctl clear logical_router_port lr0-public gateway_chassis wait_row_count HA_Chassis_Group 0 check_row_count HA_Chassis 0 # Delete old sw0. -ovn-nbctl ls-del sw0 +check ovn-nbctl --wait=sb ls-del sw0 # Create external logical ports and associate ha_chassis_group -ovn-nbctl ls-add sw0 -ovn-nbctl lsp-add sw0 sw0-pext1 -ovn-nbctl lsp-add sw0 sw0-pext2 -ovn-nbctl lsp-add sw0 sw0-p1 +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0-pext1 +check ovn-nbctl lsp-add sw0 sw0-pext2 +check ovn-nbctl lsp-add sw0 sw0-p1 -ovn-nbctl lsp-set-addresses sw0-pext1 "00:00:00:00:00:03 10.0.0.3" -ovn-nbctl lsp-set-addresses sw0-pext2 "00:00:00:00:00:03 10.0.0.4" -ovn-nbctl lsp-set-addresses sw0-p1 "00:00:00:00:00:03 10.0.0.5" +check ovn-nbctl lsp-set-addresses sw0-pext1 "00:00:00:00:00:03 10.0.0.3" +check ovn-nbctl lsp-set-addresses sw0-pext2 "00:00:00:00:00:03 10.0.0.4" +check ovn-nbctl lsp-set-addresses sw0-p1 "00:00:00:00:00:03 10.0.0.5" check ovn-nbctl --wait=sb ha-chassis-group-add hagrp1 -ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30 -ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20 -ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10 +check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch1 30 +check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch2 20 +check ovn-nbctl --wait=sb ha-chassis-group-add-chassis hagrp1 ch3 10 # ovn-northd should not create HA chassis group and HA chassis rows # unless the HA chassis group in OVN NB DB is associated to @@ -712,78 +718,45 @@ ovn-nbctl lsp-set-options S1-R1 router-port=R1-S1 check ovn-nbctl --wait=sb lrp-set-gateway-chassis R1-S1 gw1 -# IPV4 -ovn-nbctl lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 - -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ -wc -l`]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | wc -l], [0], [2 -]) +check_flow_matches() { + local regex=$1 count=$2 + local found=$(grep -c "$1" r1-flows) + echo "checking for $count flows matching $regex... found $found" + AT_FAIL_IF([test $found != $count]) +} -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l], [0], [2 -]) +check_flow_match_sets() { + ovn-sbctl dump-flows R1 > r1-flows + AT_CAPTURE_FILE([r1-flows]) -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip4.dst=| wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip4.src=| wc -l], [0], [0 -]) + for regex in lr_in_unsnat ct_snat ct_dnat ip4.dst= ip4.src= ip6.dst= ip6.src=; do + check_flow_matches $regex $1 + shift + done +} +echo +echo "IPv4: stateful" +ovn-nbctl --wait=sb lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 +check_flow_match_sets 2 2 2 0 0 0 0 ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1 -ovn-nbctl --stateless lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ -wc -l`]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip4.dst=| wc -l], [0], [2 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip4.src=| wc -l], [0], [2 -]) +echo +echo "IPv4: stateless" +ovn-nbctl --wait=sb --stateless lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 +check_flow_match_sets 2 0 0 2 2 0 0 ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1 -# IPV6 -ovn-nbctl lr-nat-add R1 dnat_and_snat fd01::1 fd11::2 - -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ -wc -l`]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | wc -l], [0], [2 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l], [0], [2 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip6.dst=| wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip6.src=| wc -l], [0], [0 -]) - +echo +echo "IPv6: stateful" +ovn-nbctl --wait=sb lr-nat-add R1 dnat_and_snat fd01::1 fd11::2 +check_flow_match_sets 2 2 2 0 0 0 0 ovn-nbctl lr-nat-del R1 dnat_and_snat fd01::1 -ovn-nbctl --stateless lr-nat-add R1 dnat_and_snat fd01::1 fd11::2 - -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ -wc -l`]) -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip6.dst=| wc -l], [0], [2 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ip6.src=| wc -l], [0], [2 -]) +echo +echo "IPv6: stateless" +ovn-nbctl --wait=sb --stateless lr-nat-add R1 dnat_and_snat fd01::1 fd11::2 +check_flow_match_sets 2 0 0 0 0 2 2 AT_CLEANUP @@ -809,43 +782,29 @@ echo "CR-LRP UUID is: " $uuid # IPV4 ovn-nbctl --portrange lr-nat-add R1 dnat_and_snat 172.16.1.1 50.0.0.11 1-3000 -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ -wc -l`]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | grep 3000 | wc -l], [0], [1 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | grep 3000 | wc -l], [0], [1 +AT_CAPTURE_FILE([sbflows]) +OVS_WAIT_UNTIL([ovn-sbctl dump-flows R1 > sbflows && test 2 = `grep -c lr_in_unsnat sbflows`]) +AT_CHECK([grep -c 'ct_snat.*3000' sbflows && grep -c 'ct_dnat.*3000' sbflows], + [0], [1 +1 ]) - ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1 +ovn-nbctl --wait=sb --portrange lr-nat-add R1 snat 172.16.1.1 50.0.0.11 1-3000 -ovn-nbctl --portrange lr-nat-add R1 snat 172.16.1.1 50.0.0.11 1-3000 - -OVS_WAIT_UNTIL([test 2 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ -wc -l`]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | grep 3000 | wc -l], [0], [1 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | grep 3000 | wc -l], [0], [0 +AT_CAPTURE_FILE([sbflows2]) +OVS_WAIT_UNTIL([ovn-sbctl dump-flows R1 > sbflows2 && test 2 = `grep -c lr_in_unsnat sbflows`]) +AT_CHECK([grep -c 'ct_snat.*3000' sbflows2 && grep -c 'ct_dnat.*3000' sbflows2], + [1], [1 +0 ]) ovn-nbctl lr-nat-del R1 snat 172.16.1.1 +ovn-nbctl --wait=sb --portrange --stateless lr-nat-add R1 dnat_and_snat 172.16.1.2 50.0.0.12 1-3000 -ovn-nbctl --portrange --stateless lr-nat-add R1 dnat_and_snat 172.16.1.2 50.0.0.12 1-3000 -ovn-sbctl dump-flows R1 - -OVS_WAIT_UNTIL([test 3 = `ovn-sbctl dump-flows R1 | grep lr_in_unsnat | \ -wc -l`]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_snat | grep 3000 | grep 172.16.1.2 | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows R1 | grep ct_dnat | grep 3000 | grep 172.16.1.2 | wc -l], [0], [0 -]) - +AT_CAPTURE_FILE([sbflows3]) +OVS_WAIT_UNTIL([ovn-sbctl dump-flows R1 > sbflows3 && test 3 = `grep -c lr_in_unsnat sbflows3`]) +AT_CHECK([grep 'ct_[s]dnat.*172\.16\.1\.2.*3000' sbflows3], [1]) ovn-nbctl lr-nat-del R1 dnat_and_snat 172.16.1.1 @@ -1289,16 +1248,19 @@ ovn-nbctl lr-nat-add lr0 snat 192.168.2.1 10.0.0.0/24 ovn-nbctl lr-nat-add lr0 dnat_and_snat 192.168.2.4 10.0.0.4 check ovn-nbctl --wait=sb lr-nat-add lr0 dnat 192.168.2.5 10.0.0.5 -OVS_WAIT_UNTIL([test 1 = $(ovn-sbctl dump-flows lr0 | grep lr_in_unsnat | \ +ovn-sbctl dump-flows lr0 > sbflows +AT_CAPTURE_FILE([sbflows]) + +OVS_WAIT_UNTIL([test 1 = $(grep lr_in_unsnat sbflows | \ grep "ip4 && ip4.dst == 192.168.2.1 && tcp && tcp.dst == 8080" -c) ]) -AT_CHECK([test 1 = $(ovn-sbctl dump-flows lr0 | grep lr_in_unsnat | \ +AT_CHECK([test 1 = $(grep lr_in_unsnat sbflows | \ grep "ip4 && ip4.dst == 192.168.2.4 && udp && udp.dst == 8080" -c) ]) -AT_CHECK([test 1 = $(ovn-sbctl dump-flows lr0 | grep lr_in_unsnat | \ +AT_CHECK([test 1 = $(grep lr_in_unsnat sbflows | \ grep "ip4 && ip4.dst == 192.168.2.5 && tcp && tcp.dst == 8080" -c) ]) -AT_CHECK([test 0 = $(ovn-sbctl dump-flows lr0 | grep lr_in_unsnat | \ +AT_CHECK([test 0 = $(grep lr_in_unsnat sbflows | \ grep "ip4 && ip4.dst == 192.168.2.6 && tcp && tcp.dst == 8080" -c) ]) AT_CLEANUP @@ -1325,24 +1287,26 @@ AT_CLEANUP AT_SETUP([ovn -- check reconcile stale Datapath_Binding]) ovn_start -ovn-nbctl lr-add lr -ovn-nbctl lrp-add lr p 00:00:00:00:00:01 1.1.1.1/24 - -AT_CHECK([ovn-nbctl --wait=sb sync], [0]) +check ovn-nbctl lr-add lr +check ovn-nbctl lrp-add lr p 00:00:00:00:00:01 1.1.1.1/24 +check ovn-nbctl --wait=sb sync # Create a MAC_Binding referring the router datapath. -dp=$(ovn-sbctl --bare --columns _uuid list datapath .) -ovn-sbctl create mac_binding logical_port="p" ip="1.1.1.2" datapath="$dp" +AT_CHECK([ovn-sbctl --id=@dp get datapath . -- create mac_binding logical_port=p ip=1.1.1.2 datapath=@dp | uuidfilt], [0], [<0> +]) -ovn-nbctl lrp-del p -- lr-del lr -- \ - lr-add lr -- lrp-add lr p 00:00:00:00:00:01 1.1.1.1/24 -AT_CHECK([ovn-nbctl --wait=sb sync], [0]) +check ovn-nbctl --wait=sb \ + -- lrp-del p \ + -- lr-del lr \ + -- lr-add lr \ + -- lrp-add lr p 00:00:00:00:00:01 1.1.1.1/24 -AT_CHECK([test 1 = $(ovn-sbctl --columns _uuid list Datapath_Binding | wc -l)]) +check_row_count Datapath_Binding 1 nb_uuid=$(ovn-sbctl get Datapath_Binding . external_ids:logical-router) -lr_uuid=$(ovn-nbctl --columns _uuid list Logical_Router .) -AT_CHECK[test ${nb_uuid} = ${lr_uuid}] +lr_uuid=\"$(ovn-nbctl get Logical_Router . _uuid)\" +echo nb_uuid="$nb_uuid" lr_uuid="$lr_uuid" +AT_CHECK([test "${nb_uuid}" = "${lr_uuid}"]) AT_CLEANUP diff --git a/tests/ovn.at b/tests/ovn.at index 245a6feb202b..de776bb11b8c 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -2002,19 +2002,8 @@ tip=`ip_to_hex 192 169 0 13` test_arp 11 f00000000011 $sip $tip # dump information and flows with counters -ovn-sbctl dump-flows -- list multicast_group - -echo "------ hv1 dump ------" -as hv1 ovs-vsctl show -as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int - -echo "------ hv2 dump ------" -as hv2 ovs-vsctl show -as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int - -echo "------ hv3 dump ------" -as hv3 ovs-vsctl show -as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int +ovn-sbctl dump-flows -- list multicast_group > sbflows +AT_CAPTURE_FILE([sbflows]) # Now check the packets actually received against the ones expected. for i in 1 2 3; do @@ -2216,6 +2205,8 @@ ovn-nbctl create Address_Set name=set1 addresses=\"f0:00:00:00:00:01\",\"f0:00:0 ovn-nbctl acl-add lsw0 to-lport 1000 'eth.type == 0x1237 && eth.src == $set1 && outport == "lp3"' drop ovn-nbctl --wait=sb sync +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) on_exit 'kill `cat ovn-trace.pid`' ovn-trace --detach --pidfile --no-chdir @@ -2486,7 +2477,8 @@ for i in 1 2; do done done ovn-nbctl --wait=sb sync -ovn-sbctl dump-flows +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) OVN_POPULATE_ARP @@ -2651,12 +2643,14 @@ done ovn-nbctl --wait=sb sync -ovn-nbctl show -ovn-sbctl dump-flows -echo "------ OVN dump ------" -ovn-nbctl show -ovn-sbctl show +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) + +ovn-nbctl show > nbctl-show +AT_CAPTURE_FILE([nbctl-show]) +ovn-sbctl show > sbctl-show +AT_CAPTURE_FILE([sbctl-show]) for i in 1 2; do hv=hv-$i @@ -2783,7 +2777,8 @@ done ovn-nbctl --wait=sb sync ovn-nbctl show -ovn-sbctl dump-flows +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) echo "------ OVN dump ------" ovn-nbctl show @@ -2919,7 +2914,8 @@ done ovn-nbctl --wait=sb sync ovn-nbctl show -ovn-sbctl dump-flows +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) # vif ports for i in 1 2; do @@ -3608,11 +3604,12 @@ test_ip() { # SHA and REPLY_HA are each 12 hex digits. # SPA and TPA are each 8 hex digits. test_arp() { + echo "$@" local inport=$1 sha=$2 spa=$3 tpa=$4 flood=$5 reply_ha=$6 local request=ffffffffffff${sha}08060001080006040001${sha}${spa}ffffffffffff${tpa} hv=hv`vif_to_hv $inport` as $hv ovs-appctl netdev-dummy/receive vif$inport $request - as $hv ovs-appctl ofproto/trace br-int in_port=$inport $request + as $hv ovs-appctl ofproto/trace br-int in_port=$inport $request > trace # Expect to receive the broadcast ARP on the other logical switch ports if # IP address is not configured on the switch patch port or on the router @@ -3640,11 +3637,15 @@ test_arp() { fi } -as hv1 ovs-vsctl --columns=name,ofport list interface -as hv1 ovn-sbctl list port_binding -as hv1 ovn-sbctl list datapath_binding -as hv1 ovn-sbctl dump-flows -as hv1 ovs-ofctl dump-flows br-int +as hv1 ovs-vsctl --columns=name,ofport list interface > interfaces +(as hv1 ovn-sbctl list port_binding + as hv1 ovn-sbctl list datapath_binding) > bindings +as hv1 ovn-sbctl dump-flows > sbflows +as hv1 ovs-ofctl dump-flows br-int > offlows +AT_CAPTURE_FILE([interfaces]) +AT_CAPTURE_FILE([bindings]) +AT_CAPTURE_FILE([sbflows]) +AT_CAPTURE_FILE([offlows]) # Send IP packets between all pairs of source and destination ports: # @@ -3668,15 +3669,16 @@ for is in 1 2 3; do if test $is = $id; then dmac=f00000000$d; else dmac=00000000ff$is$js; fi if test $d != $s; then unicast=$d; else unicast=; fi - test_ip $s $smac $dmac $sip $dip $unicast #1 + test_ip $s $smac $dmac $sip $dip $unicast & #1 if test $id = $is && test $d != $s; then bcast="$bcast $d"; fi done done done - test_ip $s $smac ffffffffffff $sip ffffffff $bcast #2 + test_ip $s $smac ffffffffffff $sip ffffffff $bcast & #2 done done + wait done : > mac_bindings.expected @@ -3837,22 +3839,34 @@ for is in 1 2 3; do done done -ovn-sbctl -f csv -d bare --no-heading \ - -- --columns=logical_port,ip,mac list mac_binding > mac_bindings - -# Now check the packets actually received against the ones expected. -for i in 1 2 3; do - for j in 1 2 3; do - for k in 1 2 3; do - OVN_CHECK_PACKETS([hv`vif_to_hv $i$j$k`/vif$i$j$k-tx.pcap], - [$i$j$k.expected]) +ovn-sbctl dump-flows > sbflows2 +AT_CAPTURE_FILE([sbflows2]) + +AT_CAPTURE_FILE([expected]) +AT_CAPTURE_FILE([received]) +check_packets() { + > expected + > received + for i in 1 2 3; do + for j in 1 2 3; do + for k in 1 2 3; do + pcap=hv`vif_to_hv $i$j$k`/vif$i$j$k-tx.pcap + echo "--- $pcap" | tee -a expected >> received + sort $i$j$k.expected >> expected + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> received + echo | tee -a expected >> received + done done done -done -# Check the MAC bindings against those expected. -AT_CHECK_UNQUOTED([sort < mac_bindings], [0], [`sort < mac_bindings.expected` -]) + echo '--- MAC bindings' | tee -a expected >> received + ovn-sbctl -f csv -d bare --no-heading \ + -- --columns=logical_port,ip,mac list mac_binding | sort >> received + sort < mac_bindings.expected >> expected + + $at_diff expected received >/dev/null +} +OVS_WAIT_UNTIL([check_packets], [$at_diff -F'^---' expected received]) # Gracefully terminate daemons OVN_CLEANUP([hv1], [hv2], [hv3]) @@ -5271,6 +5285,8 @@ check ovs-vsctl -- add-port br-int hv1-vif4 -- \ options:rxq_pcap=hv1/vif4-rx.pcap \ ofport-request=4 +as hv1 ovs-appctl vlog/set dbg + OVN_POPULATE_ARP sleep 2 @@ -5279,7 +5295,19 @@ as hv1 ovs-vsctl show # This shell function sends a DHCP request packet # test_dhcp INPORT SRC_MAC DHCP_TYPE BROADCAST CIADDR OFFER_IP REQUEST_IP ETH_BOOT USE_IP ... +packet_num=0 test_dhcp() { + local expect_resume=: + local trace=false + while :; do + case $1 in + (--no-resume) expect_resume=false; shift ;; + # --trace isn't used but it can be useful for debugging: + (--trace) trace=:; shift ;; + (*) break ;; + esac + done + local inport=$1 src_mac=$2 dhcp_type=$3 broadcast=$4 ciaddr=$5 offer_ip=$6 request_ip=$7 eth_boot=$8 use_ip=$9 shift; shift; shift; shift; shift; shift; shift; shift; shift; @@ -5291,6 +5319,19 @@ test_dhcp() { src_ip=`ip_to_hex 0 0 0 0` dst_ip=`ip_to_hex 255 255 255 255` fi + packet_num=$(expr $packet_num + 1) + + AS_BOX([dhcp test packet $packet_num]) + + as hv1 + if test -f hv1/ovs-ofctl.pid; then + OVS_APP_EXIT_AND_WAIT([ovs-ofctl]) + AT_FAIL_IF([test -f ovs-ofctl.pid]) + fi + AT_CAPTURE_FILE([ofctl_monitor$packet_num.log]) + ovs-ofctl monitor br-int resume --detach --no-chdir \ + --pidfile=ovs-ofctl.pid 2> ofctl_monitor$packet_num.log + echo "inport=$inport src_mac=$src_mac dhcp_type=$dhcp_type broadcast=$broadcast ciaddr=$ciaddr offer_ip=$offer_ip request_ip=$request_ip use_ip=$use_ip src_ip=$src_ip dst_ip=$dst_ip" if test $request_ip != 0; then @@ -5354,6 +5395,7 @@ test_dhcp() { fi # dhcp end option request=${request}ff + tcpdump_hex "-- sending DHCP request on hv1-vif$inport" $request for port in $inport "$@"; do : >> $port.expected @@ -5399,12 +5441,23 @@ test_dhcp() { reply=${reply}63825363 reply=${reply}3501${dhcp_reply_type}${expected_dhcp_opts}00000000ff00000000 echo $reply >> $inport.expected + tcpdump_hex "-- expecting DHCP reply on $inport" $request else for outport; do echo $request >> $outport.expected done fi - check as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request + if $trace; then + as hv1 ovs-appctl ofproto/trace br-int in_port=hv1-vif$inport $request > trace$packet_num + AT_CAPTURE_FILE([trace$packet_num]) + else + check as hv1 ovs-appctl netdev-dummy/receive hv1-vif$inport $request + fi + + # NXT_RESUMEs should be 1. + if $expect_resume; then + OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor$packet_num.log | grep -c NXT_RESUME`]) + fi } reset_pcap_file() { @@ -5417,13 +5470,11 @@ options:rxq_pcap=dummy-rx.pcap options:rxq_pcap=${pcap_file}-rx.pcap } -AT_CAPTURE_FILE([ofctl_monitor0.log]) -as hv1 ovs-ofctl monitor br-int resume --detach --no-chdir \ ---pidfile=ovs-ofctl0.pid 2> ofctl_monitor0.log - AT_CAPTURE_FILE([sbflows]) ovn-sbctl dump-flows > sbflows +# ---------------------------------------------------------------------- + # Send DHCPDISCOVER. offer_ip=`ip_to_hex 10 0 0 4` server_ip=`ip_to_hex 10 0 0 1` @@ -5432,9 +5483,6 @@ request_ip=0 expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001 test_dhcp 1 f00000000001 01 0 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 $server_ip 02 $expected_dhcp_opts -# NXT_RESUMEs should be 1. -OVS_WAIT_UNTIL([test 1 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets cat 1.expected | cut -c -48 > expout AT_CHECK([cat 1.packets | cut -c -48], [0], [expout]) @@ -5442,6 +5490,8 @@ AT_CHECK([cat 1.packets | cut -c -48], [0], [expout]) cat 1.expected | cut -c 53- > expout AT_CHECK([cat 1.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + # ovs-ofctl also resumes the packets and this causes other ports to receive # the DHCP request packet. So reset the pcap files so that its easier to test. reset_pcap_file hv1-vif1 hv1/vif1 @@ -5458,9 +5508,6 @@ request_ip=$offer_ip expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001 test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 2. -OVS_WAIT_UNTIL([test 2 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5468,6 +5515,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5482,9 +5531,6 @@ request_ip=`ip_to_hex 10 0 0 7` expected_dhcp_opts="" test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 $server_ip 06 $expected_dhcp_opts -# NXT_RESUMEs should be 3. -OVS_WAIT_UNTIL([test 3 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5492,6 +5538,7 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5507,19 +5554,17 @@ request_ip=0 test_dhcp 2 f00000000002 09 0 $ciaddr $offer_ip $request_ip 0 0 1 1 # NXT_RESUMEs should be 4. -OVS_WAIT_UNTIL([test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - # vif1-tx.pcap should have received the DHCPv4 (invalid) request packet OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [1.expected]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected rm -f 2.expected # NXT_RESUMEs should be 4. -OVS_WAIT_UNTIL([test 4 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - # Send DHCPREQUEST in the RENEWING/REBINDING state with ip4.src set to 10.0.0.6 # and ip4.dst set to 10.0.0.1. offer_ip=`ip_to_hex 10 0 0 6` @@ -5531,9 +5576,6 @@ dst_ip=$server_ip expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001 test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 1 $src_ip $dst_ip ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 5. -OVS_WAIT_UNTIL([test 5 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5541,6 +5583,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5557,9 +5601,6 @@ dst_ip=`ip_to_hex 255 255 255 255` expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001 test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 1 $src_ip $dst_ip ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 6. -OVS_WAIT_UNTIL([test 6 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5567,6 +5608,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5583,9 +5626,6 @@ dst_ip=`ip_to_hex 255 255 255 255` expected_dhcp_opts="" test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 1 $src_ip $dst_ip ff1000000001 $server_ip 06 $expected_dhcp_opts -# NXT_RESUMEs should be 7. -OVS_WAIT_UNTIL([test 7 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5593,6 +5633,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5609,9 +5651,6 @@ dst_ip=`ip_to_hex 255 255 255 255` expected_dhcp_opts="" test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 1 $src_ip $dst_ip ff1000000001 $server_ip 06 $expected_dhcp_opts -# NXT_RESUMEs should be 8. -OVS_WAIT_UNTIL([test 8 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5619,6 +5658,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5629,14 +5670,13 @@ rm -f 2.expected ciaddr=`ip_to_hex 0 0 0 0` src_ip=`ip_to_hex 10 0 0 6` dst_ip=`ip_to_hex 10 0 0 4` -test_dhcp 2 f00000000002 03 0 $ciaddr 0 0 0 1 $src_ip $dst_ip 1 - -# NXT_RESUMEs should be 8. -OVS_WAIT_UNTIL([test 8 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) +test_dhcp --no-resume 2 f00000000002 03 0 $ciaddr 0 0 0 1 $src_ip $dst_ip 1 # vif1-tx.pcap should have received the DHCPv4 request packet OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [1.expected]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5650,9 +5690,6 @@ request_ip=0 expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a000001 test_dhcp 1 f00000000001 01 1 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 $server_ip 02 $expected_dhcp_opts -# NXT_RESUMEs should be 9. -OVS_WAIT_UNTIL([test 9 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > 1.packets cat 1.expected | cut -c -48 > expout AT_CHECK([cat 1.packets | cut -c -48], [0], [expout]) @@ -5660,6 +5697,8 @@ AT_CHECK([cat 1.packets | cut -c -48], [0], [expout]) cat 1.expected | cut -c 53- > expout AT_CHECK([cat 1.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5673,9 +5712,6 @@ request_ip=0 expected_dhcp_opts=0 test_dhcp 2 f00000000002 07 0 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 -# NXT_RESUMEs should be 10. -OVS_WAIT_UNTIL([test 10 = $(cat ofctl_monitor*.log | grep -c NXT_RESUME)]) - # There is no reply for this. Check for the INFO log in ovn-controller.log AT_CHECK([test 1 = $(cat hv1/ovn-controller.log | \ grep "DHCPRELEASE f0:00:00:00:00:02 10.0.0.6" -c)]) @@ -5683,6 +5719,8 @@ grep "DHCPRELEASE f0:00:00:00:00:02 10.0.0.6" -c)]) $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets AT_CHECK([cat 2.packets], [0], []) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5700,9 +5738,6 @@ dst_ip=$server_ip expected_dhcp_opts=03040a00000136040a000001 test_dhcp 2 f00000000002 08 0 $ciaddr $offer_ip $request_ip 0 1 $src_ip $dst_ip ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 11. -OVS_WAIT_UNTIL([test 11 = $(cat ofctl_monitor*.log | grep -c NXT_RESUME)]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5712,6 +5747,10 @@ AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) # Now add the dhcp option T1 to the dhcp options. check ovn-nbctl --wait=hv set dhcp_options ${d1} options:T1=4000 +AT_CAPTURE_FILE([sbflows2]) +ovn-sbctl dump-flows > sbflows2 + +# ---------------------------------------------------------------------- reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 @@ -5730,9 +5769,6 @@ dst_ip=$server_ip expected_dhcp_opts=3a0400000fa0330400000e100104ffffff0003040a00000136040a000001 test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 1 $src_ip $dst_ip ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 12. -OVS_WAIT_UNTIL([test 12 = $(cat ofctl_monitor*.log | grep -c NXT_RESUME)]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5740,6 +5776,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5757,9 +5795,6 @@ dst_ip=$server_ip expected_dhcp_opts=03040a00000136040a000001 test_dhcp 2 f00000000002 08 0 $ciaddr $offer_ip $request_ip 0 1 $src_ip $dst_ip ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 13. -OVS_WAIT_UNTIL([test 13 = $(cat ofctl_monitor*.log | grep -c NXT_RESUME)]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5767,6 +5802,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5777,6 +5814,8 @@ echo "------ Set tftp server (IPv4 address) --------" ovn-nbctl --wait=hv dhcp-options-set-options $d1 server_id=10.0.0.1 \ server_mac=ff:10:00:00:00:01 lease_time=3600 router=10.0.0.1 \ tftp_server=10.10.10.10 +AT_CAPTURE_FILE([sbflows3]) +ovn-sbctl dump-flows > sbflows3 echo "----------------------------------------------" # Send DHCPREQUEST in the SELECTING/INIT-REBOOT state with the offered IP @@ -5788,9 +5827,6 @@ request_ip=$offer_ip expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a00000142040a0a0a0a test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 14. -OVS_WAIT_UNTIL([test 14 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5798,6 +5834,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5808,6 +5846,8 @@ echo "------ Set tftp server (hostname) --------" ovn-nbctl --wait=hv dhcp-options-set-options $d1 server_id=10.0.0.1 \ server_mac=ff:10:00:00:00:01 lease_time=3600 router=10.0.0.1 \ tftp_server=\"test_tftp_server\" +AT_CAPTURE_FILE([sbflows4]) +ovn-sbctl dump-flows > sbflows4 echo "------------------------------------------" # Send DHCPREQUEST in the SELECTING/INIT-REBOOT state with the offered IP @@ -5819,9 +5859,6 @@ request_ip=$offer_ip expected_dhcp_opts=330400000e100104ffffff0003040a00000136040a0000014210746573745f746674705f736572766572 test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 15. -OVS_WAIT_UNTIL([test 15 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5829,6 +5866,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + reset_pcap_file hv1-vif1 hv1/vif1 reset_pcap_file hv1-vif2 hv1/vif2 rm -f 1.expected @@ -5839,6 +5878,8 @@ echo "------ Set domain search list --------" ovn-nbctl --wait=hv dhcp-options-set-options $d1 server_id=10.0.0.1 \ server_mac=ff:10:00:00:00:01 lease_time=3600 router=10.0.0.1 \ domain_search_list=\"test1.com,test2.com\" +AT_CAPTURE_FILE([sbflows5]) +ovn-sbctl dump-flows > sbflows5 echo "------------------------------------------" # Send DHCPREQUEST in the SELECTING/INIT-REBOOT state with the offered IP @@ -5850,9 +5891,6 @@ request_ip=$offer_ip expected_dhcp_opts=771305746573743103636f6d00057465737432c006330400000e100104ffffff0003040a00000136040a000001 test_dhcp 2 f00000000002 03 0 $ciaddr $offer_ip $request_ip 0 0 ff1000000001 $server_ip 05 $expected_dhcp_opts -# NXT_RESUMEs should be 16. -OVS_WAIT_UNTIL([test 16 = `cat ofctl_monitor*.log | grep -c NXT_RESUME`]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets cat 2.expected | cut -c -48 > expout AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) @@ -5860,6 +5898,8 @@ AT_CHECK([cat 2.packets | cut -c -48], [0], [expout]) cat 2.expected | cut -c 53- > expout AT_CHECK([cat 2.packets | cut -c 53-], [0], [expout]) +# ---------------------------------------------------------------------- + # test DHCPDECLINE offer_ip=`ip_to_hex 10 0 0 4` server_ip=`ip_to_hex 10 0 0 1` @@ -6581,6 +6621,7 @@ ls3_p1_mac=00:00:00:01:02:05 check ovn-nbctl --wait=hv lr-policy-add R1 10 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" drop # Check logical flow +ovn-sbctl dump-flows > sbflows AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "192.168.1.0" | wc -l], [0], [dnl 1 ]) @@ -6603,7 +6644,7 @@ AT_CHECK([ovs-ofctl dump-flows br-int | \ # Expected to drop the packet. $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" pbr-hv/vif2-tx.pcap > vif2.packets rcvd_packet=`cat vif2.packets` -AT_FAIL_IF([rcvd_packet = ""]) +AT_FAIL_IF([test "$rcvd_packet" != ""]) # Override drop policy with allow check ovn-nbctl --wait=hv lr-policy-add R1 20 "ip4.src==192.168.1.0/24 && ip4.dst==172.16.1.0/24" allow @@ -6653,13 +6694,13 @@ as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet" sleep 1 echo "southbound flows" - -ovn-sbctl dump-flows | grep lr_in_policy +ovn-sbctl --ovs dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) echo "ovs flows" -ovs-ofctl dump-flows br-int +ovs-ofctl dump-flows br-int > brflows +AT_CAPTURE_FILE([brflows]) # Check if packet hit the allow policy -AT_CHECK([ovs-ofctl dump-flows br-int | \ - grep "nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24" | \ +AT_CHECK([grep "nw_src=192.168.1.0/24,nw_dst=172.16.1.0/24" brflows | \ grep "priority=30" | \ grep "n_packets=1" | wc -l], [0], [dnl 1 @@ -6768,7 +6809,9 @@ ls3_p1_mac=00:00:00:01:02:05 check ovn-nbctl --wait=sb lr-policy-add R1 10 "ip6.src==2001::/64 && ip6.dst==2002::/64" drop # Check logical flow -AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l], [0], [dnl +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) +AT_CHECK([grep lr_in_policy sbflows | grep "2001" | wc -l], [0], [dnl 1 ]) @@ -6789,14 +6832,15 @@ AT_CHECK([ovs-ofctl dump-flows br-int | \ # Expected to drop the packet. $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" pbr-hv/vif2-tx.pcap > vif2.packets -rcvd_packet=`cat vif2.packets` -AT_FAIL_IF([rcvd_packet = ""]) +AT_FAIL_IF([test -s vif2.packets]) # Override drop policy with allow check ovn-nbctl --wait=sb lr-policy-add R1 20 "ip6.src==2001::/64 && ip6.dst==2002::/64" allow # Check logical flow -AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | grep "2001" | wc -l], [0], [dnl +ovn-sbctl dump-flows > sbflows2 +AT_CAPTURE_FILE([sbflows2]) +AT_CHECK([grep lr_in_policy sbflows2 | grep "2001" | wc -l], [0], [dnl 2 ]) @@ -6807,7 +6851,9 @@ packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac && as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet" # Check if packet hit the allow policy -AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | \ +ovn-sbctl dump-flows > sbflows3 +AT_CAPTURE_FILE([sbflows3]) +AT_CHECK([grep lr_in_policy sbflows3 | \ grep "2001" | \ grep "priority=20" | wc -l], [0], [dnl 1 @@ -6825,7 +6871,9 @@ OVN_CHECK_PACKETS([pbr-hv/vif2-tx.pcap], [expected]) check ovn-nbctl --wait=sb lr-policy-add R1 30 "ip6.src==2001::/64 && ip6.dst==2002::/64" reroute 2003::2 # Check logical flow -AT_CHECK([ovn-sbctl dump-flows | grep lr_in_policy | \ +ovn-sbctl dump-flows > sbflows4 +AT_CAPTURE_FILE([sbflows4]) +AT_CHECK([grep lr_in_policy sbflows4 | \ grep "2001" | \ grep "priority=30" | wc -l], [0], [dnl 1 @@ -6838,19 +6886,16 @@ packet="inport==\"ls1-lp1\" && eth.src==$ls1_p1_mac && eth.dst==$ls1_ro_mac && as pbr-hv ovs-appctl -t ovn-controller inject-pkt "$packet" sleep 1 -echo "southbound flows" - -ovn-sbctl dump-flows | grep lr_in_policy -echo "ovs flows" -ovs-ofctl dump-flows br-int +ovn-sbctl dump-flows > sbflows5 +ovs-ofctl dump-flows br-int > offlows5 +AT_CAPTURE_FILE([sbflows5]) +AT_CAPTURE_FILE([offlows5]) # Check if packet hit the allow policy -AT_CHECK([ovs-ofctl dump-flows br-int | \ - grep "ipv6_src=2001::/64,ipv6_dst=2002::/64" | \ +AT_CHECK([grep "ipv6_src=2001::/64,ipv6_dst=2002::/64" offlows5 | \ grep "priority=30" | \ grep "n_packets=1" | wc -l], [0], [dnl 1 ]) -echo "packet hit reroute policy" # Expected packet has TTL decreased by 1 expected="eth.src==$ls3_ro_mac && eth.dst==$ls3_p1_mac && @@ -7851,17 +7896,19 @@ AT_CHECK([ovn-nbctl --wait=hv lsp-set-options ln_port network_name=physnet1]) OVS_WAIT_UNTIL([test 1 = `as hv1 ovs-vsctl show | \ grep "Port patch-br-int-to-ln_port" | wc -l`]) +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) + # Wait for packet to be received. -OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 50]) +OVS_WAIT_UNTIL([test `wc -c < "hv1/snoopvif-tx.pcap"` -ge 140]) trim_zeros() { sed 's/\(00\)\{1,\}$//' } $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/snoopvif-tx.pcap | trim_zeros > packets -expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001" -echo $expected > expout -expected="fffffffffffff0000000000108060001080006040001f00000000001c0a80002000000000000c0a80002" -echo $expected >> expout -AT_CHECK([sort packets], [0], [expout]) +AT_CHECK([sort packets], [0], [dnl +fffffffffffff0000000000108060001080006040001f00000000001c0a80001000000000000c0a80001 +fffffffffffff0000000000108060001080006040001f00000000001c0a80002000000000000c0a80002 +]) OVN_CLEANUP([hv1]) @@ -8245,8 +8292,8 @@ ovn-nbctl --log acl-add lsw0 to-lport 1000 'tcp.dst==85' allow-related ovn-nbctl acl-add lsw0 to-lport 1000 'tcp.dst==86' reject ovn-nbctl --wait=hv --log --severity=alert --name=reject-flow acl-add lsw0 to-lport 1000 'tcp.dst==87' reject -ovn-sbctl dump-flows - +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) # Send packet that should be dropped without logging. packet="inport==\"lp1\" && eth.src==$lp1_mac && eth.dst==$lp2_mac && @@ -8354,6 +8401,9 @@ check ovn-nbctl --wait=hv sync ovn-nbctl --log --severity=alert --name=http-acl3 acl-add lsw0 to-lport 1000 'tcp.dst==82' drop ovn-nbctl --wait=hv sync +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) + # For each ACL, send 100 packets. for i in `seq 1 100`; do ovs-appctl netdev-dummy/receive lp1 'in_port(1),eth(src=f0:00:00:00:00:01,dst=f0:00:00:00:00:02),eth_type(0x0800),ipv4(src=192.168.1.2,dst=192.168.1.3,proto=6,tos=0,ttl=64,frag=no),tcp(src=7777,dst=80)' @@ -8455,23 +8505,23 @@ AT_SETUP([ovn -- DSCP marking and meter check]) AT_KEYWORDS([ovn]) ovn_start -ovn-nbctl ls-add lsw0 -ovn-nbctl --wait=sb lsp-add lsw0 lp1 -ovn-nbctl --wait=sb lsp-add lsw0 lp2 -ovn-nbctl --wait=sb lsp-add lsw0 lp3 -ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01 -ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02 -ovn-nbctl lsp-set-addresses lp3 f0:00:00:00:00:03 -ovn-nbctl lsp-set-port-security lp1 f0:00:00:00:00:01 -ovn-nbctl lsp-set-port-security lp2 f0:00:00:00:00:02 -ovn-nbctl --wait=sb sync +check ovn-nbctl ls-add lsw0 +check ovn-nbctl --wait=sb lsp-add lsw0 lp1 +check ovn-nbctl --wait=sb lsp-add lsw0 lp2 +check ovn-nbctl --wait=sb lsp-add lsw0 lp3 +check ovn-nbctl lsp-set-addresses lp1 f0:00:00:00:00:01 +check ovn-nbctl lsp-set-addresses lp2 f0:00:00:00:00:02 +check ovn-nbctl lsp-set-addresses lp3 f0:00:00:00:00:03 +check ovn-nbctl lsp-set-port-security lp1 f0:00:00:00:00:01 +check ovn-nbctl lsp-set-port-security lp2 f0:00:00:00:00:02 +check ovn-nbctl --wait=sb sync net_add n1 sim_add hv as hv -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 options:tx_pcap=vif1-tx.pcap options:rxq_pcap=vif1-rx.pcap ofport-request=1 -ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lp2 options:tx_pcap=vif2-tx.pcap options:rxq_pcap=vif2-rx.pcap ofport-request=2 +check ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 options:tx_pcap=vif1-tx.pcap options:rxq_pcap=vif1-rx.pcap ofport-request=1 +check ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lp2 options:tx_pcap=vif2-tx.pcap options:rxq_pcap=vif2-rx.pcap ofport-request=2 AT_CAPTURE_FILE([trace]) ovn_trace () { @@ -8529,7 +8579,7 @@ AT_CHECK([as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l], ]) # Update the meter rate -ovn-nbctl --wait=hv set QoS $qos_id bandwidth=rate=100 +check ovn-nbctl --wait=hv set QoS $qos_id bandwidth=rate=100 # check at hv with a qos meter table AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep rate=100 | wc -l], [0], [1 @@ -8538,11 +8588,11 @@ AT_CHECK([as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l], ]) # Update the DSCP marking -ovn-nbctl --wait=hv set QoS $qos_id action=dscp=63 +check ovn-nbctl --wait=hv set QoS $qos_id action=dscp=63 check_tos 63 # Update the meter rate -ovn-nbctl --wait=hv set QoS $qos_id bandwidth=rate=4294967295,burst=4294967295 +check ovn-nbctl --wait=hv set QoS $qos_id bandwidth=rate=4294967295,burst=4294967295 # check at hv with a qos meter table AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep burst_size=4294967295 | wc -l], [0], [1 @@ -8550,11 +8600,11 @@ AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep burst_size=429 AT_CHECK([as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l], [0], [1 ]) -ovn-nbctl --wait=hv set QoS $qos_id match="outport\=\=\"lp2\"" direction="to-lport" +check ovn-nbctl --wait=hv set QoS $qos_id match="outport\=\=\"lp2\"" direction="to-lport" check_tos 63 # Disable DSCP marking -ovn-nbctl --wait=hv qos-del lsw0 +check ovn-nbctl --wait=hv qos-del lsw0 as hv check_row_count nb:QoS 0 check_tos 0 @@ -8563,7 +8613,7 @@ AT_CHECK([as hv ovs-ofctl dump-flows br-int -O OpenFlow13 | grep meter | wc -l], ]) # check meter with chassis not resident -ovn-nbctl --wait=hv qos-add lsw0 to-lport 1001 'inport=="lp3" && is_chassis_resident("lp3")' rate=11123 burst=111230 +check ovn-nbctl --wait=hv qos-add lsw0 to-lport 1001 'inport=="lp3" && is_chassis_resident("lp3")' rate=11123 burst=111230 as hv check_row_count nb:QoS 1 # check no meter table @@ -8573,10 +8623,10 @@ AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep rate=11123 | w ]) # Check multiple qos meters -ovn-nbctl qos-del lsw0 -ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp1" && is_chassis_resident("lp1")' rate=100000 burst=100000 -ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp2" && is_chassis_resident("lp2")' rate=100000 burst=100000 -ovn-nbctl qos-add lsw0 to-lport 1002 'inport=="lp1" && is_chassis_resident("lp1")' rate=100001 burst=100001 +check ovn-nbctl qos-del lsw0 +check ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp1" && is_chassis_resident("lp1")' rate=100000 burst=100000 +check ovn-nbctl qos-add lsw0 to-lport 1001 'inport=="lp2" && is_chassis_resident("lp2")' rate=100000 burst=100000 +check ovn-nbctl qos-add lsw0 to-lport 1002 'inport=="lp1" && is_chassis_resident("lp1")' rate=100001 burst=100001 check ovn-nbctl --wait=hv qos-add lsw0 to-lport 1002 'inport=="lp2" && is_chassis_resident("lp2")' rate=100001 burst=100001 AT_CHECK([as hv ovs-ofctl dump-meters br-int -O OpenFlow13 | grep meter | wc -l], [0], [4 @@ -9687,9 +9737,9 @@ net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=foo1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ @@ -9697,19 +9747,19 @@ ovs-vsctl -- add-port br-int hv1-vif1 -- \ sim_add gw1 as gw1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 sim_add gw2 as gw2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.4 sim_add ext1 as ext1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.3 -ovs-vsctl -- add-port br-int ext1-vif1 -- \ +check ovs-vsctl -- add-port br-int ext1-vif1 -- \ set interface ext1-vif1 external-ids:iface-id=outside1 \ options:tx_pcap=ext1/vif1-tx.pcap \ options:rxq_pcap=ext1/vif1-rx.pcap \ @@ -9720,73 +9770,76 @@ ovs-vsctl -- add-port br-int ext1-vif1 -- \ # for ARP resolution). OVN_POPULATE_ARP -ovn-nbctl create Logical_Router name=R1 +AT_CHECK([ovn-nbctl create Logical_Router name=R1 | uuidfilt], [0], [<0> +]) -ovn-nbctl ls-add foo -ovn-nbctl ls-add alice -ovn-nbctl ls-add outside +check ovn-nbctl ls-add foo +check ovn-nbctl ls-add alice +check ovn-nbctl ls-add outside # Connect foo to R1 -ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24 -ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \ +check ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24 +check ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \ type=router options:router-port=foo \ -- lsp-set-addresses rp-foo router # Connect alice to R1 as distributed router gateway port on gw1 -ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24 +check ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24 -ovn-nbctl \ - --id=@gc0 create Gateway_Chassis name=alice_gw1 \ - chassis_name=gw1 \ - priority=20 -- \ - --id=@gc1 create Gateway_Chassis name=alice_gw2 \ - chassis_name=gw2 \ - priority=10 -- \ - set Logical_Router_Port alice 'gateway_chassis=[@gc0,@gc1]' +AT_CHECK([ovn-nbctl \ + --id=@gc0 create Gateway_Chassis name=alice_gw1 \ + chassis_name=gw1 \ + priority=20 -- \ + --id=@gc1 create Gateway_Chassis name=alice_gw2 \ + chassis_name=gw2 \ + priority=10 -- \ + set Logical_Router_Port alice 'gateway_chassis=[@gc0,@gc1]' \ + | uuidfilt], [0], [<0> +<1> +]) -ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \ +check ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \ type=router options:router-port=alice \ -- lsp-set-addresses rp-alice router # Create logical port foo1 in foo -ovn-nbctl lsp-add foo foo1 \ +check ovn-nbctl lsp-add foo foo1 \ -- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2" # Create logical port outside1 in outside -ovn-nbctl lsp-add outside outside1 \ +check ovn-nbctl lsp-add outside outside1 \ -- lsp-set-addresses outside1 "f0:00:00:01:02:04 172.16.1.3" # Create localnet port in alice -ovn-nbctl lsp-add alice ln-alice -ovn-nbctl lsp-set-addresses ln-alice unknown -ovn-nbctl lsp-set-type ln-alice localnet -ovn-nbctl lsp-set-options ln-alice network_name=phys +check ovn-nbctl lsp-add alice ln-alice +check ovn-nbctl lsp-set-addresses ln-alice unknown +check ovn-nbctl lsp-set-type ln-alice localnet +check ovn-nbctl lsp-set-options ln-alice network_name=phys # Create localnet port in outside -ovn-nbctl lsp-add outside ln-outside -ovn-nbctl lsp-set-addresses ln-outside unknown -ovn-nbctl lsp-set-type ln-outside localnet -ovn-nbctl lsp-set-options ln-outside network_name=phys +check ovn-nbctl lsp-add outside ln-outside +check ovn-nbctl lsp-set-addresses ln-outside unknown +check ovn-nbctl lsp-set-type ln-outside localnet +check ovn-nbctl lsp-set-options ln-outside network_name=phys # Create bridge-mappings on gw1, gw2 and ext1, hv1 doesn't need # mapping to the external network, is the one generating packets -as gw1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys -as gw2 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys -as ext1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys - -AT_CHECK([ovn-nbctl --timeout=3 --wait=sb sync], [0], [ignore]) +check as gw1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check as gw2 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check as ext1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys -# Allow some time for ovn-northd and ovn-controller to catch up. -ovn-nbctl --wait=hv sync +AT_CHECK([ovn-nbctl --wait=sb sync], [0], [ignore]) +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) reset_pcap_file() { local iface=$1 local pcap_file=$2 - ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ options:rxq_pcap=dummy-rx.pcap rm -f ${pcap_file}*.pcap - ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ options:rxq_pcap=${pcap_file}-rx.pcap } @@ -9806,7 +9859,7 @@ test_ip_packet() # ARP request packet to expect at outside1 #arp_request=ffffffffffff${src_mac}08060001080006040001${src_mac}${src_ip}000000000000${dst_ip} - as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet + check as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet # Send ARP reply from outside1 back to the router # XXX: note, we could avoid this if we plug this port into a netns @@ -9817,11 +9870,12 @@ test_ip_packet() src_ip=`ip_to_hex 172 16 1 1` arp_reply=${src_mac}${reply_mac}08060001080006040002${reply_mac}${dst_ip}${src_mac}${src_ip} - as ext1 ovs-appctl netdev-dummy/receive ext1-vif1 $arp_reply + check as ext1 ovs-appctl netdev-dummy/receive ext1-vif1 $arp_reply + AT_CAPTURE_FILE([offlows]) OVS_WAIT_UNTIL([ - test `as $active_gw ovs-ofctl dump-flows br-int | grep table=66 | \ -grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1 + as $active_gw ovs-ofctl dump-flows br-int > offlows + test `grep table=66 offlows | grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1 ]) # Packet to Expect at ext1 chassis, outside1 port @@ -9844,16 +9898,35 @@ grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1 sleep 1 # Resend packet from foo1 to outside1 - as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet + check as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet + + sleep 1 + + AT_CAPTURE_FILE([exp]) + AT_CAPTURE_FILE([rcv]) + check_packets() { + > exp + > rcv + + pcap=ext1/vif1-tx.pcap + type=ext1-vif1.expected + echo "--- $pcap" | tee -a exp >> rcv + sort -u "$type" >> exp + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort -u >> rcv + echo | tee -a exp >> rcv + + pcap=$active_gw/br-phys_n1-tx.pcap + echo "--- $pcap" | tee -a exp >> rcv + sort -u "$type" >> exp + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap > packets + (grep "$expected" packets; grep "$exp_gw_ip_garp" packets) | sort -u >> rcv + echo | tee -a exp >> rcv + + $at_diff exp rcv >/dev/null + } + + OVS_WAIT_UNTIL([check_packets], [$at_diff -F'^---' exp rcv]) - OVN_CHECK_PACKETS([ext1/vif1-tx.pcap], [ext1-vif1.expected]) - $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $active_gw/br-phys_n1-tx.pcap > packets - cat packets | grep $expected > exp - # Its possible that $active_gw/br-phys_n1-tx.pcap may have received multiple - # garp packets. So consider only the first packet. - cat packets | grep $exp_gw_ip_garp | head -1 >> exp - AT_CHECK([cat exp], [0], [expout]) - rm -f expout if test $backup_vswitchd_dead != 1; then # Check for backup gw only if vswitchd is alive $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $backup_gw/br-phys_n1-tx.pcap > packets @@ -9863,14 +9936,18 @@ grep actions=mod_dl_dst:f0:00:00:01:02:04 | wc -l` -eq 1 test_ip_packet gw1 gw2 0 -ovn-nbctl --timeout=3 --wait=hv \ +AT_CHECK( + [ovn-nbctl --wait=hv \ --id=@gc0 create Gateway_Chassis name=alice_gw1 \ chassis_name=gw1 \ priority=10 -- \ --id=@gc1 create Gateway_Chassis name=alice_gw2 \ chassis_name=gw2 \ priority=20 -- \ - set Logical_Router_Port alice 'gateway_chassis=[@gc0,@gc1]' + set Logical_Router_Port alice 'gateway_chassis=[@gc0,@gc1]' | uuidfilt], 0, + [<0> +<1> +]) test_ip_packet gw2 gw1 0 @@ -10143,9 +10220,9 @@ net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=foo1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ @@ -10153,14 +10230,14 @@ ovs-vsctl -- add-port br-int hv1-vif1 -- \ sim_add hv2 as hv2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 sim_add hv3 as hv3 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.3 -ovs-vsctl -- add-port br-int hv3-vif1 -- \ +check ovs-vsctl -- add-port br-int hv3-vif1 -- \ set interface hv3-vif1 external-ids:iface-id=outside1 \ options:tx_pcap=hv3/vif1-tx.pcap \ options:rxq_pcap=hv3/vif1-rx.pcap \ @@ -10173,46 +10250,46 @@ OVN_POPULATE_ARP ovn-nbctl create Logical_Router name=R1 -ovn-nbctl ls-add foo -ovn-nbctl ls-add alice -ovn-nbctl ls-add outside +check ovn-nbctl ls-add foo +check ovn-nbctl ls-add alice +check ovn-nbctl ls-add outside # Connect foo to R1 -ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24 -ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \ +check ovn-nbctl lrp-add R1 foo 00:00:01:01:02:03 192.168.1.1/24 +check ovn-nbctl lsp-add foo rp-foo -- set Logical_Switch_Port rp-foo \ type=router options:router-port=foo \ -- lsp-set-addresses rp-foo router # Connect alice to R1 as distributed router gateway port on hv2 -ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24 \ +check ovn-nbctl lrp-add R1 alice 00:00:02:01:02:03 172.16.1.1/24 \ -- lrp-set-gateway-chassis alice hv2 -ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \ +check ovn-nbctl lsp-add alice rp-alice -- set Logical_Switch_Port rp-alice \ type=router options:router-port=alice \ -- lsp-set-addresses rp-alice router # Create logical port foo1 in foo -ovn-nbctl lsp-add foo foo1 \ --- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2" +check ovn-nbctl lsp-add foo foo1 \ + -- lsp-set-addresses foo1 "f0:00:00:01:02:03 192.168.1.2" # Create logical port outside1 in outside -ovn-nbctl lsp-add outside outside1 \ --- lsp-set-addresses outside1 "f0:00:00:01:02:04 172.16.1.3" +check ovn-nbctl lsp-add outside outside1 \ + -- lsp-set-addresses outside1 "f0:00:00:01:02:04 172.16.1.3" # Create localnet port in alice -ovn-nbctl lsp-add alice ln-alice -ovn-nbctl lsp-set-addresses ln-alice unknown -ovn-nbctl lsp-set-type ln-alice localnet -ovn-nbctl lsp-set-options ln-alice network_name=phys +check ovn-nbctl lsp-add alice ln-alice +check ovn-nbctl lsp-set-addresses ln-alice unknown +check ovn-nbctl lsp-set-type ln-alice localnet +check ovn-nbctl lsp-set-options ln-alice network_name=phys # Create localnet port in outside -ovn-nbctl lsp-add outside ln-outside -ovn-nbctl lsp-set-addresses ln-outside unknown -ovn-nbctl lsp-set-type ln-outside localnet -ovn-nbctl lsp-set-options ln-outside network_name=phys +check ovn-nbctl lsp-add outside ln-outside +check ovn-nbctl lsp-set-addresses ln-outside unknown +check ovn-nbctl lsp-set-type ln-outside localnet +check ovn-nbctl lsp-set-options ln-outside network_name=phys # Create bridge-mappings on hv1 and hv3, leaving hv2 for later -as hv1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys -as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check as hv1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check as hv3 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys dnl Allow some time for ovn-northd and ovn-controller to catch up. @@ -11443,8 +11520,10 @@ echo "---------------------" ovn-sbctl list chassis ovn-sbctl list encap echo "---------------------" -echo "------ Gateway_Chassis dump (SBDB) -------" -ovn-sbctl list Gateway_Chassis +echo "------ ha_Chassis_Group dump (SBDB) -------" +ovn-sbctl list HA_Chassis_Group +echo "------ ha_Chassis dump (SBDB) -------" +ovn-sbctl list HA_Chassis echo "------ Port_Binding chassisredirect -------" ovn-sbctl find Port_Binding type=chassisredirect echo "-------------------------------------------" @@ -12625,42 +12704,42 @@ ra_test() { rm -f expected } -# Baseline test with no MTU +echo "Baseline test with no MTU" ra_test 0 00 0 0 0 c0 40 aef00000000000000000000000000000 -# Now make sure an MTU option makes it +echo "Now make sure an MTU option makes it" ovn-nbctl --wait=hv set Logical_Router_Port ro-sw ipv6_ra_configs:mtu=1500 ra_test 000005dc 00 0 0 0 c0 40 aef00000000000000000000000000000 -# Now test for multiple network prefixes +echo "Now test for multiple network prefixes" ovn-nbctl --wait=hv set Logical_Router_port ro-sw networks='aef0\:\:1/64 fd0f\:\:1/48' ra_test 000005dc 00 0 0 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000 -# Test PRF for default gw +echo "Test PRF for default gw" ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:router_preference="LOW" ra_test 000005dc 18 0 0 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000 -# Now test for RDNSS +echo "Now test for RDNSS" ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:rdnss='aef0::11' dns_addr=aef00000000000000000000000000011 ra_test 000005dc 18 $dns_addr 0 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000 -# Now test for DNSSL +echo "Now test for DNSSL" ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:dnssl="aa.bb.cc" ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:router_preference="HIGH" dnssl=02616102626202636300000000000000 ra_test 000005dc 08 $dns_addr $dnssl 0 c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000 -# Now test Route Info option +echo "Now test Route Info option" ovn-nbctl --wait=hv set Logical_Router_port ro-sw ipv6_ra_configs:route_info="HIGH-aef1::11/48,LOW-aef2::11/96" route_info=18023008ffffffffaef100000000000018036018ffffffffaef20000000000000000000000000000 ra_test 000005dc 08 $dns_addr $dnssl $route_info c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000 - -## Test a different address mode now +exit 0 +echo "Test a different address mode now" ovn-nbctl --wait=hv set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=dhcpv6_stateful ra_test 000005dc 88 $dns_addr $dnssl $route_info 80 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000 -# And the other address mode +echo "And the other address mode" ovn-nbctl --wait=hv set Logical_Router_Port ro-sw ipv6_ra_configs:address_mode=dhcpv6_stateless ra_test 000005dc 48 $dns_addr $dnssl $route_info c0 40 aef00000000000000000000000000000 30 fd0f0000000000000000000000000000 @@ -12698,7 +12777,7 @@ test_ip_packet() { local reply=${eth_src}${eth_dst}08004500003000004000${reply_icmp_ttl}01${exp_ip_chksum}${ipv4_dst}${ipv4_src}${reply_icmp_payload} echo $reply$orig_pkt_in_reply >> vif$inport.expected - as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet + check as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet } # test_ipv6_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_DST EXP_ICMP_CHKSUM @@ -12716,7 +12795,7 @@ test_ipv6_packet() { local reply=${eth_src}${eth_dst}86dd6000000000383aff${ipv6_dst}${ipv6_src}0101${exp_icmp_chksum}00000000${ip6_hdr}0000000000000000 echo $reply >> vif$inport.expected - as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet + check as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet } # test_tcp_syn_packet INPORT HV ETH_SRC ETH_DST IPV4_SRC IPV4_DST IP_CHKSUM TCP_SPORT TCP_DPORT TCP_CHKSUM EXP_IP_CHKSUM EXP_TCP_RST_CHKSUM @@ -12744,7 +12823,7 @@ test_tcp_syn_packet() { local reply=${eth_src}${eth_dst}08004500002800004000${tcp_rst_ttl}06${exp_ip_chksum}${ipv4_dst}${ipv4_src}${tcp_dport}${tcp_sport}000000000000000250140000${exp_tcp_rst_chksum}0000 echo $reply >> vif$inport.expected - as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet + check as hv$hv ovs-appctl netdev-dummy/receive vif$inport $packet } # Create hypervisors hv[123]. @@ -12752,18 +12831,18 @@ test_tcp_syn_packet() { # Add all of the vifs to a single logical switch sw0. net_add n1 -ovn-nbctl ls-add sw0 +check ovn-nbctl ls-add sw0 for i in 1 2 3; do sim_add hv$i as hv$i - ovs-vsctl add-br br-phys + check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.$i for j in 1 2 3; do ovn-nbctl lsp-add sw0 sw0-p$i$j -- \ lsp-set-addresses sw0-p$i$j "00:00:00:00:00:$i$j 192.168.1.$i$j" - ovs-vsctl -- add-port br-int vif$i$j -- \ + check ovs-vsctl -- add-port br-int vif$i$j -- \ set interface vif$i$j \ external-ids:iface-id=sw0-p$i$j \ options:tx_pcap=hv$i/vif$i$j-tx.pcap \ @@ -12780,12 +12859,15 @@ for i in 1 2 3; do : > vif${i}1.expected done -ovn-nbctl --log acl-add sw0 to-lport 1000 "outport == \"sw0-p12\"" reject -ovn-nbctl --log acl-add sw0 from-lport 1000 "inport == \"sw0-p11\"" reject -ovn-nbctl --log acl-add sw0 from-lport 1000 "inport == \"sw0-p21\"" reject +check ovn-nbctl --log acl-add sw0 to-lport 1000 "outport == \"sw0-p12\"" reject +check ovn-nbctl --log acl-add sw0 from-lport 1000 "inport == \"sw0-p11\"" reject +check ovn-nbctl --log acl-add sw0 from-lport 1000 "inport == \"sw0-p21\"" reject # Allow some time for ovn-northd and ovn-controller to catch up. -ovn-nbctl --timeout=3 --wait=hv sync +check ovn-nbctl --wait=hv sync + +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) test_ip_packet 11 1 000000000011 000000000021 $(ip_to_hex 192 168 1 11) $(ip_to_hex 192 168 1 21) 0000 f85b f576 test_ip_packet 21 2 000000000021 000000000011 $(ip_to_hex 192 168 1 21) $(ip_to_hex 192 168 1 11) 0000 f85b f576 @@ -13348,28 +13430,31 @@ ovn-nbctl --id=@p get Logical_Switch_Port lp3 -- add Port_Group pg2 ports @p ovn-nbctl --wait=sb sync dnl Check if port group address sets were populated with ports' addresses -AT_CHECK([ovn-sbctl get Address_Set pg1_ip4 addresses], - [0], [[["10.1.0.2", "10.2.0.2"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg2_ip4 addresses], - [0], [[["10.2.0.2", "10.3.0.2"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg1_ip6 addresses], - [0], [[["2001:db8:1::ff:fe00:1", "2001:db8:2::ff:fe00:2"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg2_ip6 addresses], - [0], [[["2001:db8:2::ff:fe00:2", "2001:db8:3::ff:fe00:3"]] +AT_CHECK( + [ovn-sbctl get Address_Set pg1_ip4 addresses \ + -- get Address_Set pg2_ip4 addresses \ + -- get Address_Set pg1_ip6 addresses \ + -- get Address_Set pg2_ip6 addresses], + [0], + [[["10.1.0.2", "10.2.0.2"]] +[["10.2.0.2", "10.3.0.2"]] +[["2001:db8:1::ff:fe00:1", "2001:db8:2::ff:fe00:2"]] +[["2001:db8:2::ff:fe00:2", "2001:db8:3::ff:fe00:3"]] ]) +dnl Check if updated address got propagated to the port group address sets ovn-nbctl --wait=sb set Logical_Switch ls1 \ other_config:subnet=10.11.0.0/24 other_config:ipv6_prefix="2001:db8:11::" - -dnl Check if updated address got propagated to the port group address sets -AT_CHECK([ovn-sbctl get Address_Set pg1_ip4 addresses], - [0], [[["10.11.0.2", "10.2.0.2"]] -]) -AT_CHECK([ovn-sbctl get Address_Set pg1_ip6 addresses], - [0], [[["2001:db8:11::ff:fe00:1", "2001:db8:2::ff:fe00:2"]] +AT_CHECK( + [ovn-sbctl get Address_Set pg1_ip4 addresses \ + -- get Address_Set pg2_ip4 addresses \ + -- get Address_Set pg1_ip6 addresses \ + -- get Address_Set pg2_ip6 addresses], + [0], + [[["10.11.0.2", "10.2.0.2"]] +[["10.2.0.2", "10.3.0.2"]] +[["2001:db8:11::ff:fe00:1", "2001:db8:2::ff:fe00:2"]] +[["2001:db8:2::ff:fe00:2", "2001:db8:3::ff:fe00:3"]] ]) AT_CLEANUP @@ -13925,6 +14010,10 @@ for sf in 0 1; do # allow rule is still effective.. check ovn-nbctl --wait=hv acl-add lsw0 from-lport 2000 "inport == lp31 && ip" allow-related fi + # dump information and flows with counters + ovn-sbctl dump-flows -- list multicast_group > sbflows$sf + AT_CAPTURE_FILE([sbflows0]) + AT_CAPTURE_FILE([sbflows1]) for is in 1 2 3; do s=${is}1 for id in 1 2 3; do @@ -13949,52 +14038,48 @@ for sf in 0 1; do done done -# Clean up the ACL -ovn-nbctl acl-del lsw0 - -# dump information and flows with counters -ovn-sbctl dump-flows -- list multicast_group - -echo "------ hv1 dump ------" -as hv1 ovs-vsctl show -as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int - -echo "------ hv2 dump ------" -as hv2 ovs-vsctl show -as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int - -echo "------ hv3 dump ------" -as hv3 ovs-vsctl show -as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int +as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int > offlows1 +as hv2 ovs-ofctl -O OpenFlow13 dump-flows br-int > offlows2 +as hv3 ovs-ofctl -O OpenFlow13 dump-flows br-int > offlows3 # Now check the packets actually received against the ones expected. -for i in 1 2 3; do - OVN_CHECK_PACKETS([hv$i/vif${i}1-tx.pcap], [${i}1.expected]) -done - -# need to verify the log for ACL hit as well, since in the allow case -# (unlike the drop case) it is tricky to pass just with the expected; -# since with the stateful rule the packet will still get by (default -# rule) even if it doesn't hit the allow rule. -# The hit count for the ACL is 6 (1 unicast + 2 non-unicast) * 2 -# (with/without stateful rule) for hv1 and hv2, each. - -hv1_drop_acl_hit=`grep acl_log hv1/ovn-controller.log | grep "|INFO|name=\"drop-acl\"" | wc -l` -hv2_drop_acl_hit=`grep acl_log hv2/ovn-controller.log | grep "|INFO|name=\"drop-acl\"" | wc -l` - -hv1_allow_acl_hit=`grep acl_log hv1/ovn-controller.log | grep "|INFO|name=\"allow-acl\"" | wc -l` -hv2_allow_acl_hit=`grep acl_log hv2/ovn-controller.log | grep "|INFO|name=\"allow-acl\"" | wc -l` - -echo "hv1_drop hit $hv1_drop_acl_hit" -echo "hv2_drop hit $hv2_drop_acl_hit" -echo "hv1_allow hit $hv1_allow_acl_hit" -echo "hv2_allow hit $hv2_allow_acl_hit" - -AT_CHECK([test $hv1_drop_acl_hit = 6]) -AT_CHECK([test $hv2_drop_acl_hit = 6]) +AT_CAPTURE_FILE([expected]) +AT_CAPTURE_FILE([received]) +check_packets() { + > expected + > received + for i in 1 2 3; do + echo "--- hv$i vif${i}1" | tee -a expected >> received + sort ${i}1.expected >> expected + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv$i/vif${i}1-tx.pcap | sort >> received + echo | tee -a expected >> received + done -AT_CHECK([test $hv1_allow_acl_hit = 6]) -AT_CHECK([test $hv2_allow_acl_hit = 6]) + # need to verify the log for ACL hit as well, since in the allow case + # (unlike the drop case) it is tricky to pass just with the expected; + # since with the stateful rule the packet will still get by (default + # rule) even if it doesn't hit the allow rule. + # The hit count for the ACL is 6 (1 unicast + 2 non-unicast) * 2 + # (with/without stateful rule) for hv1 and hv2, each. + cat >>expected <>received </dev/null +} +OVS_WAIT_UNTIL([check_packets], [$at_diff -F'^---' expected received]) OVN_CLEANUP([hv1],[hv2],[hv3]) @@ -14455,17 +14540,21 @@ port_binding logical_port=ls1-lp_ext1` # No DHCPv4/v6 flows for the external port - ls1-lp_ext1 - 10.0.0.6 in hv1 and hv2 # as no localnet port added to ls1 yet. -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +# +# This used to be specific to a particular OpenFlow table, but that can +# easily shift around as OVN evolves, so it's been removed to avoid +# gratuitous breakage. +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.06" | wc -l], [0], [0 ]) -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.06" | wc -l], [0], [0 ]) -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l], [0], [0 ]) -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l], [0], [0 ]) @@ -14487,38 +14576,40 @@ logical_port=ls1-lp_ext1` test "$chassis" = "$hv1_uuid"]) # There should be DHCPv4/v6 OF flows for the ls1-lp_ext1 port in hv1 -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +(ovn-sbctl dump-flows lr0; ovn-sbctl dump-flows ls1) > sbflows +as hv1 ovs-ofctl dump-flows br-int > brintflows +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.06" | grep reg14=0x$ln_public_key | \ wc -l], [0], [3 ]) -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | \ grep reg14=0x$ln_public_key | wc -l], [0], [1 ]) # There should be no DHCPv4/v6 flows for ls1-lp_ext1 on hv2 -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.06" | wc -l], [0], [0 ]) -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | wc -l], [0], [0 ]) # No DHCPv4/v6 flows for the external port - ls1-lp_ext2 - 10.0.0.7 in hv1 and # hv2 as requested-chassis option is not set. -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.07" | wc -l], [0], [0 ]) -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.07" | wc -l], [0], [0 ]) -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.07" | wc -l], [0], [0 ]) -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.07" | wc -l], [0], [0 ]) @@ -14766,21 +14857,21 @@ logical_port=ls1-lp_ext1` test "$chassis" = "$hv2_uuid"]) # There should be OF flows for DHCP4/v6 for the ls1-lp_ext1 port in hv2 -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.06" | grep reg14=0x$ln_public_key | \ wc -l], [0], [3 ]) -AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv2 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | \ grep reg14=0x$ln_public_key | wc -l], [0], [1 ]) # There should be no DHCPv4/v6 flows for ls1-lp_ext1 on hv1 -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep "0a.00.00.06" | wc -l], [0], [0 ]) -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | grep table=23 | \ +AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ grep controller | grep tp_src=546 | grep \ "ae.70.00.00.00.00.00.00.00.00.00.00.00.00.00.06" | \ grep reg14=0x$ln_public_key | wc -l], [0], [0 @@ -15356,7 +15447,7 @@ reset_pcap_file() { } test_ip_packet_larger() { - local icmp_pmtu_reply_expected=$1 + local mtu=$1 # Send ip packet from sw0-port1 to outside src_mac="505400000001" # sw-port1 mac @@ -15377,13 +15468,16 @@ test_ip_packet_larger() { gw_ip_garp=ffffffffffff00002020121308060001080006040001000020201213aca80064000000000000aca80064 + packet_bytes=$(expr ${#packet} / 2) + mtu_needed=$(expr ${packet_bytes} - 18) + # If icmp_pmtu_reply_expected is 0, it means the packet is lesser than # the gateway mtu and should be delivered to the provider bridge via the # localnet port. # If icmp_pmtu_reply_expected is 1, it means the packet is larger than # the gateway mtu and ovn-controller should drop the packet and instead # generate ICMPv4 Destination Unreachable message with pmtu set to 100. - if test $icmp_pmtu_reply_expected = 0; then + if test $mtu -ge $mtu_needed; then # Packet to expect at br-phys. src_mac="000020201213" dst_mac="00000012af11" @@ -15399,15 +15493,13 @@ test_ip_packet_larger() { echo $expected > br_phys_n1.expected echo $gw_ip_garp >> br_phys_n1.expected else - # MTU would be 118 - 18 = 100 (hex 0064) - mtu=0064 src_ip=`ip_to_hex 10 0 0 1` dst_ip=`ip_to_hex 10 0 0 3` # pkt len should be 146 (28 (icmp packet) + 118 (orig ip + payload)) reply_pkt_len=0092 ip_csum=f993 icmp_reply=${src_mac}${dst_mac}08004500${reply_pkt_len}00004000fe016867 - icmp_reply=${icmp_reply}${src_ip}${dst_ip}0304${ip_csum}0000${mtu} + icmp_reply=${icmp_reply}${src_ip}${dst_ip}0304${ip_csum}0000$(printf "%04x" $mtu) icmp_reply=${icmp_reply}4500${pkt_len}000000003f01c4d9 icmp_reply=${icmp_reply}${orig_packet_l3} echo $icmp_reply > hv1-vif1.expected @@ -15417,9 +15509,9 @@ test_ip_packet_larger() { as hv1 reset_pcap_file hv1-vif1 hv1/vif1 # Send packet from sw0-port1 to outside - as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet + check as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet - if test $icmp_pmtu_reply_expected = 0; then + if test $mtu -ge $mtu_needed; then OVN_CHECK_PACKETS([hv1/br-phys_n1-tx.pcap], [br_phys_n1.expected]) $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif1-tx.pcap > pkts # hv1/vif1-tx.pcap can receive the GARP packet generated by ovn-controller @@ -15438,7 +15530,7 @@ test_ip_packet_larger() { } test_ip6_packet_larger() { - local icmp_pmtu_reply_expected=$1 + local mtu=$1 local eth_src=505400000001 local eth_dst=00000000ff01 @@ -15459,21 +15551,48 @@ test_ip6_packet_larger() { as hv1 reset_pcap_file hv1-vif1 hv1/vif1 # Send packet from sw0-port1 to outside - as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet + tcpdump_hex ">> sending packet:" $packet + check as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet + AT_CHECK([as hv1 ovs-appctl ofproto/trace br-int in_port=hv1-vif1 $packet > trace-$mtu], + [0], [ignore]) + AT_CAPTURE_FILE([trace-$mtu]) + + packet_bytes=$(expr ${#packet} / 2) + mtu_needed=$(expr ${packet_bytes} - 18) + if test $mtu -lt $mtu_needed; then + # First construct the inner IPv6 packet. + inner_ip6=6000000000583afe${ipv6_src}${ipv6_dst} + inner_icmp6=8000000062f00001 + inner_icmp6_and_payload=$(icmp6_csum_inplace ${inner_icmp6}${payload} ${inner_ip6}) + inner_packet=${inner_ip6}${inner_icmp6_and_payload} + + # Then the outer. + outer_ip6=6000000000883afe${ipv6_rt}${ipv6_src} + outer_icmp6_and_payload=$(icmp6_csum_inplace 020000000000$(printf "%04x" $mtu)${inner_packet} $outer_ip6) + outer_packet=${outer_ip6}${outer_icmp6_and_payload} + + icmp6_reply=${eth_src}${eth_dst}86dd${outer_packet} + + echo + tcpdump_hex ">> expecting reply packet" $icmp6_reply - if test $icmp_pmtu_reply_expected = 1; then - icmp6_reply=${eth_src}${eth_dst}86dd6000000000883afe - icmp6_reply=${icmp6_reply}${ipv6_rt}${ipv6_src}020041ff00000076 - icmp6_reply=${icmp6_reply}6000000000583afe${ipv6_src}${ipv6_dst} - icmp6_reply=${icmp6_reply}8000ec7662f00001${payload} - echo $icmp6_reply > hv1-vif1.expected + # The "trace" above sends a second packets as a side effect. + (echo $icmp6_reply; echo $icmp6_reply) > hv1-vif1.expected OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [hv1-vif1.expected]) fi } -ovn-nbctl show -ovn-sbctl show +ovn-nbctl --wait=hv sync + +ovn-nbctl show > nbdump +AT_CAPTURE_FILE([nbdump]) + +ovn-sbctl show > sbdump +AT_CAPTURE_FILE([sbdump]) + +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) AT_CHECK([as hv1 ovs-ofctl dump-flows br-int \ | grep "check_pkt_larger" | wc -l], [0], [[0 @@ -15483,34 +15602,27 @@ awk '{print $3}') ovn-sbctl create MAC_Binding ip=172.168.0.3 datapath=$dp_uuid \ logical_port=lr0-public mac="00\:00\:00\:12\:af\:11" -# Set the gateway mtu to 100. If the packet length is > 118, ovn-controller -# should send icmp host not reachable with pmtu set to 100. -ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=100 -as hv3 ovs-appctl netdev-dummy/receive hv3-vif1 $arp_reply -OVS_WAIT_UNTIL([ - test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(118)" | \ - wc -l` -eq 1 -]) - -icmp_reply_expected=1 -test_ip_packet_larger $icmp_reply_expected +# Try different gateway mtus and send a 142-byte packet (corresponding +# to a 124-byte MTU). If the MTU is less than 124, ovn-controller +# should send icmp host not reachable with pmtu set to $mtu. +for mtu in 100 500 118; do + AS_BOX([testing mtu $mtu]) + check ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=$mtu + ovn-sbctl dump-flows > sbflows-$mtu + AT_CAPTURE_FILE([sbflows-$mtu]) -# Set the gateway mtu to 500. -ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=500 -as hv3 ovs-appctl netdev-dummy/receive hv3-vif1 $arp_reply -OVS_WAIT_UNTIL([ - test `as hv1 ovs-ofctl dump-flows br-int | grep "check_pkt_larger(518)" | \ - wc -l` -eq 1 + OVS_WAIT_FOR_OUTPUT([ + as hv1 ovs-ofctl dump-flows br-int > br-int-flows-$mtu + AT_CAPTURE_FILE([br-int-flows-$mtu]) + grep "check_pkt_larger($(expr $mtu + 18))" br-int-flows-$mtu | wc -l], [0], [1 ]) -# Now the packet should be sent via the localnet port to br-phys. -icmp_reply_expected=0 -test_ip_packet_larger $icmp_reply_expected + AS_BOX([testing mtu $mtu - IPv4]) + test_ip_packet_larger $mtu -# Set the gateway mtu to 118 -ovn-nbctl --wait=hv set logical_router_port lr0-public options:gateway_mtu=118 -icmp_reply_expected=1 -test_ip6_packet_larger $icmp_reply_expected + AS_BOX([testing mtu $mtu - IPv6]) + test_ip6_packet_larger $mtu +done OVN_CLEANUP([hv1]) AT_CLEANUP @@ -15632,6 +15744,8 @@ ovn-nbctl lr-nat-add lr0 snat 2002::1 2001::/64 OVN_POPULATE_ARP ovn-nbctl --wait=hv sync +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) src_mac=f00000010203 src_ip=$(ip_to_hex 192 168 1 2) @@ -15672,6 +15786,9 @@ OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) ovn-nbctl lr-nat-del lr0 snat ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.16.1.2 192.168.1.3 sw0-p1 f0:00:00:01:02:04 ovn-nbctl lr-route-add lr0 172.16.2.0/24 172.16.1.11 +ovn-nbctl --wait=hv sync +ovn-sbctl dump-flows > sbflows2 +AT_CAPTURE_FILE([sbflows2]) dst_ip=$(ip_to_hex 172 16 2 10) fip_ip=$(ip_to_hex 172 16 1 2) @@ -15704,64 +15821,66 @@ ovn_start # GARPs have been sent out to the external network as well. # Create logical switches -ovn-nbctl ls-add sw0 -ovn-nbctl ls-add sw1 -ovn-nbctl ls-add pub +check ovn-nbctl ls-add sw0 +check ovn-nbctl ls-add sw1 +check ovn-nbctl ls-add pub # Created localnet port on public switch -ovn-nbctl lsp-add pub ln-pub -ovn-nbctl lsp-set-type ln-pub localnet -ovn-nbctl lsp-set-addresses ln-pub unknown -ovn-nbctl lsp-set-options ln-pub network_name=phys +check ovn-nbctl lsp-add pub ln-pub +check ovn-nbctl lsp-set-type ln-pub localnet +check ovn-nbctl lsp-set-addresses ln-pub unknown +check ovn-nbctl lsp-set-options ln-pub network_name=phys # Create logical routers and connect them to public switch -ovn-nbctl create Logical_Router name=lr0 -ovn-nbctl create Logical_Router name=lr1 +AT_CHECK([(ovn-nbctl create Logical_Router name=lr0; + ovn-nbctl create Logical_Router name=lr1) | uuidfilt], [0], [<0> +<1> +]) -ovn-nbctl lrp-add lr0 lr0-pub f0:00:00:00:00:01 172.24.4.220/24 -ovn-nbctl lsp-add pub pub-lr0 -- set Logical_Switch_Port pub-lr0 \ +check ovn-nbctl lrp-add lr0 lr0-pub f0:00:00:00:00:01 172.24.4.220/24 +check ovn-nbctl lsp-add pub pub-lr0 -- set Logical_Switch_Port pub-lr0 \ type=router options:router-port=lr0-pub options:nat-addresses="router" addresses="router" -ovn-nbctl lrp-add lr1 lr1-pub f0:00:00:00:01:01 172.24.4.221/24 -ovn-nbctl lsp-add pub pub-lr1 -- set Logical_Switch_Port pub-lr1 \ +check ovn-nbctl lrp-add lr1 lr1-pub f0:00:00:00:01:01 172.24.4.221/24 +check ovn-nbctl lsp-add pub pub-lr1 -- set Logical_Switch_Port pub-lr1 \ type=router options:router-port=lr1-pub options:nat-addresses="router" addresses="router" -ovn-nbctl lrp-set-gateway-chassis lr0-pub hv1 10 -ovn-nbctl lrp-set-gateway-chassis lr1-pub hv1 10 +check ovn-nbctl lrp-set-gateway-chassis lr0-pub hv1 10 +check ovn-nbctl lrp-set-gateway-chassis lr1-pub hv1 10 # Connect sw0 and sw1 to lr0 and lr1 -ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.254/24 -ovn-nbctl lsp-add sw0 sw0-lr0 -- set Logical_Switch_Port sw0-lr0 type=router \ +check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.254/24 +check ovn-nbctl lsp-add sw0 sw0-lr0 -- set Logical_Switch_Port sw0-lr0 type=router \ options:router-port=lr0-sw0 addresses="router" -ovn-nbctl lrp-add lr1 lr1-sw1 00:00:00:00:ff:02 20.0.0.254/24 -ovn-nbctl lsp-add sw1 sw1-lr1 -- set Logical_Switch_Port sw1-lr1 type=router \ +check ovn-nbctl lrp-add lr1 lr1-sw1 00:00:00:00:ff:02 20.0.0.254/24 +check ovn-nbctl lsp-add sw1 sw1-lr1 -- set Logical_Switch_Port sw1-lr1 type=router \ options:router-port=lr1-sw1 addresses="router" # Add SNAT rules -ovn-nbctl lr-nat-add lr0 snat 172.24.4.220 10.0.0.0/24 -ovn-nbctl lr-nat-add lr1 snat 172.24.4.221 20.0.0.0/24 +check ovn-nbctl lr-nat-add lr0 snat 172.24.4.220 10.0.0.0/24 +check ovn-nbctl lr-nat-add lr1 snat 172.24.4.221 20.0.0.0/24 net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 172.24.4.1 -ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys -ovs-vsctl add-port br-int vif0 -- set Interface vif0 external-ids:iface-id=lp0 -ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 +check ovs-vsctl add-port br-int vif0 -- set Interface vif0 external-ids:iface-id=lp0 +check ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lp1 -ovn-nbctl lsp-add sw0 lp0 -ovn-nbctl lsp-add sw1 lp1 -ovn-nbctl lsp-set-addresses lp0 "50:54:00:00:00:01 10.0.0.10" -ovn-nbctl lsp-set-addresses lp1 "50:54:00:00:00:02 20.0.0.10" +check ovn-nbctl lsp-add sw0 lp0 +check ovn-nbctl lsp-add sw1 lp1 +check ovn-nbctl lsp-set-addresses lp0 "50:54:00:00:00:01 10.0.0.10" +check ovn-nbctl lsp-set-addresses lp1 "50:54:00:00:00:02 20.0.0.10" OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp0` = xup]) OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lp1` = xup]) # Create two floating IPs, one for each VIF -ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.24.4.100 10.0.0.10 -ovn-nbctl lr-nat-add lr1 dnat_and_snat 172.24.4.200 20.0.0.10 +check ovn-nbctl lr-nat-add lr0 dnat_and_snat 172.24.4.100 10.0.0.10 +check ovn-nbctl lr-nat-add lr1 dnat_and_snat 172.24.4.200 20.0.0.10 # Check that the MAC_Binding entries have been properly created wait_row_count MAC_Binding 1 logical_port=lr0-pub ip=172.24.4.200 @@ -15770,19 +15889,21 @@ wait_row_count MAC_Binding 1 logical_port=lr1-pub ip=172.24.4.100 # Check that the GARPs went also to the external physical network # Wait until at least 4 packets have arrived and copy them to a separate file as # more GARPs are expected in the capture in order to avoid race conditions. -OVS_WAIT_UNTIL([test `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | wc -l` -gt 4]) -$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | head -n4 > hv1/br-phys-tx4.pcap - +# +# The expected output is: # GARP for lp0 172.24.4.100 on lr0-pub MAC (f0:00:00:00:00:01) -echo "fffffffffffff0000000000108060001080006040001f00000000001ac180464000000000000ac180464" > expout # GARP for 172.24.4.220 on lr0-pub (f0:00:00:00:00:01) -echo "fffffffffffff0000000000108060001080006040001f00000000001ac1804dc000000000000ac1804dc" >> expout # GARP for lp1 172.24.4.200 on lr1-pub MAC (f0:00:00:00:01:01) -echo "fffffffffffff0000000010108060001080006040001f00000000101ac1804c8000000000000ac1804c8" >> expout # GARP for 172.24.4.221 on lr1-pub (f0:00:00:00:01:01) -echo "fffffffffffff0000000010108060001080006040001f00000000101ac1804dd000000000000ac1804dd" >> expout -AT_CHECK([sort hv1/br-phys-tx4.pcap], [0], [expout]) -#OVN_CHECK_PACKETS([hv1/br-phys-tx4.pcap], [br-phys.expected]) + +OVS_WAIT_FOR_OUTPUT( + [$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/br-phys-tx.pcap | sort | uniq], + [0], + [fffffffffffff0000000000108060001080006040001f00000000001ac180464000000000000ac180464 +fffffffffffff0000000000108060001080006040001f00000000001ac1804dc000000000000ac1804dc +fffffffffffff0000000010108060001080006040001f00000000101ac1804c8000000000000ac1804c8 +fffffffffffff0000000010108060001080006040001f00000000101ac1804dd000000000000ac1804dd +]) OVN_CLEANUP([hv1]) AT_CLEANUP @@ -16303,21 +16424,22 @@ ovn-nbctl --wait=hv sync # Check that logical flows are added for sw0-vir in lsp_in_arp_rsp pipeline # with bind_vport action. -ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt +ovn-sbctl dump-flows sw0 > sw0-flows +AT_CAPTURE_FILE([sw0-flows]) -AT_CHECK([cat lflows.txt], [0], [dnl - table=14(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p1" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) - table=14(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p2" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) - table=14(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p3" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) +AT_CHECK([grep ls_in_arp_rsp sw0-flows | grep bind_vport | sed 's/table=../table=??/'], [0], [dnl + table=??(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p1" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) + table=??(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p2" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) + table=??(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p3" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) ]) -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt +ovn-sbctl dump-flows lr0 > lr0-flows +AT_CAPTURE_FILE([lr0-flows]) # Since the sw0-vir is not claimed by any chassis, eth.dst should be set to # zero if the ip4.dst is the virtual ip in the router pipeline. -AT_CHECK([cat lflows.txt], [0], [dnl - table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 00:00:00:00:00:00; next;) +AT_CHECK([grep lr_in_arp_resolve lr0-flows | grep "reg0 == 10.0.0.10" | sed 's/table=../table=??/'], [0], [dnl + table=??(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 00:00:00:00:00:00; next;) ]) hv1_ch_uuid=`ovn-sbctl --bare --columns _uuid find chassis name="hv1"` @@ -16358,13 +16480,13 @@ logical_port=sw0-vir) = x$hv1_ch_uuid], [0], []) AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = xsw0-p1]) -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt # There should be an arp resolve flow to resolve the virtual_ip with the # sw0-p1's MAC. -AT_CHECK([cat lflows.txt], [0], [dnl - table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:03; next;) +ovn-sbctl dump-flows lr0 > lr0-flows2 +AT_CAPTURE_FILE([lr0-flows2]) +AT_CHECK([grep lr_in_arp_resolve lr0-flows2 | grep "reg0 == 10.0.0.10" | sed 's/table=../table=??/'], [0], [dnl + table=??(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:03; next;) ]) # Forcibly clear virtual_parent. ovn-controller should release the binding @@ -16399,13 +16521,15 @@ logical_port=sw0-vir) = x$hv1_ch_uuid], [0], []) OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = xsw0-p3]) -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt # There should be an arp resolve flow to resolve the virtual_ip with the # sw0-p2's MAC. -AT_CHECK([cat lflows.txt], [0], [dnl - table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:05; next;) +sleep 1 +ovn-sbctl dump-flows lr0 > lr0-flows3 +AT_CAPTURE_FILE([lr0-flows3]) +cp ovn-sb/ovn-sb.db lr0-flows3.db +AT_CHECK([grep lr_in_arp_resolve lr0-flows3 | grep "reg0 == 10.0.0.10" | sed 's/table=../table=??/'], [0], [dnl + table=??(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:05; next;) ]) # send the garp from sw0-p2 (in hv2). hv2 should claim sw0-vir @@ -16422,13 +16546,14 @@ logical_port=sw0-vir) = x$hv2_ch_uuid], [0], []) AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = xsw0-p2]) -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt # There should be an arp resolve flow to resolve the virtual_ip with the # sw0-p3's MAC. -AT_CHECK([cat lflows.txt], [0], [dnl - table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:04; next;) +sleep 1 +ovn-sbctl dump-flows lr0 > lr0-flows4 +AT_CAPTURE_FILE([lr0-flows4]) +AT_CHECK([grep lr_in_arp_resolve lr0-flows4 | grep "reg0 == 10.0.0.10" | sed 's/table=../table=??/'], [0], [dnl + table=??(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:04; next;) ]) # Now send arp reply from sw0-p1. hv1 should claim sw0-vir @@ -16446,11 +16571,10 @@ sleep 1 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = xsw0-p1]) -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt - -AT_CHECK([cat lflows.txt], [0], [dnl - table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:03; next;) +ovn-sbctl dump-flows lr0 > lr0-flows5 +AT_CAPTURE_FILE([lr0-flows5]) +AT_CHECK([grep lr_in_arp_resolve lr0-flows5 | grep "reg0 == 10.0.0.10" | sed 's/table=../table=??/'], [0], [dnl + table=??(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:03; next;) ]) # Delete hv1-vif1 port. hv1 should release sw0-vir @@ -16465,11 +16589,10 @@ logical_port=sw0-vir) = x]) # Since the sw0-vir is not claimed by any chassis, eth.dst should be set to # zero if the ip4.dst is the virtual ip. -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt - -AT_CHECK([cat lflows.txt], [0], [dnl - table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 00:00:00:00:00:00; next;) +ovn-sbctl dump-flows lr0 > lr0-flows6 +AT_CAPTURE_FILE([lr0-flows6]) +AT_CHECK([grep lr_in_arp_resolve lr0-flows6 | grep "reg0 == 10.0.0.10" | sed 's/table=../table=??/'], [0], [dnl + table=??(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 00:00:00:00:00:00; next;) ]) # Now send arp reply from sw0-p2. hv2 should claim sw0-vir @@ -16479,18 +16602,18 @@ eth_dst=ffffffffffff spa=$(ip_to_hex 10 0 0 10) tpa=$(ip_to_hex 10 0 0 3) send_arp_reply 2 1 $eth_src $eth_dst $spa $tpa +sleep 1 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \ logical_port=sw0-vir) = x$hv2_ch_uuid], [0], []) - +sleep 1 AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = xsw0-p2]) -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt - -AT_CHECK([cat lflows.txt], [0], [dnl - table=13(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:04; next;) +ovn-sbctl dump-flows lr0 > lr0-flows7 +AT_CAPTURE_FILE([lr0-flows7]) +AT_CHECK([grep lr_in_arp_resolve lr0-flows7 | grep "reg0 == 10.0.0.10" | sed 's/table=../table=??/'], [0], [dnl + table=??(lr_in_arp_resolve ), priority=100 , match=(outport == "lr0-sw0" && reg0 == 10.0.0.10), action=(eth.dst = 50:54:00:00:00:04; next;) ]) # Delete sw0-p2 logical port @@ -16498,39 +16621,34 @@ ovn-nbctl lsp-del sw0-p2 OVS_WAIT_UNTIL([test x$(ovn-sbctl --bare --columns chassis find port_binding \ logical_port=sw0-vir) = x], [0], []) - AT_CHECK([test x$(ovn-sbctl --bare --columns virtual_parent find port_binding \ logical_port=sw0-vir) = x]) # Clear virtual_ip column of sw0-vir. There should be no bind_vport flows. ovn-nbctl --wait=hv remove logical_switch_port sw0-vir options virtual-ip -ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt - -AT_CHECK([cat lflows.txt], [0], [dnl -]) +ovn-sbctl dump-flows sw0 > sw0-flows2 +AT_CAPTURE_FILE([sw0-flows2]) +AT_CHECK([grep ls_in_arp_rsp sw0-flows2 | grep bind_vport], [1]) # Add back virtual_ip and clear virtual_parents. ovn-nbctl --wait=hv set logical_switch_port sw0-vir options:virtual-ip=10.0.0.10 -ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt - -AT_CHECK([cat lflows.txt], [0], [dnl - table=14(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p1" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) - table=14(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p3" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) +ovn-sbctl dump-flows sw0 > sw0-flows3 +AT_CAPTURE_FILE([sw0-flows3]) +AT_CHECK([grep ls_in_arp_rsp sw0-flows3 | grep bind_vport | sed 's/table=../table=??/'], [0], [dnl + table=??(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p1" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) + table=??(ls_in_arp_rsp ), priority=100 , match=(inport == "sw0-p3" && ((arp.op == 1 && arp.spa == 10.0.0.10 && arp.tpa == 10.0.0.10) || (arp.op == 2 && arp.spa == 10.0.0.10))), action=(bind_vport("sw0-vir", inport); next;) ]) ovn-nbctl --wait=hv remove logical_switch_port sw0-vir options virtual-parents -ovn-sbctl dump-flows sw0 | grep ls_in_arp_rsp | grep bind_vport > lflows.txt - -AT_CHECK([cat lflows.txt], [0], [dnl -]) +ovn-sbctl dump-flows sw0 > sw0-flows4 +AT_CAPTURE_FILE([sw0-flows4]) +AT_CHECK([grep ls_in_arp_rsp sw0-flows4 | grep bind_vport], [1]) -ovn-sbctl dump-flows lr0 | grep lr_in_arp_resolve | grep "reg0 == 10.0.0.10" \ -> lflows.txt - -AT_CHECK([cat lflows.txt], [0], [dnl -]) +ovn-sbctl dump-flows lr0 > lr0-flows8 +AT_CAPTURE_FILE([lr0-flows8]) +AT_CHECK([grep lr_in_arp_resolve lr0-flows8 | grep "reg0 == 10.0.0.10"], [1]) OVN_CLEANUP([hv1], [hv2]) AT_CLEANUP @@ -16625,16 +16743,21 @@ ovn-nbctl --wait=hv meter-add event-elb drop 100 pktps 10 OVN_POPULATE_ARP ovn-nbctl --timeout=3 --wait=hv sync -ovn-sbctl lflow-list -as hv1 ovs-ofctl dump-flows br-int +ovn-sbctl lflow-list > sbflows +AT_CAPTURE_FILE([sbflows]) +as hv1 ovs-ofctl dump-flows br-int > offlows +AT_CAPTURE_FILE([offlows]) packet0="inport==\"sw0-p11\" && eth.src==00:00:00:00:00:11 && eth.dst==00:00:00:00:00:21 && ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==192.168.1.100 && tcp && tcp.src==10000 && tcp.dst==80" as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet0" -ovn-sbctl list controller_event -uuid=$(ovn-sbctl list controller_event | awk '/_uuid/{print $3}') +ovn-sbctl list controller_event > events +AT_CAPTURE_FILE([events]) +uuid=$(awk '/_uuid/{print $3}' < events) +echo uuid=$uuid +AT_CHECK([test -n "$uuid"]) AT_CHECK([ovn-sbctl get controller_event $uuid event_type], [0], [dnl empty_lb_backends ]) @@ -16711,10 +16834,10 @@ ovn_start reset_pcap_file() { local iface=$1 local pcap_file=$2 - ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ options:rxq_pcap=dummy-rx.pcap rm -f ${pcap_file}*.pcap - ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ options:rxq_pcap=${pcap_file}-rx.pcap } @@ -16750,7 +16873,7 @@ send_igmp_v3_report() { local packet=${eth}${ip}${igmp} echo ${packet} >> ${outfile} - as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} + check as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} } # @@ -16795,7 +16918,7 @@ send_ip_multicast_pkt() { local ip=450000${ip_len}95f14000${ip_ttl}${proto}${ip_chksum}${ip_src}${ip_dst} local packet=${eth}${ip}${data} - as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} + check as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} } # @@ -16842,11 +16965,11 @@ ovn-nbctl lsp-add sw1 sw1-rtr \ -- lsp-set-type sw1-rtr router \ -- lsp-set-addresses sw1-rtr 00:00:00:00:01:00 \ -- lsp-set-options sw1-rtr router-port=rtr-sw1 -ovn-nbctl lsp-add sw2 sw2-rtr \ +check ovn-nbctl lsp-add sw2 sw2-rtr \ -- lsp-set-type sw2-rtr router \ -- lsp-set-addresses sw2-rtr 00:00:00:00:02:00 \ -- lsp-set-options sw2-rtr router-port=rtr-sw2 -ovn-nbctl lsp-add sw3 sw3-rtr \ +check ovn-nbctl lsp-add sw3 sw3-rtr \ -- lsp-set-type sw3-rtr router \ -- lsp-set-addresses sw3-rtr 00:00:00:00:03:00 \ -- lsp-set-options sw3-rtr router-port=rtr-sw3 @@ -16854,24 +16977,24 @@ ovn-nbctl lsp-add sw3 sw3-rtr \ net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=sw1-p11 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=sw1-p12 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif3 -- \ +check ovs-vsctl -- add-port br-int hv1-vif3 -- \ set interface hv1-vif3 external-ids:iface-id=sw2-p1 \ options:tx_pcap=hv1/vif3-tx.pcap \ options:rxq_pcap=hv1/vif3-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif4 -- \ +check ovs-vsctl -- add-port br-int hv1-vif4 -- \ set interface hv1-vif4 external-ids:iface-id=sw3-p1 \ options:tx_pcap=hv1/vif4-tx.pcap \ options:rxq_pcap=hv1/vif4-rx.pcap \ @@ -16880,24 +17003,24 @@ ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys sim_add hv2 as hv2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 -ovs-vsctl -- add-port br-int hv2-vif1 -- \ +check ovs-vsctl -- add-port br-int hv2-vif1 -- \ set interface hv2-vif1 external-ids:iface-id=sw1-p21 \ options:tx_pcap=hv2/vif1-tx.pcap \ options:rxq_pcap=hv2/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv2-vif2 -- \ +check ovs-vsctl -- add-port br-int hv2-vif2 -- \ set interface hv2-vif2 external-ids:iface-id=sw1-p22 \ options:tx_pcap=hv2/vif2-tx.pcap \ options:rxq_pcap=hv2/vif2-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv2-vif3 -- \ +check ovs-vsctl -- add-port br-int hv2-vif3 -- \ set interface hv2-vif3 external-ids:iface-id=sw2-p2 \ options:tx_pcap=hv2/vif3-tx.pcap \ options:rxq_pcap=hv2/vif3-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv2-vif4 -- \ +check ovs-vsctl -- add-port br-int hv2-vif4 -- \ set interface hv2-vif4 external-ids:iface-id=sw3-p2 \ options:tx_pcap=hv2/vif4-tx.pcap \ options:rxq_pcap=hv2/vif4-rx.pcap \ @@ -16911,15 +17034,32 @@ check ovn-nbctl --wait=hv set Logical_Switch sw1 \ other_config:mcast_querier="false" \ other_config:mcast_snoop="true" +AT_CAPTURE_FILE([sbflows]) +cp ovn-sb/ovn-sb.db ovn-sb.db +ovn-sbctl dump-flows > sbflows + # No IGMP query should be generated by sw1 (mcast_querier="false"). +# (Therefore everything is expected to be empty.) +AT_CAPTURE_FILE([expected]) +AT_CAPTURE_FILE([received]) > expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected]) +> received +for i in 1 2; do + for j in 1 2; do + pcap=hv$i/vif$j-tx.pcap + echo "--- $pcap" | tee -a expected >> received + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> received + echo | tee -a expected >> received + done +done +check $at_diff -F'^---' expected received check ovn-nbctl --wait=hv sync +AT_CAPTURE_FILE([sbflows2]) +cp ovn-sb/ovn-sb.db ovn-sb2.db +ovn-sbctl dump-flows > sbflows2 + # Inject IGMP Join for 239.0.1.68 on sw1-p11. send_igmp_v3_report hv1-vif1 hv1 \ 000000000001 $(ip_to_hex 10 0 0 1) f9f8 \ @@ -16931,12 +17071,13 @@ send_igmp_v3_report hv2-vif1 hv2 000000000002 $(ip_to_hex 10 0 0 2) f9f9 \ /dev/null # Check that the IGMP Group is learned on both hv. -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "239.0.1.68" -c` - test "${total_entries}" = "2" -]) +wait_row_count IGMP_Group 2 address=239.0.1.68 check ovn-nbctl --wait=hv sync +AT_CAPTURE_FILE([sbflows3]) +cp ovn-sb/ovn-sb.db ovn-sb3.db +ovn-sbctl dump-flows > sbflows3 + # Send traffic and make sure it gets forwarded only on the two ports that # joined. > expected @@ -16950,12 +17091,30 @@ store_ip_multicast_pkt \ $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \ e518e518000a3b3a0000 expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) +AT_CAPTURE_FILE([exp]) +AT_CAPTURE_FILE([rcv]) +check_packets() { + > exp + > rcv + for tuple in "$@"; do + set $tuple; pcap=$1 type=$2 + echo "--- $pcap" | tee -a exp >> rcv + sort "$type" >> exp + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> rcv + echo | tee -a exp >> rcv + done + + $at_diff exp rcv >/dev/null +} + +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected' \ + 'hv2/vif1-tx.pcap expected' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Inject IGMP Leave for 239.0.1.68 on sw1-p11. send_igmp_v3_report hv1-vif1 hv1 \ @@ -16981,15 +17140,17 @@ store_ip_multicast_pkt \ $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 20 ca70 11 \ e518e518000a3b3a0000 expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Flush IGMP groups. -ovn-sbctl ip-multicast-flush sw1 +check ovn-sbctl ip-multicast-flush sw1 wait_row_count IGMP_Group 0 address=239.0.1.68 check ovn-nbctl --wait=hv sync @@ -17019,12 +17180,14 @@ store_ip_multicast_pkt \ $(ip_to_hex 10 0 0 42) $(ip_to_hex 224 0 0 42) 1e 01 f989 11 \ e518e518000a4b540000 expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected' \ + 'hv2/vif1-tx.pcap expected' \ + 'hv2/vif2-tx.pcap expected'], + [$at_diff -F'^---' exp rcv]) # Enable IGMP snooping and querier on sw2 and set query interval to minimum. -ovn-nbctl set Logical_Switch sw2 \ +check ovn-nbctl set Logical_Switch sw2 \ other_config:mcast_snoop="true" \ other_config:mcast_querier="true" \ other_config:mcast_query_interval=1 \ @@ -17036,16 +17199,17 @@ ovn-nbctl set Logical_Switch sw2 \ store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected store_igmp_v3_query 0000000002fe $(ip_to_hex 20 0 0 254) 84dd expected -sleep 1 -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif3-tx.pcap expected' \ + 'hv2/vif3-tx.pcap expected'], + [$at_diff -F'^---' exp rcv]) # Disable IGMP querier on sw2. -ovn-nbctl set Logical_Switch sw2 \ +check ovn-nbctl set Logical_Switch sw2 \ other_config:mcast_querier="false" # Enable IGMP snooping on sw3. -ovn-nbctl set Logical_Switch sw3 \ +check ovn-nbctl set Logical_Switch sw3 \ other_config:mcast_querier="false" \ other_config:mcast_snoop="true" @@ -17070,17 +17234,19 @@ send_ip_multicast_pkt hv2-vif4 hv2 \ # Sleep a bit to make sure no traffic is received and then check. sleep 1 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_empty' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv1/vif4-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Enable IGMP relay on rtr -ovn-nbctl set logical_router rtr \ +check ovn-nbctl set logical_router rtr \ options:mcast_relay="true" # Inject IGMP Join for 239.0.1.68 on sw1-p11. @@ -17126,14 +17292,16 @@ store_ip_multicast_pkt \ $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \ e518e518000a3b3a0000 expected_routed_sw2 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_routed_sw1]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_routed_sw2]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_routed_sw1' \ + 'hv2/vif3-tx.pcap expected_routed_sw2' \ + 'hv1/vif4-tx.pcap expected_empty' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Inject IGMP Join for 239.0.1.68 on sw3-p1. send_igmp_v3_report hv1-vif4 hv1 \ @@ -17193,14 +17361,16 @@ store_ip_multicast_pkt \ $(ip_to_hex 10 0 0 42) $(ip_to_hex 239 0 1 68) 1e 1f cb70 11 \ e518e518000a3b3a0000 expected_routed_sw2 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_routed_sw1]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_routed_sw2]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_switched]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_routed_sw1' \ + 'hv2/vif3-tx.pcap expected_routed_sw2' \ + 'hv1/vif4-tx.pcap expected_switched' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Flush IGMP groups. ovn-sbctl ip-multicast-flush sw1 @@ -17269,14 +17439,18 @@ store_ip_multicast_pkt \ # Check that traffic is switched to sw1-p11 and sw1-p12 # Check that IGMP join is flooded on sw1-p21 # Check that traffic is routed by rtr to rtr-sw2 and then switched to sw2-p1 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_switched]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_switched]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_routed]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_reports]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +AT_CAPTURE_FILE([expected]) +AT_CAPTURE_FILE([received]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_switched' \ + 'hv1/vif2-tx.pcap expected_switched' \ + 'hv1/vif3-tx.pcap expected_routed' \ + 'hv1/vif4-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_reports' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # With ovn-monitor-all=true, make sure ovn-controllers don't delete each # other's IGMP_Group records. @@ -17345,10 +17519,10 @@ ovn_start reset_pcap_file() { local iface=$1 local pcap_file=$2 - ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ options:rxq_pcap=dummy-rx.pcap rm -f ${pcap_file}*.pcap - ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ + check ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ options:rxq_pcap=${pcap_file}-rx.pcap } @@ -17385,7 +17559,7 @@ send_mld_v2_report() { local packet=${eth}${ip}${mld} echo ${packet} >> ${outfile} - as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} + check as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} } # @@ -17432,7 +17606,7 @@ send_ip_multicast_pkt() { local ip=60000000${ip_len}${proto}${ip_ttl}${ip_src}${ip_dst} local packet=${eth}${ip}${data} - as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} + check as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} } # @@ -17479,11 +17653,11 @@ ovn-nbctl lsp-add sw1 sw1-rtr \ -- lsp-set-type sw1-rtr router \ -- lsp-set-addresses sw1-rtr 00:00:00:00:01:00 \ -- lsp-set-options sw1-rtr router-port=rtr-sw1 -ovn-nbctl lsp-add sw2 sw2-rtr \ +check ovn-nbctl lsp-add sw2 sw2-rtr \ -- lsp-set-type sw2-rtr router \ -- lsp-set-addresses sw2-rtr 00:00:00:00:02:00 \ -- lsp-set-options sw2-rtr router-port=rtr-sw2 -ovn-nbctl lsp-add sw3 sw3-rtr \ +check ovn-nbctl lsp-add sw3 sw3-rtr \ -- lsp-set-type sw3-rtr router \ -- lsp-set-addresses sw3-rtr 00:00:00:00:03:00 \ -- lsp-set-options sw3-rtr router-port=rtr-sw3 @@ -17506,24 +17680,24 @@ ovn-nbctl ls-lb-add sw3 lb0 net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=sw1-p11 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=sw1-p12 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif3 -- \ +check ovs-vsctl -- add-port br-int hv1-vif3 -- \ set interface hv1-vif3 external-ids:iface-id=sw2-p1 \ options:tx_pcap=hv1/vif3-tx.pcap \ options:rxq_pcap=hv1/vif3-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif4 -- \ +check ovs-vsctl -- add-port br-int hv1-vif4 -- \ set interface hv1-vif4 external-ids:iface-id=sw3-p1 \ options:tx_pcap=hv1/vif4-tx.pcap \ options:rxq_pcap=hv1/vif4-rx.pcap \ @@ -17532,46 +17706,77 @@ ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys sim_add hv2 as hv2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 -ovs-vsctl -- add-port br-int hv2-vif1 -- \ +check ovs-vsctl -- add-port br-int hv2-vif1 -- \ set interface hv2-vif1 external-ids:iface-id=sw1-p21 \ options:tx_pcap=hv2/vif1-tx.pcap \ options:rxq_pcap=hv2/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv2-vif2 -- \ +check ovs-vsctl -- add-port br-int hv2-vif2 -- \ set interface hv2-vif2 external-ids:iface-id=sw1-p22 \ options:tx_pcap=hv2/vif2-tx.pcap \ options:rxq_pcap=hv2/vif2-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv2-vif3 -- \ +check ovs-vsctl -- add-port br-int hv2-vif3 -- \ set interface hv2-vif3 external-ids:iface-id=sw2-p2 \ options:tx_pcap=hv2/vif3-tx.pcap \ options:rxq_pcap=hv2/vif3-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv2-vif4 -- \ +check ovs-vsctl -- add-port br-int hv2-vif4 -- \ set interface hv2-vif4 external-ids:iface-id=sw3-p2 \ options:tx_pcap=hv2/vif4-tx.pcap \ options:rxq_pcap=hv2/vif4-rx.pcap \ ofport-request=1 ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check ovn-nbctl --wait=hv sync + +AT_CAPTURE_FILE([sbflows]) +ovn-sbctl dump-flows > sbflows + +AT_CAPTURE_FILE([exp]) +AT_CAPTURE_FILE([rcv]) +check_packets() { + > exp + > rcv + if test "$1" = --uniq; then + sort="sort -u"; shift + else + sort=sort + fi + for tuple in "$@"; do + set $tuple; pcap=$1 type=$2 + echo "--- $pcap" | tee -a exp >> rcv + $sort "$type" >> exp + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | $sort >> rcv + echo | tee -a exp >> rcv + done + + $at_diff exp rcv # >/dev/null +} + OVN_POPULATE_ARP # Enable multicast snooping on sw1. -ovn-nbctl set Logical_Switch sw1 \ +check ovn-nbctl --wait=hv set Logical_Switch sw1 \ other_config:mcast_querier="false" \ other_config:mcast_snoop="true" # No IGMP/MLD query should be generated by sw1 (mcast_querier="false"). > expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected' \ + 'hv1/vif2-tx.pcap expected' \ + 'hv2/vif1-tx.pcap expected' \ + 'hv2/vif2-tx.pcap expected'], + [$at_diff -F'^---' exp rcv]) check ovn-nbctl --wait=hv sync +AT_CAPTURE_FILE([sbflows2]) +ovn-sbctl dump-flows > sbflows2 + # Inject MLD Join for ff0a:dead:beef::1 on sw1-p11. send_mld_v2_report hv1-vif1 hv1 \ 000000000001 10000000000000000000000000000001 \ @@ -17589,6 +17794,9 @@ wait_row_count IGMP_Group 2 address='"ff0a:dead:beef::1"' # This gives the ovn-controller nodes a chance to see the new IGMP_Group. check ovn-nbctl --wait=hv sync +AT_CAPTURE_FILE([sbflows3]) +ovn-sbctl dump-flows > sbflows3 + # Send traffic and make sure it gets forwarded only on the two ports that # joined. > expected @@ -17606,12 +17814,14 @@ store_ip_multicast_pkt \ 93407a69000e1b5e61736461640a \ expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected' \ + 'hv2/vif1-tx.pcap expected' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Inject MLD Leave for ff0a:dead:beef::1 on sw1-p11. send_mld_v2_report hv1-vif1 hv1 \ @@ -17640,15 +17850,17 @@ store_ip_multicast_pkt \ 93407a69000e1b5e61736461640a \ expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Flush IP multicast groups. -ovn-sbctl ip-multicast-flush sw1 +check ovn-sbctl ip-multicast-flush sw1 wait_row_count IGMP_Group 0 address='"ff0a:dead:beef::1"' # Check that traffic for "all-hosts" is flooded even if some hosts register @@ -17680,9 +17892,11 @@ store_ip_multicast_pkt \ 93407a69000eb90361736461640a \ expected -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected' \ + 'hv2/vif1-tx.pcap expected' \ + 'hv2/vif2-tx.pcap expected'], + [$at_diff -F'^---' exp rcv]) # Enable multicast snooping and querier on sw2 and set query interval to # minimum. @@ -17693,16 +17907,31 @@ check ovn-nbctl --wait=hv set Logical_Switch sw2 \ other_config:mcast_eth_src="00:00:00:00:02:fe" \ other_config:mcast_ip6_src="fe80::fe" -# Wait for 1 query interval (1 sec) and check that two queries are generated. +AT_CAPTURE_FILE([sbflows4]) +ovn-sbctl dump-flows > sbflows4 + +# Check that multiple queries are generated over time. > expected store_mld_query 0000000002fe fe8000000000000000000000000000fe expected store_mld_query 0000000002fe fe8000000000000000000000000000fe expected - -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected]) +for count in 1 2 3; do + as hv1 reset_pcap_file hv1-vif1 hv1/vif1 + as hv1 reset_pcap_file hv1-vif2 hv1/vif2 + as hv1 reset_pcap_file hv1-vif3 hv1/vif3 + as hv1 reset_pcap_file hv1-vif4 hv1/vif4 + as hv2 reset_pcap_file hv2-vif1 hv2/vif1 + as hv2 reset_pcap_file hv2-vif2 hv2/vif2 + as hv2 reset_pcap_file hv2-vif3 hv2/vif3 + as hv2 reset_pcap_file hv2-vif4 hv2/vif4 + OVS_WAIT_UNTIL( + [check_packets --uniq \ + 'hv1/vif3-tx.pcap expected' \ + 'hv2/vif3-tx.pcap expected'], + [$at_diff -F'^---' exp rcv]) +done # Disable multicast querier on sw2. -ovn-nbctl set Logical_Switch sw2 \ +check ovn-nbctl set Logical_Switch sw2 \ other_config:mcast_querier="false" # Enable multicast snooping on sw3. @@ -17710,6 +17939,9 @@ check ovn-nbctl --wait=sb set Logical_Switch sw3 \ other_config:mcast_querier="false" \ other_config:mcast_snoop="true" +AT_CAPTURE_FILE([sbflows5]) +ovn-sbctl dump-flows > sbflows5 + # Send traffic from sw3 and make sure rtr doesn't relay it. > expected_empty @@ -17730,18 +17962,23 @@ send_ip_multicast_pkt hv2-vif4 hv2 \ # Sleep a bit to make sure no traffic is received and then check. sleep 1 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_empty' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv1/vif4-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Enable multicast relay on rtr check ovn-nbctl --wait=sb set logical_router rtr options:mcast_relay="true" +AT_CAPTURE_FILE([sbflows6]) +ovn-sbctl dump-flows > sbflows6 + # Inject MLD Join for ff0a:dead:beef::1 on sw1-p11. send_mld_v2_report hv1-vif1 hv1 \ 000000000001 10000000000000000000000000000001 \ @@ -17790,14 +18027,16 @@ store_ip_multicast_pkt \ 93407a69000e1b5e61736461640a \ expected_routed_sw2 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_routed_sw1]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_routed_sw2]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_routed_sw1' \ + 'hv2/vif3-tx.pcap expected_routed_sw2' \ + 'hv1/vif4-tx.pcap expected_empty' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Inject MLD Join for 239.0.1.68 on sw3-p1. send_mld_v2_report hv1-vif4 hv1 \ @@ -17864,23 +18103,22 @@ store_ip_multicast_pkt \ 93407a69000e1b5e61736461640a \ expected_routed_sw2 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_routed_sw1]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_routed_sw2]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_switched]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_routed_sw1' \ + 'hv2/vif3-tx.pcap expected_routed_sw2' \ + 'hv1/vif4-tx.pcap expected_switched' \ + 'hv1/vif2-tx.pcap expected_empty' \ + 'hv1/vif3-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_empty' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) # Flush multicast groups. -ovn-sbctl ip-multicast-flush sw1 -ovn-sbctl ip-multicast-flush sw2 -ovn-sbctl ip-multicast-flush sw3 -OVS_WAIT_UNTIL([ - total_entries=`ovn-sbctl find IGMP_Group | grep "ff0a:dead:beef::1" -c` - test "${total_entries}" = "0" -]) +check ovn-sbctl ip-multicast-flush sw1 +check ovn-sbctl ip-multicast-flush sw2 +check ovn-sbctl ip-multicast-flush sw3 +wait_row_count IGMP_Group 0 address='"ff0a:dead:beef::1"' as hv1 reset_pcap_file hv1-vif1 hv1/vif1 as hv1 reset_pcap_file hv1-vif2 hv1/vif2 @@ -17897,16 +18135,16 @@ as hv2 reset_pcap_file hv2-vif4 hv2/vif4 > expected_reports # Enable mcast_flood on sw1-p11 -ovn-nbctl set Logical_Switch_Port sw1-p11 options:mcast_flood='true' +check ovn-nbctl set Logical_Switch_Port sw1-p11 options:mcast_flood='true' # Enable mcast_flood_reports on sw1-p21 -ovn-nbctl set Logical_Switch_Port sw1-p21 options:mcast_flood_reports='true' +check ovn-nbctl set Logical_Switch_Port sw1-p21 options:mcast_flood_reports='true' # Enable mcast_flood on rtr-sw2 -ovn-nbctl set Logical_Router_Port rtr-sw2 options:mcast_flood='true' +check ovn-nbctl set Logical_Router_Port rtr-sw2 options:mcast_flood='true' # Enable mcast_flood on sw2-p1 -ovn-nbctl set Logical_Switch_Port sw2-p1 options:mcast_flood='true' +check ovn-nbctl set Logical_Switch_Port sw2-p1 options:mcast_flood='true' -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync # Inject MLD Join for ff0a:dead:beef::1 on sw1-p12. send_mld_v2_report hv1-vif2 hv1 \ @@ -17940,17 +18178,22 @@ store_ip_multicast_pkt \ # Sleep a bit to make sure no duplicate traffic is received sleep 1 +AT_CAPTURE_FILE([sbflows7]) +ovn-sbctl dump-flows > sbflows7 + # Check that traffic is switched to sw1-p11 and sw1-p12 # Check that MLD join is flooded on sw1-p21 # Check that traffic is routed by rtr to rtr-sw2 and then switched to sw2-p1 -OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected_switched]) -OVN_CHECK_PACKETS([hv1/vif2-tx.pcap], [expected_switched]) -OVN_CHECK_PACKETS([hv1/vif3-tx.pcap], [expected_routed]) -OVN_CHECK_PACKETS([hv1/vif4-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif1-tx.pcap], [expected_reports]) -OVN_CHECK_PACKETS([hv2/vif2-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif3-tx.pcap], [expected_empty]) -OVN_CHECK_PACKETS([hv2/vif4-tx.pcap], [expected_empty]) +OVS_WAIT_UNTIL( + [check_packets 'hv1/vif1-tx.pcap expected_switched' \ + 'hv1/vif2-tx.pcap expected_switched' \ + 'hv1/vif3-tx.pcap expected_routed' \ + 'hv1/vif4-tx.pcap expected_empty' \ + 'hv2/vif1-tx.pcap expected_reports' \ + 'hv2/vif2-tx.pcap expected_empty' \ + 'hv2/vif3-tx.pcap expected_empty' \ + 'hv2/vif4-tx.pcap expected_empty'], + [$at_diff -F'^---' exp rcv]) OVN_CLEANUP([hv1], [hv2]) AT_CLEANUP @@ -17976,7 +18219,8 @@ AT_CLEANUP m4_define([DVR_N_S_ARP_HANDLING], - [AT_SETUP([ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S ARP handling, encap $1]) + [OVN_FOR_EACH_NORTHD([ + AT_SETUP([ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S ARP handling, encap $1]) set -x encap=$1 ovn_start @@ -18171,29 +18415,26 @@ m4_define([DVR_N_S_ARP_HANDLING], # Dump a bunch of info helpful for debugging if there's a failure. - echo "------ OVN dump ------" - ovn-nbctl show - ovn-sbctl show - ovn-sbctl list port_binding - ovn-sbctl list mac_binding + ovn-sbctl dump-flows > sbflows + AT_CAPTURE_FILE([sbflows]) - echo "------ hv1 dump ------" - as hv1 ovs-vsctl show - as hv1 ovs-vsctl list Open_Vswitch + (ovn-nbctl show + ovn-sbctl show + ovn-sbctl list port_binding + ovn-sbctl list mac_binding) > ovndump + AT_CAPTURE_FILE([ovndump]) - echo "------ hv2 dump ------" - as hv2 ovs-vsctl show - as hv2 ovs-vsctl list Open_Vswitch + (as hv1 ovs-vsctl show; as hv1 ovs-vsctl list Open_Vswitch) > hv1dump + AT_CAPTURE_FILE([hv1dump]) - echo "------ hv3 dump ------" - as hv3 ovs-vsctl show - as hv3 ovs-vsctl list Open_Vswitch + (as hv2 ovs-vsctl show; as hv2 ovs-vsctl list Open_Vswitch) > hv2dump + AT_CAPTURE_FILE([hv2dump]) - echo "------ hv4 dump ------" - as hv4 ovs-vsctl show - as hv4 ovs-vsctl list Open_Vswitch + (as hv3 ovs-vsctl show; as hv3 ovs-vsctl list Open_Vswitch) > hv3dump + AT_CAPTURE_FILE([hv3dump]) - OVS_WAIT_UNTIL([test x`ovn-sbctl --bare --columns chassis find port_binding logical_port=cr-router-to-underlay | wc -l` = x1]) + (as hv4 ovs-vsctl show; as hv4 ovs-vsctl list Open_Vswitch) > hv4dump + AT_CAPTURE_FILE([hv4dump]) test_arp vif-north f0f000000011 $sip $tip 000001010207 @@ -18214,13 +18455,14 @@ m4_define([DVR_N_S_ARP_HANDLING], # validate max_tunid reflects the type of encapsulation used max_tunid=`ovn-nbctl get NB_Global . options:max_tunid | sed s/":"//g | sed s/\"//g` - echo $max_tunid if [[ $encap = vxlan ]]; then max_tunid_expected=4095 else max_tunid_expected=16711680 fi - AT_CHECK([test $max_tunid -eq $max_tunid_expected]) + echo max_tunid=$max_tunid max_tunid_expected=$max_tunid_expected + AT_CHECK([test -n "$max_tunid"]) + AT_CHECK([test "$max_tunid" -eq "$max_tunid_expected"]) echo "----------- Post Traffic hv1 dump -----------" as hv1 ovs-ofctl -O OpenFlow13 dump-flows br-int @@ -18240,13 +18482,14 @@ m4_define([DVR_N_S_ARP_HANDLING], OVN_CLEANUP([hv1],[hv2],[hv3],[hv4]) - AT_CLEANUP]) + AT_CLEANUP])]) DVR_N_S_ARP_HANDLING([geneve]) DVR_N_S_ARP_HANDLING([vxlan]) m4_define([DVR_N_S_PING], - [AT_SETUP([ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S Ping, encap $1]) + [OVN_FOR_EACH_NORTHD([ + AT_SETUP([ovn -- 2 HVs, 2 lports/HV, localnet ports, DVR N-S Ping, encap $1]) AT_KEYWORDS([$1]) encap=$1 ovn_start @@ -18541,7 +18784,7 @@ m4_define([DVR_N_S_PING], OVN_CLEANUP([hv1],[hv2],[hv3],[hv4]) - AT_CLEANUP]) + AT_CLEANUP])]) DVR_N_S_PING([geneve]) DVR_N_S_PING([vxlan]) @@ -19086,17 +19329,14 @@ test_ip vif11 f00000000011 000001010203 $sip $dip vif-north OVN_CHECK_PACKETS_REMOVE_BROADCAST([hv4/vif-north-tx.pcap], [vif-north.expected]) # Confirm that NATing happened without connection tracker - -AT_CHECK([ovn-sbctl dump-flows router | grep ct_snat | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows router | grep ct_dnat | wc -l], [0], [0 -]) - -AT_CHECK([ovn-sbctl dump-flows router | grep ip4.dst=| wc -l], [0], [2 -]) - -AT_CHECK([ovn-sbctl dump-flows router | grep ip4.src=| wc -l], [0], [2 +ovn-sbctl dump-flows router > sbflows +AT_CAPTURE_FILE([sbflows]) +AT_CHECK([for regex in ct_snat ct_dnat ip4.dst= ip4.src=; do + grep -c "$regex" sbflows; +done], [0], [0 +0 +2 +2 ]) echo "----------- Post Traffic hv1 dump -----------" @@ -19136,12 +19376,12 @@ sim_add hv1 as hv1 ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=sw0-p1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=sw0-p2 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ @@ -19149,107 +19389,104 @@ ovs-vsctl -- add-port br-int hv1-vif2 -- \ sim_add hv2 as hv2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 -ovs-vsctl -- add-port br-int hv2-vif1 -- \ +check ovs-vsctl -- add-port br-int hv2-vif1 -- \ set interface hv2-vif1 external-ids:iface-id=sw1-p1 \ options:tx_pcap=hv2/vif1-tx.pcap \ options:rxq_pcap=hv2/vif1-rx.pcap \ ofport-request=1 -ovn-nbctl ls-add sw0 - -ovn-nbctl lsp-add sw0 sw0-p1 -ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03 10.0.0.3" -ovn-nbctl lsp-set-port-security sw0-p1 "50:54:00:00:00:03 10.0.0.3" +check ovn-nbctl ls-add sw0 -ovn-nbctl lsp-set-addresses sw0-p2 "50:54:00:00:00:04 10.0.0.4" -ovn-nbctl lsp-set-port-security sw0-p2 "50:54:00:00:00:04 10.0.0.4" +check ovn-nbctl lsp-add sw0 sw0-p1 +check ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03 10.0.0.3" +check ovn-nbctl lsp-set-port-security sw0-p1 "50:54:00:00:00:03 10.0.0.3" # Create port group and ACLs for sw0 ports. -ovn-nbctl pg-add pg0_drop sw0-p1 sw0-p2 -ovn-nbctl acl-add pg0_drop from-lport 1001 "inport == @pg0_drop && ip" drop -ovn-nbctl acl-add pg0_drop to-lport 1001 "outport == @pg0_drop && ip" drop - -ovn-nbctl pg-add pg0 sw0-p1 sw0-p2 -ovn-nbctl acl-add pg0 from-lport 1002 "inport == @pg0 && ip4" allow-related -ovn-nbctl acl-add pg0 to-lport 1002 "outport == @pg0 && ip4 && ip4.src == 0.0.0.0/0 && icmp4" allow-related -ovn-nbctl acl-add pg0 to-lport 1002 "outport == @pg0 && ip4 && ip4.src == 0.0.0.0/0 && tcp && tcp.dst == 80" allow-related -ovn-nbctl acl-add pg0 to-lport 1002 "outport == @pg0 && ip4 && ip4.src == 0.0.0.0/0 && udp && udp.dst == 80" allow-related +check ovn-nbctl pg-add pg0_drop sw0-p1 +check ovn-nbctl acl-add pg0_drop from-lport 1001 "inport == @pg0_drop && ip" drop +check ovn-nbctl acl-add pg0_drop to-lport 1001 "outport == @pg0_drop && ip" drop # Create the second logical switch with one port -ovn-nbctl ls-add sw1 -ovn-nbctl lsp-add sw1 sw1-p1 -ovn-nbctl lsp-set-addresses sw1-p1 "40:54:00:00:00:03 20.0.0.3" -ovn-nbctl lsp-set-port-security sw1-p1 "40:54:00:00:00:03 20.0.0.3" +check ovn-nbctl ls-add sw1 +check ovn-nbctl lsp-add sw1 sw1-p1 +check ovn-nbctl lsp-set-addresses sw1-p1 "40:54:00:00:00:03 20.0.0.3" +check ovn-nbctl lsp-set-port-security sw1-p1 "40:54:00:00:00:03 20.0.0.3" # Create port group and ACLs for sw1 ports. -ovn-nbctl pg-add pg1_drop sw1-p1 -ovn-nbctl acl-add pg1_drop from-lport 1001 "inport == @pg1_drop && ip" drop -ovn-nbctl acl-add pg1_drop to-lport 1001 "outport == @pg1_drop && ip" drop +check ovn-nbctl pg-add pg1_drop sw1-p1 +check ovn-nbctl acl-add pg1_drop from-lport 1001 "inport == @pg1_drop && ip" drop +check ovn-nbctl acl-add pg1_drop to-lport 1001 "outport == @pg1_drop && ip" drop -ovn-nbctl pg-add pg1 sw1-p1 -ovn-nbctl acl-add pg1 from-lport 1002 "inport == @pg1 && ip4" allow-related -ovn-nbctl acl-add pg1 to-lport 1002 "outport == @pg1 && ip4 && ip4.src == 0.0.0.0/0 && icmp4" allow-related -ovn-nbctl acl-add pg1 to-lport 1002 "outport == @pg1 && ip4 && ip4.src == 0.0.0.0/0 && tcp && tcp.dst == 80" allow-related -ovn-nbctl acl-add pg1 to-lport 1002 "outport == @pg1 && ip4 && ip4.src == 0.0.0.0/0 && udp && udp.dst == 80" allow-related +check ovn-nbctl pg-add pg1 sw1-p1 +check ovn-nbctl acl-add pg1 from-lport 1002 "inport == @pg1 && ip4" allow-related +check ovn-nbctl acl-add pg1 to-lport 1002 "outport == @pg1 && ip4 && ip4.src == 0.0.0.0/0 && icmp4" allow-related +check ovn-nbctl acl-add pg1 to-lport 1002 "outport == @pg1 && ip4 && ip4.src == 0.0.0.0/0 && tcp && tcp.dst == 80" allow-related +check ovn-nbctl acl-add pg1 to-lport 1002 "outport == @pg1 && ip4 && ip4.src == 0.0.0.0/0 && udp && udp.dst == 80" allow-related # Create a logical router and attach both logical switches -ovn-nbctl lr-add lr0 -ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24 -ovn-nbctl lsp-add sw0 sw0-lr0 -ovn-nbctl lsp-set-type sw0-lr0 router -ovn-nbctl lsp-set-addresses sw0-lr0 router -ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 +check ovn-nbctl lr-add lr0 +check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24 +check ovn-nbctl lsp-add sw0 sw0-lr0 +check ovn-nbctl lsp-set-type sw0-lr0 router +check ovn-nbctl lsp-set-addresses sw0-lr0 router +check ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 -ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 20.0.0.1/24 -ovn-nbctl lsp-add sw1 sw1-lr0 -ovn-nbctl lsp-set-type sw1-lr0 router -ovn-nbctl lsp-set-addresses sw1-lr0 router -ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1 +check ovn-nbctl lrp-add lr0 lr0-sw1 00:00:00:00:ff:02 20.0.0.1/24 +check ovn-nbctl lsp-add sw1 sw1-lr0 +check ovn-nbctl lsp-set-type sw1-lr0 router +check ovn-nbctl lsp-set-addresses sw1-lr0 router +check ovn-nbctl lsp-set-options sw1-lr0 router-port=lr0-sw1 -ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 +check ovn-nbctl lb-add lb1 10.0.0.10:80 10.0.0.3:80,20.0.0.3:80 -ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2 -ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2 +check ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:10.0.0.3=sw0-p1:10.0.0.2 +check ovn-nbctl --wait=sb set load_balancer . ip_port_mappings:20.0.0.3=sw1-p1:20.0.0.2 -ovn-nbctl --wait=sb -- --id=@hc create \ -Load_Balancer_Health_Check vip="10.0.0.10\:80" -- add Load_Balancer . \ -health_check @hc +AT_CHECK([ovn-nbctl --wait=sb \ + -- --id=@hc create Load_Balancer_Health_Check vip="10.0.0.10\:80" \ + options:failure_count=100 \ + -- add Load_Balancer . health_check @hc | uuidfilt], [0], [<0> +]) -ovn-nbctl --wait=sb ls-lb-add sw0 lb1 -ovn-nbctl --wait=sb ls-lb-add sw1 lb1 -ovn-nbctl --wait=sb lr-lb-add lr0 lb1 +check ovn-nbctl --wait=sb ls-lb-add sw0 lb1 +check ovn-nbctl --wait=sb ls-lb-add sw1 lb1 +check ovn-nbctl --wait=sb lr-lb-add lr0 lb1 -ovn-nbctl ls-add public -ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 -ovn-nbctl lsp-add public public-lr0 -ovn-nbctl lsp-set-type public-lr0 router -ovn-nbctl lsp-set-addresses public-lr0 router -ovn-nbctl lsp-set-options public-lr0 router-port=lr0-public +check ovn-nbctl ls-add public +check ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 +check ovn-nbctl lsp-add public public-lr0 +check ovn-nbctl lsp-set-type public-lr0 router +check ovn-nbctl lsp-set-addresses public-lr0 router +check ovn-nbctl lsp-set-options public-lr0 router-port=lr0-public # localnet port -ovn-nbctl lsp-add public ln-public -ovn-nbctl lsp-set-type ln-public localnet -ovn-nbctl lsp-set-addresses ln-public unknown -ovn-nbctl lsp-set-options ln-public network_name=public +check ovn-nbctl lsp-add public ln-public +check ovn-nbctl lsp-set-type ln-public localnet +check ovn-nbctl lsp-set-addresses ln-public unknown +check ovn-nbctl lsp-set-options ln-public network_name=public # schedule the gw router port to a chassis. Change the name of the chassis -ovn-nbctl --wait=hv lrp-set-gateway-chassis lr0-public hv1 20 +check ovn-nbctl --wait=hv lrp-set-gateway-chassis lr0-public hv1 20 OVN_POPULATE_ARP -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync wait_row_count Service_Monitor 2 -ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +AT_CAPTURE_FILE([sbflows]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows > sbflows + ovn-sbctl dump-flows sw0 | grep ct_lb | grep priority=120 | sed 's/table=..//'], 0, + [ (ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) ]) -ovn-sbctl dump-flows lr0 | grep ct_lb | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=6 (lr_in_dnat ), priority=120 , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) +AT_CAPTURE_FILE([sbflows2]) +OVS_WAIT_FOR_OUTPUT( + [ovn-sbctl dump-flows > sbflows2 + ovn-sbctl dump-flows lr0 | grep ct_lb | grep priority=120 | sed 's/table=..//'], 0, + [ (lr_in_dnat ), priority=120 , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_lb(backends=10.0.0.3:80,20.0.0.3:80);) ]) # get the svc monitor mac. @@ -19266,6 +19503,7 @@ OVS_WAIT_UNTIL( grep "405400000003${svc_mon_src_mac}" | wc -l`] ) +check ovn-nbctl set load_balancer_health_check 10.0.0.10:80 options:failure_count=1 wait_row_count Service_Monitor 2 status=offline OVS_WAIT_UNTIL( @@ -19278,37 +19516,39 @@ OVS_WAIT_UNTIL( grep "405400000003${svc_mon_src_mac}" | wc -l`] ) -ovn-sbctl dump-flows sw0 | grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" \ -| grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=11(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(drop;) +AT_CAPTURE_FILE([sbflows3]) +ovn-sbctl dump-flows sw0 > sbflows3 +AT_CHECK( + [grep "ip4.dst == 10.0.0.10 && tcp.dst == 80" sbflows3 | grep priority=120 |\ + sed 's/table=../table=??/'], [0], + [ table=??(ls_in_stateful ), priority=120 , match=(ct.new && ip4.dst == 10.0.0.10 && tcp.dst == 80), action=(drop;) ]) -ovn-sbctl dump-flows lr0 | grep lr_in_dnat | grep priority=120 > lflows.txt -AT_CHECK([cat lflows.txt], [0], [dnl - table=6 (lr_in_dnat ), priority=120 , match=(ct.est && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_dnat;) - table=6 (lr_in_dnat ), priority=120 , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(drop;) +AT_CAPTURE_FILE([sbflows4]) +ovn-sbctl dump-flows lr0 > sbflows4 +AT_CHECK([grep lr_in_dnat sbflows4 | grep priority=120 | sed 's/table=..//'], [0], [dnl + (lr_in_dnat ), priority=120 , match=(ct.est && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(ct_dnat;) + (lr_in_dnat ), priority=120 , match=(ct.new && ip && ip4.dst == 10.0.0.10 && tcp && tcp.dst == 80 && is_chassis_resident("cr-lr0-public")), action=(drop;) ]) # Delete sw0-p1 -ovn-nbctl lsp-del sw0-p1 +check ovn-nbctl lsp-del sw0-p1 wait_row_count Service_Monitor 1 # Add back sw0-p1 but without any IP address. -ovn-nbctl lsp-add sw0 sw0-p1 -ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03" -- \ -lsp-set-port-security sw0-p1 "50:54:00:00:00:03" +check ovn-nbctl lsp-add sw0 sw0-p1 +check ovn-nbctl lsp-set-addresses sw0-p1 "50:54:00:00:00:03" -- \ + lsp-set-port-security sw0-p1 "50:54:00:00:00:03" wait_row_count Service_Monitor 2 status=offline -ovn-nbctl lsp-del sw0-p1 -ovn-nbctl lsp-del sw1-p1 +check ovn-nbctl lsp-del sw0-p1 +check ovn-nbctl lsp-del sw1-p1 wait_row_count Service_Monitor 0 # Add back sw0-p1 but without any address set. -ovn-nbctl lsp-add sw0 sw0-p1 - +check ovn-nbctl lsp-add sw0 sw0-p1 wait_row_count Service_Monitor 1 wait_row_count Service_Monitor 0 status=offline @@ -19444,7 +19684,7 @@ send_arp_request() { local arp=0001080006040001${eth_src}${spa}${eth_dst}${tpa} local request=${eth}${arp} - as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request + check as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request } send_nd_ns() { @@ -19471,7 +19711,7 @@ send_nd_ns() { local request=${eth}${ip}${icmp6} - as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request + check as hv$hv ovs-appctl netdev-dummy/receive hv${hv}-vif$inport $request } src_mac=000000000001 @@ -19479,63 +19719,63 @@ src_mac=000000000001 net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys -ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check ovs-vsctl add-br br-phys +check ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys ovn_attach n1 br-phys 192.168.0.1 sim_add hv2 as hv2 -ovs-vsctl add-br br-phys -ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys +check ovs-vsctl add-br br-phys +check ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys ovn_attach n1 br-phys 192.168.0.2 # One Aggregation Switch connected to two Logical networks (routers). -ovn-nbctl ls-add sw-agg -ovn-nbctl lsp-add sw-agg sw-agg-ext \ +check ovn-nbctl ls-add sw-agg +check ovn-nbctl lsp-add sw-agg sw-agg-ext \ -- lsp-set-addresses sw-agg-ext 00:00:00:00:00:01 -ovn-nbctl lsp-add sw-agg sw-rtr1 \ +check ovn-nbctl lsp-add sw-agg sw-rtr1 \ -- lsp-set-type sw-rtr1 router \ -- lsp-set-addresses sw-rtr1 00:00:00:00:01:00 \ -- lsp-set-options sw-rtr1 router-port=rtr1-sw -ovn-nbctl lsp-add sw-agg sw-rtr2 \ +check ovn-nbctl lsp-add sw-agg sw-rtr2 \ -- lsp-set-type sw-rtr2 router \ -- lsp-set-addresses sw-rtr2 00:00:00:00:02:00 \ -- lsp-set-options sw-rtr2 router-port=rtr2-sw # Localnet port on the Aggregation Switch. -ovn-nbctl lsp-add sw-agg sw-agg-ln -ovn-nbctl lsp-set-addresses sw-agg-ln unknown -ovn-nbctl lsp-set-type sw-agg-ln localnet -ovn-nbctl lsp-set-options sw-agg-ln network_name=phys +check ovn-nbctl lsp-add sw-agg sw-agg-ln +check ovn-nbctl lsp-set-addresses sw-agg-ln unknown +check ovn-nbctl lsp-set-type sw-agg-ln localnet +check ovn-nbctl lsp-set-options sw-agg-ln network_name=phys # Configure L3 interface IPv4 & IPv6 on both routers. -ovn-nbctl lr-add rtr1 -ovn-nbctl lrp-add rtr1 rtr1-sw 00:00:00:00:01:00 10.0.0.1/24 10::1/64 +check ovn-nbctl lr-add rtr1 +check ovn-nbctl lrp-add rtr1 rtr1-sw 00:00:00:00:01:00 10.0.0.1/24 10::1/64 -ovn-nbctl lrp-add rtr1 rtr1-sw1 00:00:01:00:00:00 20.0.0.1/24 20::1/64 +check ovn-nbctl lrp-add rtr1 rtr1-sw1 00:00:01:00:00:00 20.0.0.1/24 20::1/64 -ovn-nbctl lr-add rtr2 -ovn-nbctl lrp-add rtr2 rtr2-sw 00:00:00:00:02:00 10.0.0.2/24 10::2/64 +check ovn-nbctl lr-add rtr2 +check ovn-nbctl lrp-add rtr2 rtr2-sw 00:00:00:00:02:00 10.0.0.2/24 10::2/64 # Configure router gateway ports. -ovn-nbctl lrp-set-gateway-chassis rtr1-sw hv1 20 -ovn-nbctl lrp-set-gateway-chassis rtr2-sw hv1 20 +check ovn-nbctl lrp-set-gateway-chassis rtr1-sw hv1 20 +check ovn-nbctl lrp-set-gateway-chassis rtr2-sw hv1 20 # One private network behind rtr1 with two VMs. -ovn-nbctl ls-add sw1 -ovn-nbctl lsp-add sw1 sw1-p1 \ +check ovn-nbctl ls-add sw1 +check ovn-nbctl lsp-add sw1 sw1-p1 \ -- lsp-set-addresses sw1-p1 00:00:00:01:00:00 -ovn-nbctl lsp-add sw1 sw1-p2 \ +check ovn-nbctl lsp-add sw1 sw1-p2 \ -- lsp-set-addresses sw1-p2 00:00:00:02:00:00 -ovn-nbctl lsp-add sw1 sw1-rtr1 \ +check ovn-nbctl lsp-add sw1 sw1-rtr1 \ -- lsp-set-type sw1-rtr1 router \ -- lsp-set-addresses sw1-rtr1 00:00:01:00:00:00 \ -- lsp-set-options sw1-rtr1 router-port=rtr1-sw1 # Bind a "VM" connected to sw-agg on hv1. as hv1 -ovs-vsctl -- add-port br-int hv1-vif0 -- \ +check ovs-vsctl -- add-port br-int hv1-vif0 -- \ set interface hv1-vif0 external-ids:iface-id=sw-agg-ext \ options:tx_pcap=hv1/vif0-tx.pcap \ options:rxq_pcap=hv1/vif0-rx.pcap \ @@ -19543,7 +19783,7 @@ ovs-vsctl -- add-port br-int hv1-vif0 -- \ # Bind a "VM" connected to sw1 on hv1. as hv1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=sw1-p1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ @@ -19551,14 +19791,17 @@ ovs-vsctl -- add-port br-int hv1-vif1 -- \ # Bind a "VM" connected to sw1 on hv2. as hv2 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=sw1-p2 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ ofport-request=3 OVN_POPULATE_ARP -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync + +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) sw_dp_uuid=$(ovn-sbctl --bare --columns _uuid list datapath_binding sw-agg) sw_dp_key=$(ovn-sbctl --bare --columns tunnel_key list datapath_binding sw-agg) @@ -19617,16 +19860,16 @@ OVS_WAIT_UNTIL([ ]) # Configure load balancing on both routers. -ovn-nbctl lb-add lb1-v4 10.0.0.11 42.42.42.1 -ovn-nbctl lb-add lb1-v6 10::11 42::1 -ovn-nbctl lr-lb-add rtr1 lb1-v4 -ovn-nbctl lr-lb-add rtr1 lb1-v6 - -ovn-nbctl lb-add lb2-v4 10.0.0.22 42.42.42.2 -ovn-nbctl lb-add lb2-v6 10::22 42::2 -ovn-nbctl lr-lb-add rtr2 lb2-v4 -ovn-nbctl lr-lb-add rtr2 lb2-v6 -ovn-nbctl --wait=hv sync +check ovn-nbctl lb-add lb1-v4 10.0.0.11 42.42.42.1 +check ovn-nbctl lb-add lb1-v6 10::11 42::1 +check ovn-nbctl lr-lb-add rtr1 lb1-v4 +check ovn-nbctl lr-lb-add rtr1 lb1-v6 + +check ovn-nbctl lb-add lb2-v4 10.0.0.22 42.42.42.2 +check ovn-nbctl lb-add lb2-v6 10::22 42::2 +check ovn-nbctl lr-lb-add rtr2 lb2-v4 +check ovn-nbctl lr-lb-add rtr2 lb2-v6 +check ovn-nbctl --wait=hv sync # Inject ARP request for first router owned VIP address. send_arp_request 1 0 ${src_mac} $(ip_to_hex 10 0 0 254) $(ip_to_hex 10 0 0 11) @@ -19673,18 +19916,21 @@ OVS_WAIT_UNTIL([ ]) # Configure NAT on both routers. -ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.111 42.42.42.1 -ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::111 42::1 -ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10.0.0.222 42.42.42.2 -ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10::222 42::2 +check ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.111 42.42.42.1 +check ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::111 42::1 +check ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10.0.0.222 42.42.42.2 +check ovn-nbctl lr-nat-add rtr2 dnat_and_snat 10::222 42::2 check ovn-nbctl --wait=hv sync # Configure FIP1 and FIP2 on rtr1 for sw1-p1 and sw1-p2. -ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.121 20.0.0.11 sw1-p1 00:00:00:01:00:00 -ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::121 20::11 sw1-p1 00:00:00:01:00:00 -ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.122 20.0.0.12 sw1-p2 00:00:00:02:00:00 -ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::122 20::12 sw1-p2 00:00:00:02:00:00 -ovn-nbctl --wait=hv sync +check ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.121 20.0.0.11 sw1-p1 00:00:00:01:00:00 +check ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::121 20::11 sw1-p1 00:00:00:01:00:00 +check ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10.0.0.122 20.0.0.12 sw1-p2 00:00:00:02:00:00 +check ovn-nbctl lr-nat-add rtr1 dnat_and_snat 10::122 20::12 sw1-p2 00:00:00:02:00:00 +check ovn-nbctl --wait=hv sync + +ovn-sbctl dump-flows > sbflows2 +AT_CAPTURE_FILE([sbflows2]) # Check that broadcast domain limiting flows match only on IPs that are # directly reachable via the router port. @@ -19957,14 +20203,20 @@ done for ts in `seq 1 $n_ts`; do ovn-ic-nbctl create Transit_Switch name=ts$ts + for az in `seq 1 $n_az`; do + echo "az$az: wait for ts$ts..." + AT_CHECK([ovn_as az$az ovn-nbctl wait-until logical_switch ts$ts]) + done done for az in `seq 1 $n_az`; do ovn_as az$az - ovn-nbctl set nb_global . options:ic-route-learn=true - ovn-nbctl set nb_global . options:ic-route-adv=true + check ovn-nbctl set nb_global . options:ic-route-learn=true + check ovn-nbctl set nb_global . options:ic-route-adv=true # Each AZ has n_ts LSPi->LSi->LRi connecting to each TSi + echo + echo "az$az" for i in `seq 1 $n_ts`; do lsp_mac=00:00:00:0$az:0$i:00 lrp_ls_mac=00:00:00:0$az:0$i:01 @@ -19973,26 +20225,27 @@ for az in `seq 1 $n_az`; do lrp_ls_ip=10.$az.$i.1 lrp_ts_ip=169.254.$i.$az - ovn-nbctl ls-add ls$az-$i - ovn-nbctl lsp-add ls$az-$i lsp$az-$i - ovn-nbctl lsp-set-addresses lsp$az-$i "$lsp_mac $lsp_ip" + check ovn-nbctl ls-add ls$az-$i + check ovn-nbctl lsp-add ls$az-$i lsp$az-$i + check ovn-nbctl lsp-set-addresses lsp$az-$i "$lsp_mac $lsp_ip" - ovn-nbctl lr-add lr$az-$i + check ovn-nbctl lr-add lr$az-$i - ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ls$az-$i $lrp_ls_mac $lrp_ls_ip/24 - ovn-nbctl lsp-add ls$az-$i lsp-ls$az-$i-lr$az-$i - ovn-nbctl lsp-set-addresses lsp-ls$az-$i-lr$az-$i router - ovn-nbctl lsp-set-type lsp-ls$az-$i-lr$az-$i router - ovn-nbctl lsp-set-options lsp-ls$az-$i-lr$az-$i router-port=lrp-lr$az-$i-ls$az-$i + check ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ls$az-$i $lrp_ls_mac $lrp_ls_ip/24 + check ovn-nbctl lsp-add ls$az-$i lsp-ls$az-$i-lr$az-$i + check ovn-nbctl lsp-set-addresses lsp-ls$az-$i-lr$az-$i router + check ovn-nbctl lsp-set-type lsp-ls$az-$i-lr$az-$i router + check ovn-nbctl lsp-set-options lsp-ls$az-$i-lr$az-$i router-port=lrp-lr$az-$i-ls$az-$i - ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ts$i $lrp_ts_mac $lrp_ts_ip/24 - ovn-nbctl lsp-add ts$i lsp-ts$i-lr$az-$i - ovn-nbctl lsp-set-addresses lsp-ts$i-lr$az-$i router - ovn-nbctl lsp-set-type lsp-ts$i-lr$az-$i router - ovn-nbctl lsp-set-options lsp-ts$i-lr$az-$i router-port=lrp-lr$az-$i-ts$i - ovn-nbctl lrp-set-gateway-chassis lrp-lr$az-$i-ts$i gw$az + check ovn-nbctl lrp-add lr$az-$i lrp-lr$az-$i-ts$i $lrp_ts_mac $lrp_ts_ip/24 + check ovn-nbctl lsp-add ts$i lsp-ts$i-lr$az-$i + check ovn-nbctl lsp-set-addresses lsp-ts$i-lr$az-$i router + check ovn-nbctl lsp-set-type lsp-ts$i-lr$az-$i router + check ovn-nbctl lsp-set-options lsp-ts$i-lr$az-$i router-port=lrp-lr$az-$i-ts$i + check ovn-nbctl lrp-set-gateway-chassis lrp-lr$az-$i-ts$i gw$az done check ovn-nbctl --wait=hv sync + ovn-sbctl list Port_Binding > az$az.ports done # Pre-populate the hypervisors' ARP tables so that we don't lose any @@ -20001,21 +20254,64 @@ done OVN_POPULATE_ARP for i in `seq 1 $n_az`; do - AT_CHECK([ovn_as az$i ovn-nbctl --timeout=3 --wait=sb sync], [0], [ignore]) + AT_CHECK([ovn_as az$i ovn-nbctl --timeout=3 --wait=hv sync], [0], [ignore]) + ovn_as az$i ovn-sbctl dump-flows > az$i/sbflows done # Allow some time for ovn-northd and ovn-controller to catch up. # XXX This should be more systematic. sleep 2 +ovn-ic-nbctl show > ic-nbctl.dump +AT_CAPTURE_FILE([ic-nbctl.dump]) + +(echo "---------ISB dump-----" + ovn-ic-sbctl show + echo "---------------------" + ovn-ic-sbctl list gateway + echo "---------------------" + ovn-ic-sbctl list datapath_binding + echo "---------------------" + ovn-ic-sbctl list port_binding + echo "---------------------" + ovn-ic-sbctl list route + echo "---------------------") > ic-sbctl.dump +AT_CAPTURE_FILE([ic-sbctl.dump]) + +AT_CAPTURE_FILE([expected]) +AT_CAPTURE_FILE([received]) +check_packets() { + > expected + > received + for az in `seq 1 $n_az`; do + for i in `seq 1 $n_ts`; do + pcap=hv$az/vif$i-tx.pcap + echo "--- $pcap" | tee -a expected >> received + if test -e $az-$i.expected; then + sort $az-$i.expected >> expected + fi + if test -e $pcap; then + $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" $pcap | sort >> received + fi + echo | tee -a expected >> received + done + done + + $at_diff expected received >/dev/null +} + # Send packets between AZs on each TS -for s_az in `seq 1 $n_az`; do - for d_az in `seq 1 $n_az`; do +for s_az in $(seq 1 $n_az); do + ovn_as az${s_az} + as hv${s_az} + for d_az in $(seq 1 $n_az); do if test $s_az = $d_az; then continue fi - for i in `seq 1 $n_ts`; do + for i in $(seq 1 $n_ts); do + echo + AS_BOX([packet from az$s_az to az$d_az via ts$i]) lsp_smac=00:00:00:0${s_az}:0$i:00 lsp_dmac=00:00:00:0${d_az}:0$i:00 lrp_ls_smac=00:00:00:0${s_az}:0$i:01 @@ -20023,10 +20319,18 @@ for s_az in `seq 1 $n_az`; do lsp_sip=10.${s_az}.$i.123 lsp_dip=10.${d_az}.$i.123 - packet="inport==\"lsp${s_az}-$i\" && eth.src==$lsp_smac && eth.dst==$lrp_ls_smac && + ovn_inport=lsp${s_az}-$i + packet="inport==\"$ovn_inport\" && eth.src==$lsp_smac && eth.dst==$lrp_ls_smac && ip4 && ip.ttl==64 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip && udp && udp.src==53 && udp.dst==4369" - AT_CHECK([as hv${s_az} ovs-appctl -t ovn-controller inject-pkt "$packet"]) + echo "sending: $packet" + AT_CHECK([ovn-trace --ovs "$packet" > ${s_az}-${d_az}-$i.ovn-trace]) + AT_CHECK([ovs-appctl -t ovn-controller inject-pkt "$packet"]) + ovs_inport=$(ovs-vsctl --bare --columns=ofport find Interface external-ids:iface-id="$ovn_inport") + + ovs_packet=$(echo $packet | ovstest test-ovn expr-to-packets) + echo ovs_inport=$ovs_inport ovs_packet=$ovs_packet + AT_CHECK([ovs-appctl ofproto/trace br-int in_port="$ovs_inport" "$ovs_packet" > ${s_az}-${d_az}-$i.ovs-trace]) # Packet to Expect # The TTL should be decremented by 2. @@ -20034,31 +20338,11 @@ for s_az in `seq 1 $n_az`; do ip4 && ip.ttl==62 && ip4.src==$lsp_sip && ip4.dst==$lsp_dip && udp && udp.src==53 && udp.dst==4369" echo $packet | ovstest test-ovn expr-to-packets >> ${d_az}-$i.expected +OVS_WAIT_UNTIL([check_packets], [$at_diff -F'^---' expected received]) done done done -echo "---------INB dump-----" -ovn-ic-nbctl show -echo "---------------------" - -echo "---------ISB dump-----" -ovn-ic-sbctl show -echo "---------------------" -ovn-ic-sbctl list gateway -echo "---------------------" -ovn-ic-sbctl list datapath_binding -echo "---------------------" -ovn-ic-sbctl list port_binding -echo "---------------------" -ovn-ic-sbctl list route -echo "---------------------" - -for az in `seq 1 $n_az`; do - for i in `seq 1 $n_ts`; do - OVN_CHECK_PACKETS([hv$az/vif$i-tx.pcap], [$az-$i.expected]) - done -done for az in `seq 1 $n_az`; do OVN_CLEANUP_SBOX([hv$az]) @@ -20139,6 +20423,9 @@ ovs-vsctl -- add-port br-int hv1-vif3 -- \ # wait for earlier changes to take effect AT_CHECK([ovn-nbctl --timeout=3 --wait=hv sync], [0], [ignore]) +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) + for i in $(seq 5001 5010); do packet="inport==\"lsp11\" && eth.src==f0:00:00:00:01:11 && eth.dst==00:00:00:01:01:01 && ip4 && ip.ttl==64 && ip4.src==192.168.1.11 && ip4.dst==10.0.0.123 && @@ -20179,24 +20466,24 @@ ovn_start # One LR - R1 has a logical switch ls1 and ls2 connected to it. # Logical switch ls1 has one port while ls2 has two logical switch ports as # child ports. -ovn-nbctl lr-add R1 -ovn-nbctl ls-add ls1 -ovn-nbctl ls-add ls2 +check ovn-nbctl lr-add R1 +check ovn-nbctl ls-add ls1 +check ovn-nbctl ls-add ls2 # Logical switch ls1 to R1 connectivity -ovn-nbctl lrp-add R1 R1-ls1 00:00:00:01:02:f1 192.168.1.1/24 -ovn-nbctl lsp-add ls1 ls1-R1 -- set Logical_Switch_Port ls1-R1 \ +check ovn-nbctl lrp-add R1 R1-ls1 00:00:00:01:02:f1 192.168.1.1/24 +check ovn-nbctl lsp-add ls1 ls1-R1 -- set Logical_Switch_Port ls1-R1 \ type=router options:router-port=R1-ls1 -- lsp-set-addresses ls1-R1 router -ovn-nbctl lsp-add ls1 lsp11 \ +check ovn-nbctl lsp-add ls1 lsp11 \ -- lsp-set-addresses lsp11 "00:00:00:01:02:01 192.168.1.2" # Logical switch ls2 to R1 connectivity -ovn-nbctl lrp-add R1 R1-ls2 00:00:00:01:02:f2 172.16.1.1/24 -ovn-nbctl lsp-add ls2 ls2-R1 -- set Logical_Switch_Port ls2-R1 \ +check ovn-nbctl lrp-add R1 R1-ls2 00:00:00:01:02:f2 172.16.1.1/24 +check ovn-nbctl lsp-add ls2 ls2-R1 -- set Logical_Switch_Port ls2-R1 \ type=router options:router-port=R1-ls2 -- lsp-set-addresses ls2-R1 router -ovn-nbctl lsp-add ls2 lsp21 \ +check ovn-nbctl lsp-add ls2 lsp21 \ -- lsp-set-addresses lsp21 "00:00:00:01:02:01 172.16.1.2" -ovn-nbctl lsp-add ls2 lsp22 \ +check ovn-nbctl lsp-add ls2 lsp22 \ -- lsp-set-addresses lsp22 "00:00:00:01:02:02 172.16.1.3" # Create a network @@ -20205,45 +20492,47 @@ net_add n1 # Create hypervisor hv1 connected to n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lsp11 options:tx_pcap=hv1/vif1-tx.pcap options:rxq_pcap=hv1/vif1-rx.pcap ofport-request=1 +check ovs-vsctl add-port br-int vif1 -- set Interface vif1 external-ids:iface-id=lsp11 options:tx_pcap=hv1/vif1-tx.pcap options:rxq_pcap=hv1/vif1-rx.pcap ofport-request=1 # Create hypervisor hv2 connected to n1 sim_add hv2 as hv2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 -ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lsp21 options:tx_pcap=hv2/vif2-tx.pcap options:rxq_pcap=hv2/vif2-rx.pcap ofport-request=1 +check ovs-vsctl add-port br-int vif2 -- set Interface vif2 external-ids:iface-id=lsp21 options:tx_pcap=hv2/vif2-tx.pcap options:rxq_pcap=hv2/vif2-rx.pcap ofport-request=1 # Create hypervisor hv3 connected to n1 sim_add hv3 as hv3 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.3 -ovs-vsctl add-port br-int vif3 -- set Interface vif3 external-ids:iface-id=lsp22 options:tx_pcap=hv3/vif3-tx.pcap options:rxq_pcap=hv3/vif3-rx.pcap ofport-request=1 +check ovs-vsctl add-port br-int vif3 -- set Interface vif3 external-ids:iface-id=lsp22 options:tx_pcap=hv3/vif3-tx.pcap options:rxq_pcap=hv3/vif3-rx.pcap ofport-request=1 # Add a forwarding group on ls2 with lsp21 and lsp22 as child ports # virtual IP - 172.16.1.11, virtual MAC - 00:11:de:ad:be:ef check ovn-nbctl --wait=hv fwd-group-add fwd_grp1 ls2 172.16.1.11 00:11:de:ad:be:ef lsp21 lsp22 # Check logical flow -AT_CHECK([ovn-sbctl dump-flows | grep ls_in_l2_lkup | grep fwd_group | wc -l], [0], [dnl -1 +AT_CAPTURE_FILE([sbflows]) +ovn-sbctl dump-flows > sbflows +AT_CHECK([grep ls_in_l2_lkup sbflows | grep fwd_group | wc -l], [0], [1 ]) # Check openflow rule with "group" on hypervisor -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ - grep "dl_dst=00:11:de:ad:be:ef actions=group" | wc -l], [0], [dnl -1 +AT_CAPTURE_FILE([offlows]) +as hv1 ovs-ofctl dump-flows br-int > offlows +AT_CHECK([grep -c "dl_dst=00:11:de:ad:be:ef actions=group" offlows], [0], [1 ]) # Verify openflow group members + # Verify openflow group members +AT_CAPTURE_FILE([ofgroups]) +as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int > ofgroups for child_port in lsp21 lsp22; do - tunnel_key=`ovn-sbctl --bare --column tunnel_key find port_binding logical_port=$child_port` - AT_CHECK([as hv1 ovs-ofctl -O OpenFlow13 dump-groups br-int | \ - grep "bucket=actions=load:0x"$tunnel_key | wc -l], [0], [dnl -1 + tunnel_key=`ovn-sbctl get Port_Binding $child_port tunnel_key` + AT_CHECK([grep -c "bucket=actions=load:0x"$tunnel_key ofgroups], [0], [1 ]) done @@ -20255,17 +20544,17 @@ dst_ip=172.16.1.11 packet="inport==\"lsp11\" && eth.src==$src_mac && eth.dst==$dst_mac && ip4 && ip.ttl==64 && ip4.src==$src_ip && ip4.dst==$dst_ip && udp && udp.src==53 && udp.dst==4369" -as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet" +check as hv1 ovs-appctl -t ovn-controller inject-pkt "$packet" # Check if the packet hit the forwarding group policy -AT_CHECK([as hv1 ovs-ofctl dump-flows br-int | \ - grep "dl_dst=00:11:de:ad:be:ef actions=group" | \ - grep "n_packets=1" | wc -l], [0], [dnl -1 +AT_CAPTURE_FILE([offlows2]) +OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int > offlows2 + grep "dl_dst=00:11:de:ad:be:ef actions=group" offlows2 | \ + grep "n_packets=1" | wc -l], [0], [1 ]) # Delete the forwarding group -ovn-nbctl fwd-group-del fwd_grp1 +check ovn-nbctl fwd-group-del fwd_grp1 # Add a forwarding group with liveness on ls2 with lsp21 and lsp22 as child # ports virtual IP - 172.16.1.11, virtual MAC - 00:11:de:ad:be:ef @@ -20402,6 +20691,9 @@ send_ipv4_pkt hv1 hv1-vif1 000000000001 000000000100 \ ${tcp_payload} ${hp_tcp_payload} \ expected +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) + # Check that traffic is hairpinned. OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [expected]) @@ -20535,109 +20827,109 @@ ovn_start net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=sw0-port1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=sw0-port2 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ ofport-request=2 -as hv1 ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=public:br-phys +as hv1 check ovs-vsctl set Open_vSwitch . external-ids:ovn-bridge-mappings=public:br-phys -ovn-nbctl ls-add sw0 -ovn-nbctl lsp-add sw0 sw0-port1 -ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:03 10.0.0.3 10.0.0.5" -ovn-nbctl lsp-set-port-security sw0-port1 "50:54:00:00:00:03 10.0.0.3 10.0.0.5" +check ovn-nbctl ls-add sw0 +check ovn-nbctl lsp-add sw0 sw0-port1 +check ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:03 10.0.0.3 10.0.0.5" +check ovn-nbctl lsp-set-port-security sw0-port1 "50:54:00:00:00:03 10.0.0.3 10.0.0.5" -ovn-nbctl lsp-add sw0 sw0-port2 -ovn-nbctl lsp-set-addresses sw0-port2 "50:54:00:00:00:04 10.0.0.4 aef0::4" +check ovn-nbctl lsp-add sw0 sw0-port2 +check ovn-nbctl lsp-set-addresses sw0-port2 "50:54:00:00:00:04 10.0.0.4 aef0::4" -ovn-nbctl lr-add lr0 -ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24 aef0::1/64 -ovn-nbctl lsp-add sw0 sw0-lr0 -ovn-nbctl lsp-set-type sw0-lr0 router -ovn-nbctl lsp-set-addresses sw0-lr0 router -ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 +check ovn-nbctl lr-add lr0 +check ovn-nbctl lrp-add lr0 lr0-sw0 00:00:00:00:ff:01 10.0.0.1/24 aef0::1/64 +check ovn-nbctl lsp-add sw0 sw0-lr0 +check ovn-nbctl lsp-set-type sw0-lr0 router +check ovn-nbctl lsp-set-addresses sw0-lr0 router +check ovn-nbctl lsp-set-options sw0-lr0 router-port=lr0-sw0 -ovn-nbctl ls-add public -ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 bef0::1/64 -ovn-nbctl lsp-add public public-lr0 -ovn-nbctl lsp-set-type public-lr0 router -ovn-nbctl lsp-set-addresses public-lr0 router -ovn-nbctl lsp-set-options public-lr0 router-port=lr0-public +check ovn-nbctl ls-add public +check ovn-nbctl lrp-add lr0 lr0-public 00:00:20:20:12:13 172.168.0.100/24 bef0::1/64 +check ovn-nbctl lsp-add public public-lr0 +check ovn-nbctl lsp-set-type public-lr0 router +check ovn-nbctl lsp-set-addresses public-lr0 router +check ovn-nbctl lsp-set-options public-lr0 router-port=lr0-public # localnet port -ovn-nbctl lsp-add public ln-public -ovn-nbctl lsp-set-type ln-public localnet -ovn-nbctl lsp-set-addresses ln-public unknown -ovn-nbctl lsp-set-options ln-public network_name=public +check ovn-nbctl lsp-add public ln-public +check ovn-nbctl lsp-set-type ln-public localnet +check ovn-nbctl lsp-set-addresses ln-public unknown +check ovn-nbctl lsp-set-options ln-public network_name=public -ovn-nbctl lrp-set-gateway-chassis lr0-public hv1 20 -ovn-nbctl lr-nat-add lr0 snat 172.168.0.100 10.0.0.0/24 +check ovn-nbctl lrp-set-gateway-chassis lr0-public hv1 20 +check ovn-nbctl lr-nat-add lr0 snat 172.168.0.100 10.0.0.0/24 check ovn-nbctl --wait=hv sync + +wait_row_count datapath_binding 1 external-ids:name=lr0 lr0_dp_uuid=$(ovn-sbctl --bare --columns _uuid list datapath_binding lr0) -ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip=172.168.0.120 \ -logical_port=lr0-public mac="10\:54\:00\:00\:00\:03" -ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip=172.168.0.200 \ -logical_port=lr0-public mac="10\:54\:00\:00\:00\:04" -ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip="bef0\:\:4" \ -logical_port=lr0-public mac="10\:54\:00\:00\:00\:05" -ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip="bef0\:\:5" \ -logical_port=lr0-public mac="10\:54\:00\:00\:00\:06" -ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip="bef0\:\:6" \ -logical_port=lr0-public mac="10\:54\:00\:00\:00\:07" -ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \ -ip_prefix="\:\:/64" nexthop="bef0\:\:4" -- add Logical_Router lr0 \ -static_routes @lrt +AT_CHECK( + [ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip=172.168.0.120 \ + logical_port=lr0-public mac="10\:54\:00\:00\:00\:03" + ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip=172.168.0.200 \ + logical_port=lr0-public mac="10\:54\:00\:00\:00\:04" + ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip="bef0\:\:4" \ + logical_port=lr0-public mac="10\:54\:00\:00\:00\:05" + ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip="bef0\:\:5" \ + logical_port=lr0-public mac="10\:54\:00\:00\:00\:06" + ovn-sbctl create mac_binding datapath=$lr0_dp_uuid ip="bef0\:\:6" \ + logical_port=lr0-public mac="10\:54\:00\:00\:00\:07" + ovn-nbctl -- --id=@lrt create Logical_Router_Static_Route \ + ip_prefix="\:\:/64" nexthop="bef0\:\:4" -- add Logical_Router lr0 \ + static_routes @lrt], + [0], [stdout]) +AT_CHECK([uuidfilt stdout], [0], + [<0> +<1> +<2> +<3> +<4> +<5> +]) -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync # Add logical router policy and set pkt_mark on it. -ovn-nbctl lr-policy-add lr0 2000 "ip4.src == 10.0.0.3" allow pkt_mark=100 -ovn-nbctl lr-policy-add lr0 1000 "ip4.src == 10.0.0.4" allow -ovn-nbctl lr-policy-add lr0 900 "ip4.src == 10.0.0.5" reroute 172.168.0.200 pkt_mark=3 -ovn-nbctl lr-policy-add lr0 2001 "ip6.dst == bef0::5" reroute bef0::6 -ovn-nbctl lr-policy-add lr0 1001 "ip6" allow +check ovn-nbctl lr-policy-add lr0 2000 "ip4.src == 10.0.0.3" allow pkt_mark=100 +check ovn-nbctl lr-policy-add lr0 1000 "ip4.src == 10.0.0.4" allow +check ovn-nbctl lr-policy-add lr0 900 "ip4.src == 10.0.0.5" reroute 172.168.0.200 pkt_mark=3 +check ovn-nbctl lr-policy-add lr0 2001 "ip6.dst == bef0::5" reroute bef0::6 +check ovn-nbctl lr-policy-add lr0 1001 "ip6" allow pol1=$(ovn-nbctl --bare --columns _uuid find logical_router_policy priority=2000) pol4=$(ovn-nbctl --bare --columns _uuid find logical_router_policy priority=2001) pol5=$(ovn-nbctl --bare --columns _uuid find logical_router_policy priority=1001) -ovn-nbctl set logical_router_policy $pol4 options:pkt_mark=4 -ovn-nbctl set logical_router_policy $pol5 options:pkt_mark=4294967295 -ovn-nbctl --wait=hv sync - -OVS_WAIT_UNTIL([ - test 1 -eq $(as hv1 ovs-ofctl dump-flows br-int table=20 | \ - grep "load:0x64->NXM_NX_PKT_MARK" -c) -]) - -OVS_WAIT_UNTIL([ - test 1 -eq $(as hv1 ovs-ofctl dump-flows br-int table=20 | \ - grep "load:0x3->NXM_NX_PKT_MARK" -c) -]) - -OVS_WAIT_UNTIL([ - test 1 -eq $(as hv1 ovs-ofctl dump-flows br-int table=20 | \ - grep "load:0x4->NXM_NX_PKT_MARK" -c) -]) - -as hv1 ovs-ofctl dump-flows br-int table=20 | grep NXM_NX_PKT_MARK +check ovn-nbctl set logical_router_policy $pol4 options:pkt_mark=4 +check ovn-nbctl set logical_router_policy $pol5 options:pkt_mark=4294967295 check ovn-nbctl --wait=hv sync +ovn-sbctl dump-flows > sbflows +AT_CAPTURE_FILE([sbflows]) +AT_CAPTURE_FILE([offlows]) OVS_WAIT_UNTIL([ - test 1 -eq $(as hv1 ovs-ofctl dump-flows br-int table=20 | \ - grep "load:0xffffffff->NXM_NX_PKT_MARK" -c) + as hv1 ovs-ofctl dump-flows br-int table=20 > offlows + test $(grep -c "load:0x64->NXM_NX_PKT_MARK" offlows) = 1 && \ + test $(grep -c "load:0x3->NXM_NX_PKT_MARK" offlows) = 1 && \ + test $(grep -c "load:0x4->NXM_NX_PKT_MARK" offlows) = 1 && \ + test $(grep -c "load:0xffffffff->NXM_NX_PKT_MARK" offlows) = 1 ]) -AT_CHECK([as hv1 ovs-ofctl del-flows br-phys]) +as hv1 check ovs-ofctl del-flows br-phys AT_DATA([flows.txt], [dnl table=0, priority=0 actions=NORMAL table=0, priority=200 arp,actions=drop @@ -20648,13 +20940,14 @@ table=0, priority=100, pkt_mark=0x4 actions=drop table=0, priority=100, pkt_mark=0xffffffff actions=drop ]) -AT_CHECK([as hv1 ovs-ofctl --protocols=OpenFlow13 add-flows br-phys flows.txt]) +as hv1 check ovs-ofctl --protocols=OpenFlow13 add-flows br-phys flows.txt sleep 5 send_ipv4_pkt() { local hv=$1 inport=$2 eth_src=$3 eth_dst=$4 local ip_src=$5 ip_dst=$6 packet=${eth_dst}${eth_src}08004500001c0000000040110000${ip_src}${ip_dst}0035111100080000 + tcpdump_hex $packet as $hv ovs-appctl netdev-dummy/receive ${inport} ${packet} } @@ -20670,10 +20963,11 @@ send_icmp6_packet() { send_ipv4_pkt hv1 hv1-vif1 505400000003 00000000ff01 \ $(ip_to_hex 10 0 0 3) $(ip_to_hex 172 168 0 120) +AT_CAPTURE_FILE([offlows2]) OVS_WAIT_UNTIL([ - test 1 -eq $(as hv1 ovs-ofctl dump-flows br-phys table=0 | \ - grep "priority=100,pkt_mark=0x64" | \ - grep "n_packets=1" -c) + as hv1 ovs-ofctl dump-flows br-phys table=0 > offlows2 + test 1 -eq $(grep "priority=100,pkt_mark=0x64" offlows2 | \ + grep -c "n_packets=1") ]) AT_CHECK([ @@ -20868,14 +21162,14 @@ net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=sw0-p1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=sw0-p2 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ @@ -21304,12 +21598,12 @@ ovn_start net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 sim_add hv2 as hv2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 # Logical network @@ -21329,44 +21623,44 @@ ovn_attach n1 br-phys 192.168.0.2 ovn-nbctl create Logical_Router name=DR gw_uuid=$(ovn-nbctl create Logical_Router name=GW) -ovn-nbctl ls-add ls1 -ovn-nbctl ls-add ls2 -ovn-nbctl ls-add join -ovn-nbctl ls-add ext +check ovn-nbctl ls-add ls1 +check ovn-nbctl ls-add ls2 +check ovn-nbctl ls-add join +check ovn-nbctl ls-add ext # Connect ls1 to DR -ovn-nbctl lrp-add DR dr-ls1 00:00:01:01:02:03 10.0.0.1/24 -ovn-nbctl lsp-add ls1 ls1-dr -- set Logical_Switch_Port ls1-dr \ +check ovn-nbctl lrp-add DR dr-ls1 00:00:01:01:02:03 10.0.0.1/24 +check ovn-nbctl lsp-add ls1 ls1-dr -- set Logical_Switch_Port ls1-dr \ type=router options:router-port=dr-ls1 addresses='"00:00:01:01:02:03"' # Connect ls2 to DR -ovn-nbctl lrp-add DR dr-ls2 00:00:01:01:02:04 10.0.0.2/24 -ovn-nbctl lsp-add ls2 ls2-dr -- set Logical_Switch_Port ls2-dr \ +check ovn-nbctl lrp-add DR dr-ls2 00:00:01:01:02:04 10.0.0.2/24 +check ovn-nbctl lsp-add ls2 ls2-dr -- set Logical_Switch_Port ls2-dr \ type=router options:router-port=dr-ls2 addresses='"00:00:01:01:02:04"' # Connect join to DR -ovn-nbctl lrp-add DR dr-join 00:00:02:01:02:03 20.0.0.1/24 -ovn-nbctl lsp-add join join-dr -- set Logical_Switch_Port join-dr \ +check ovn-nbctl lrp-add DR dr-join 00:00:02:01:02:03 20.0.0.1/24 +check ovn-nbctl lsp-add join join-dr -- set Logical_Switch_Port join-dr \ type=router options:router-port=dr-join addresses='"00:00:02:01:02:03"' # Connect join to GW -ovn-nbctl lrp-add GW gw-join 00:00:02:01:02:04 20.0.0.2/24 -ovn-nbctl lsp-add join join-gw -- set Logical_Switch_Port join-gw \ +check ovn-nbctl lrp-add GW gw-join 00:00:02:01:02:04 20.0.0.2/24 +check ovn-nbctl lsp-add join join-gw -- set Logical_Switch_Port join-gw \ type=router options:router-port=gw-join addresses='"00:00:02:01:02:04"' # Connect ext to GW -ovn-nbctl lrp-add GW gw-ext 00:00:03:01:02:03 172.16.0.1/16 -ovn-nbctl lsp-add ext ext-gw -- set Logical_Switch_Port ext-gw \ +check ovn-nbctl lrp-add GW gw-ext 00:00:03:01:02:03 172.16.0.1/16 +check ovn-nbctl lsp-add ext ext-gw -- set Logical_Switch_Port ext-gw \ type=router options:router-port=gw-ext addresses='"00:00:03:01:02:03"' -ovn-nbctl lr-route-add GW 10.0.0.0/24 20.0.0.1 -ovn-nbctl --policy="src-ip" lr-route-add DR 10.0.0.0/24 20.0.0.2 +check ovn-nbctl lr-route-add GW 10.0.0.0/24 20.0.0.1 +check ovn-nbctl --policy="src-ip" lr-route-add DR 10.0.0.0/24 20.0.0.2 # Now add some ECMP routes to the GW router. -ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/24 172.16.0.2 -ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/24 172.16.0.3 +check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/24 172.16.0.2 +check ovn-nbctl --ecmp-symmetric-reply --policy="src-ip" lr-route-add GW 10.0.0.0/24 172.16.0.3 -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync # Ensure ECMP symmetric reply flows are not present on any hypervisor. AT_CHECK([ @@ -21889,7 +22183,7 @@ net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=sw0-port1 \ @@ -21906,7 +22200,7 @@ ovs-vsctl set open . external_ids:ovn-enable-lflow-cache=false sim_add hv2 as hv2 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.2 ovs-vsctl -- add-port br-int hv2-vif1 -- \ set interface hv2-vif1 external-ids:iface-id=sw0-port2 \ @@ -22147,35 +22441,35 @@ AT_CLEANUP AT_SETUP([ovn -- conflict or duplicate ACLs resulting in same OVS match]) ovn_start -ovn-nbctl ls-add ls1 +check ovn-nbctl ls-add ls1 -ovn-nbctl lsp-add ls1 lsp1 \ --- lsp-set-addresses lsp1 "f0:00:00:00:00:01 10.0.0.1" +check ovn-nbctl lsp-add ls1 lsp1 \ + -- lsp-set-addresses lsp1 "f0:00:00:00:00:01 10.0.0.1" -ovn-nbctl lsp-add ls1 lsp2 \ --- lsp-set-addresses lsp2 "f0:00:00:00:00:02 10.0.0.2" +check ovn-nbctl lsp-add ls1 lsp2 \ + -- lsp-set-addresses lsp2 "f0:00:00:00:00:02 10.0.0.2" net_add n1 sim_add hv1 as hv1 -ovs-vsctl add-br br-phys +check ovs-vsctl add-br br-phys ovn_attach n1 br-phys 192.168.0.1 -ovs-vsctl -- add-port br-int hv1-vif1 -- \ +check ovs-vsctl -- add-port br-int hv1-vif1 -- \ set interface hv1-vif1 external-ids:iface-id=lsp1 \ options:tx_pcap=hv1/vif1-tx.pcap \ options:rxq_pcap=hv1/vif1-rx.pcap \ ofport-request=1 -ovs-vsctl -- add-port br-int hv1-vif2 -- \ +check ovs-vsctl -- add-port br-int hv1-vif2 -- \ set interface hv1-vif2 external-ids:iface-id=lsp2 \ options:tx_pcap=hv1/vif2-tx.pcap \ options:rxq_pcap=hv1/vif2-rx.pcap \ ofport-request=2 # Default drop -ovn-nbctl acl-add ls1 to-lport 1000 \ -'outport == "lsp1" && ip4' drop +check ovn-nbctl acl-add ls1 to-lport 1000 \ + 'outport == "lsp1" && ip4' drop # test_ip INPORT SRC_MAC DST_MAC SRC_IP DST_IP OUTPORT... # @@ -22209,12 +22503,12 @@ options:rxq_pcap=${pcap_file}-rx.pcap # Create overlapping ACLs resulting in duplicated desired OVS flows -ovn-nbctl acl-add ls1 to-lport 1001 \ -'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' allow -ovn-nbctl acl-add ls1 to-lport 1001 \ -'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' allow +check ovn-nbctl acl-add ls1 to-lport 1001 \ + 'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' allow +check ovn-nbctl acl-add ls1 to-lport 1001 \ + 'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' allow -ovn-nbctl --wait=hv sync +check ovn-nbctl --wait=hv sync sip=`ip_to_hex 10 0 0 2` dip=`ip_to_hex 10 0 0 1` @@ -22222,21 +22516,21 @@ test_ip 2 f00000000002 f00000000001 $sip $dip 1 OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [1.expected]) # Delete one of the ACLs. -ovn-nbctl acl-del ls1 to-lport 1001 \ -'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' +check ovn-nbctl acl-del ls1 to-lport 1001 \ + 'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' check ovn-nbctl --wait=hv sync test_ip 2 f00000000002 f00000000001 $sip $dip 1 OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [1.expected]) # Add a conflict ACL with drop action. -ovn-nbctl acl-add ls1 to-lport 1001 \ -'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' drop +check ovn-nbctl acl-add ls1 to-lport 1001 \ + 'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' drop # Don't test because it is unpredicatable which rule will take effect. # Delete the ACL that has "allow" action -ovn-nbctl acl-del ls1 to-lport 1001 \ -'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' +check ovn-nbctl acl-del ls1 to-lport 1001 \ + 'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' check ovn-nbctl --wait=hv sync # Packet should be dropped @@ -22244,10 +22538,10 @@ test_ip 2 f00000000002 f00000000001 $sip $dip OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [1.expected]) # Add the ACL back and delete the "drop" ACL -ovn-nbctl acl-add ls1 to-lport 1001 \ -'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' allow -ovn-nbctl acl-del ls1 to-lport 1001 \ -'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' +check ovn-nbctl acl-add ls1 to-lport 1001 \ + 'outport == "lsp1" && ip4 && ip4.src == 10.0.0.2' allow +check ovn-nbctl acl-del ls1 to-lport 1001 \ + 'outport == "lsp1" && ip4 && ip4.src == {10.0.0.2, 10.0.0.3}' check ovn-nbctl --wait=hv sync # Packet should be received