From patchwork Sat Apr 17 20:39:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1467538 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=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FN4hg323Vz9tlf for ; Sun, 18 Apr 2021 06:40:19 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id BECD760A55; Sat, 17 Apr 2021 20:40:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mpmZ7VUkRTje; Sat, 17 Apr 2021 20:40:11 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTP id DDA8F60716; Sat, 17 Apr 2021 20:40:10 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id A63CBC001A; Sat, 17 Apr 2021 20:40:10 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9231EC0019 for ; Sat, 17 Apr 2021 20:40:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6F26760716 for ; Sat, 17 Apr 2021 20:40:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pR149-xU07sd for ; Sat, 17 Apr 2021 20:40:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by smtp3.osuosl.org (Postfix) with ESMTPS id 46AFF605DB for ; Sat, 17 Apr 2021 20:40:03 +0000 (UTC) X-Originating-IP: 99.245.129.17 Received: from nusiddiq.home.org.com (unknown [99.245.129.17]) (Authenticated sender: numans@ovn.org) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 732B5FF806; Sat, 17 Apr 2021 20:39:59 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Sat, 17 Apr 2021 16:39:52 -0400 Message-Id: <20210417203952.1447048-1-numans@ovn.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn] tests: Fix frequent failure of "4 HV, 1 LS, 1 LR, packet test with HA distributed router gateway 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" From: Numan Siddique This test is failing quite often due to timing issues. The failures are mainly due to the packet not received by the other side of the tunnel. The test case resets the pcap file and then injects the packet. And this packet gets lost sometimes if the pcap files are not reset yet. To fix this issue the test now ensures that ovs-vswitchd resets the pcap file before injecting the packet. The test also now adds some waits to make sure flows related to tunnels are programmed when the chassisresident port moves from one gw chassis to other. Signed-off-by: Numan Siddique Acked-by: Mark Michelson --- tests/ovn-macros.at | 18 ++++++++++++++++++ tests/ovn.at | 31 +++++++++++++++++++------------ 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index 25f3dbe348..9a05359ba5 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -487,6 +487,24 @@ wait_for_ports_up() { done fi } + +# reset_pcap_file iface pcap_file +# Resets the pcap file associates with OVS interface. should be used +# with dummy datapath. +reset_iface_pcap_file() { + local iface=$1 + local pcap_file=$2 + check rm -f dummy-*.pcap + check ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ +options:rxq_pcap=dummy-rx.pcap + OVS_WAIT_WHILE([test 24 = $(wc -c dummy-tx.pcap | cut -d " " -f1)]) + check rm -f ${pcap_file}*.pcap + check ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ +options:rxq_pcap=${pcap_file}-rx.pcap + + OVS_WAIT_WHILE([test 24 = $(wc -c ${pcap_file}-tx.pcap | cut -d " " -f1)]) +} + OVS_END_SHELL_HELPERS m4_define([OVN_POPULATE_ARP], [AT_CHECK(ovn_populate_arp__, [0], [ignore])]) diff --git a/tests/ovn.at b/tests/ovn.at index 4c3d76d573..71cc7118ba 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -10096,15 +10096,12 @@ 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 - check ovs-vsctl -- set Interface $iface options:tx_pcap=dummy-tx.pcap \ -options:rxq_pcap=dummy-rx.pcap - rm -f ${pcap_file}*.pcap - check ovs-vsctl -- set Interface $iface options:tx_pcap=${pcap_file}-tx.pcap \ -options:rxq_pcap=${pcap_file}-rx.pcap -} +hv1_gw1_ofport=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-gw1-0) +hv1_gw2_ofport=$(as hv1 ovs-vsctl --bare --columns ofport find Interface name=ovn-gw2-0) + +OVS_WAIT_UNTIL([ + test 1 = $(as hv1 ovs-ofctl dump-flows br-int table=37 | grep -c "active_backup,ofport,members:$hv1_gw1_ofport,$hv1_gw2_ofport") +]) test_ip_packet() { @@ -10150,13 +10147,13 @@ test_ip_packet() echo $expected > ext1-vif1.expected exp_gw_ip_garp=ffffffffffff00000201020308060001080006040001000002010203ac100101000000000000ac100101 echo $exp_gw_ip_garp >> ext1-vif1.expected - as $active_gw reset_pcap_file br-phys_n1 $active_gw/br-phys_n1 + as $active_gw reset_iface_pcap_file br-phys_n1 $active_gw/br-phys_n1 if test $backup_vswitchd_dead != 1; then # Reset the file only if vswitchd in backup gw is alive - as $backup_gw reset_pcap_file br-phys_n1 $backup_gw/br-phys_n1 + as $backup_gw reset_iface_pcap_file br-phys_n1 $backup_gw/br-phys_n1 fi - as ext1 reset_pcap_file ext1-vif1 ext1/vif1 + as ext1 reset_iface_pcap_file ext1-vif1 ext1/vif1 # Resend packet from foo1 to outside1 check as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet @@ -10208,6 +10205,10 @@ AT_CHECK( <1> ]) +OVS_WAIT_UNTIL([ + test 1 = $(as hv1 ovs-ofctl dump-flows br-int table=37 | grep -c "active_backup,ofport,members:$hv1_gw2_ofport,$hv1_gw1_ofport") +]) + test_ip_packet gw2 gw1 0 # Get the claim count of both gw1 and gw2. @@ -10228,6 +10229,12 @@ OVS_WAIT_UNTIL([test $gw1_claim_ct = `cat gw1/ovn-controller.log \ AT_CHECK([test $gw2_claim_ct = `cat gw2/ovn-controller.log | \ grep -c "cr-alice: Claiming"`]) +OVS_WAIT_UNTIL([ + bfd_status=$(as hv1 ovs-vsctl get interface ovn-gw2-0 bfd_status:state) + echo "bfd status = $bfd_status" + test "$bfd_status" = "down" +]) + test_ip_packet gw1 gw2 1 as gw2