From patchwork Tue Apr 27 17:20:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Michelson X-Patchwork-Id: 1470823 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=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=dGd7g/l9; dkim-atps=neutral Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (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 4FV7nK4gc4z9sWW for ; Wed, 28 Apr 2021 03:20:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id D667E40491; Tue, 27 Apr 2021 17:20:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CmMq9jaw-AS1; Tue, 27 Apr 2021 17:20:19 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp2.osuosl.org (Postfix) with ESMTP id 204AC403BB; Tue, 27 Apr 2021 17:20:18 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id DD06FC0019; Tue, 27 Apr 2021 17:20:17 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id A61A5C000A for ; Tue, 27 Apr 2021 17:20:16 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8D94B83A15 for ; Tue, 27 Apr 2021 17:20:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id h1wRr7YUs-8a for ; Tue, 27 Apr 2021 17:20:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 97E0482F96 for ; Tue, 27 Apr 2021 17:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619544013; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=pe4KvQvDv9jTYfxOfJQ1kDc2Db4PsPwqmCc7C41tk0s=; b=dGd7g/l9XAhjZo4ITh3BG+d+CoQZGH+yoMktLfac2oinp0rVcWUOhZc/d9ZexkmRk5kR0c Ce+NAgv205KKnGMMc4Ye5RCDKHXNO0y93ip7GXUFgw+KJ6Qy87tOFXcewMOxMK3T52xD0G FMCLRMfZPBL5GsB0mdPdgWXTGpdYSa0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-XFABQtpqM-CJmXlC8HZr_Q-1; Tue, 27 Apr 2021 13:20:10 -0400 X-MC-Unique: XFABQtpqM-CJmXlC8HZr_Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AD7C48186F0 for ; Tue, 27 Apr 2021 17:20:09 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-95.rdu2.redhat.com [10.10.113.95]) by smtp.corp.redhat.com (Postfix) with ESMTP id 306BF10016DB for ; Tue, 27 Apr 2021 17:20:09 +0000 (UTC) From: Mark Michelson To: dev@openvswitch.org Date: Tue, 27 Apr 2021 13:20:07 -0400 Message-Id: <20210427172007.1416154-1-mmichels@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mmichels@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] tests: Fix inconsistent "ACL Conjunction" 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" The ACL Conjunction test would occasionally fail during automated test runs. During the test, we send a packet on a netdev-dummy interface and check the associated pcap file to ensure the packet is sent where we expect and that it has the expected contents. Looking at logs from failed runs, it appeared that the pcap file was unpopulated. This likely was because we were attempting to dump the contents of the pcap file before the packet had been processed and added to the pcap file. This patch aims to fix the problem by blocking until the pcap file has been modified when sending the packet to the netdev-dummy interface. Since this could be a useful thing for other tests, this new method of blocking has been added to ovn-macros.at. Signed-off-by: Mark Michelson Acked-by: Numan Siddique --- tests/ovn-macros.at | 23 +++++++++++++++++++++++ tests/ovn.at | 8 ++++---- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at index bd227215a..94fba405e 100644 --- a/tests/ovn-macros.at +++ b/tests/ovn-macros.at @@ -509,6 +509,29 @@ options:rxq_pcap=${pcap_file}-rx.pcap OVS_WAIT_WHILE([test 24 = $(wc -c ${pcap_file}-tx.pcap | cut -d " " -f1)]) } +# Receive a packet on a dummy netdev interface. If we expect packets to be +# recorded, then wait until the pcap file reflects the change. +netdev_dummy_receive() { + local interface="$1" + local packet="$2" + local hv="$3" + local pcap_file="$4" + + if test -n "pcap_file" ; then + ts_old=$(stat -c %y "$pcap_file") + fi + if test -n "$hv" ; then + as "$hv" ovs-appctl netdev-dummy/receive "$interface" "$packet" + else + ovs-appctl netdev-dummy/receive "$interface" "$packet" + fi + if test -n "$pcap_file" ; then + OVS_WAIT_WHILE( + [ts_new=$(stat -c %y "$pcap_file") + test "$ts_new" = "$ts_old"]) + fi +} + 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 9f38ec6ec..c1158f5d0 100644 --- a/tests/ovn.at +++ b/tests/ovn.at @@ -14016,11 +14016,11 @@ check ovn-nbctl --wait=hv acl-add ls1 to-lport 1001 \ # port numbers, e.g. 11 for vif11. 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 + local inport=$1 src_mac=$2 dst_mac=$3 src_ip=$4 dst_ip=$5 pcap_file=$6 local packet=${dst_mac}${src_mac}08004500001c0000000040110000${src_ip}\ ${dst_ip}0035111100080000 - shift; shift; shift; shift; shift - as hv1 ovs-appctl netdev-dummy/receive hv1-vif1 $packet + shift; shift; shift; shift; shift; shift + netdev_dummy_receive hv1-vif1 $packet hv1 "$pcap_file" for outport; do echo $packet >> $outport.expected done @@ -14040,7 +14040,7 @@ options:rxq_pcap=${pcap_file}-rx.pcap sip=`ip_to_hex 10 0 0 4` dip=`ip_to_hex 10 0 0 6` -test_ip 1 f00000000001 f00000000002 $sip $dip 2 +test_ip 1 f00000000001 f00000000002 $sip $dip hv1/vif2-tx.pcap 2 cat 2.expected > expout $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv1/vif2-tx.pcap > 2.packets