From patchwork Thu Mar 19 23:56:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1258536 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=Gh1bSLvO; dkim-atps=neutral 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 48k3j750Q2z9sNg for ; Fri, 20 Mar 2020 10:56:42 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id EF18125389; Thu, 19 Mar 2020 23:56:39 +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 vjHSsVv8rLt8; Thu, 19 Mar 2020 23:56:38 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by silver.osuosl.org (Postfix) with ESMTP id 6AB24204FC; Thu, 19 Mar 2020 23:56:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 5BCFFC18DA; Thu, 19 Mar 2020 23:56:38 +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 77745C07FF for ; Thu, 19 Mar 2020 23:56:37 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5BDF387A77 for ; Thu, 19 Mar 2020 23:56: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 1az+JIKoO+lj for ; Thu, 19 Mar 2020 23:56:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by hemlock.osuosl.org (Postfix) with ESMTPS id 3816987A6E for ; Thu, 19 Mar 2020 23:56:36 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id ng8so1706779pjb.2 for ; Thu, 19 Mar 2020 16:56:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LbJC41sBXVw8+RnT4OcHcTI66itLKb6dGNN/a2mKEKM=; b=Gh1bSLvOVzEjOiPErj8v24YAVFJG8t+Wq+238lAYsBjNQD58uOG6n5FI5lrWEUu9Kt mdtXhS6SpyZQxfR4D13Y3+UGo7b73yGATYxS+uot5cVWJwdWfFkxXTVYuwX7CmGxSPCS w9eD0NiT6H7YN0/ld/eEJ/7kOu5z2Q2zErzREIXEsb9iglED0gPDMVgZsdchBnrG3Lgu xUUt8PXuY2eBcdIbwfmB86vex90t5GDTOo1Y6W2zshEx3gafu0kqZkvUOI03oY/h0MF9 /jwCho1pKWg+dE3SJ4tbYqdZnYWkEydOWNcY2cM3Fs4tBJtVi3ARkHJgj4q82yJhoKLj 0DFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LbJC41sBXVw8+RnT4OcHcTI66itLKb6dGNN/a2mKEKM=; b=psK9pVf2LzvRq/kXjciyxdhHmoQlGl0Xqb0R/6iMWD8/S6Q0I+a5hAggcwb5DdacAI G/WTwGFwy3hosA77RwDou86Gx4VVz9YzfBPbrUmWbVw8QLv6a05E3Eujh8ew1o2U3Uc9 pk3r2i8Do6HYb/nBYwEQU7avLadnFaE9firjTmqcTL3apJmfuImHMlD64jExopsQIw1c TIaptBrJr4yWW6jSUKdAnRvO0oZeo6JpUrKZoYmPwjQa7/t4AD9v/+dGJiRjXViYDFiF El47yc0SqtYJ3RY53LGaTDWcNh8vb48yiS3Uumz2sUBAeQ33AfIQZI+mjxvNbaZZOaLU UWeQ== X-Gm-Message-State: ANhLgQ1zeXjT2N4abZZpCbcH/K4Tw2X2+R8aZ/IH3CRBLQAu0nYjpmSu 8UKhetfR2/qmhkFYpzWnsWW7kXZb X-Google-Smtp-Source: ADFU+vvHddHym4WhACmAve+N3DKFJwru9AzH5iqlgPKQB8lhoV3gTXUr26L4BXCdGXmqYPKyp67FNQ== X-Received: by 2002:a17:90a:e284:: with SMTP id d4mr6222598pjz.87.1584662195228; Thu, 19 Mar 2020 16:56:35 -0700 (PDT) Received: from sc9-mailhost2.vmware.com (c-76-21-95-192.hsd1.ca.comcast.net. [76.21.95.192]) by smtp.gmail.com with ESMTPSA id e7sm3570646pfj.97.2020.03.19.16.56.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 19 Mar 2020 16:56:34 -0700 (PDT) From: William Tu To: dev@openvswitch.org Date: Thu, 19 Mar 2020 16:56:08 -0700 Message-Id: <1584662168-107175-2-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1584662168-107175-1-git-send-email-u9012063@gmail.com> References: <1584662168-107175-1-git-send-email-u9012063@gmail.com> Cc: fbl@sysclose.org, i.maximets@ovn.org Subject: [ovs-dev] [PATCHv8 2/2] tests: Add tests using tap device. 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: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Similar to using veth across namespaces, this patch creates tap devices, assigns to namespaces, and allows traffic to go through different test cases. Signed-off-by: William Tu --- tests/automake.mk | 1 + tests/system-tap.at | 34 ++++++++++++++++++++++++++++++++++ tests/system-tso-testsuite.at | 1 + 3 files changed, 36 insertions(+) create mode 100644 tests/system-tap.at diff --git a/tests/automake.mk b/tests/automake.mk index 66859d5377c3..cbba5b170427 100644 --- a/tests/automake.mk +++ b/tests/automake.mk @@ -158,6 +158,7 @@ SYSTEM_USERSPACE_TESTSUITE_AT = \ SYSTEM_TSO_TESTSUITE_AT = \ tests/system-tso-testsuite.at \ + tests/system-tap.at \ tests/system-tso-macros.at SYSTEM_AFXDP_TESTSUITE_AT = \ diff --git a/tests/system-tap.at b/tests/system-tap.at new file mode 100644 index 000000000000..871a3bda4fcc --- /dev/null +++ b/tests/system-tap.at @@ -0,0 +1,34 @@ +AT_SETUP([traffic between namespaces using tap]) +AT_KEYWORDS([http_tap]) +OVS_TRAFFIC_VSWITCHD_START() +AT_SKIP_IF([test $HAVE_TUNCTL = no]) + +AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) + +ADD_NAMESPACES(at_ns0, at_ns1) + +AT_CHECK([ip tuntap add tap0 mode tap]) +on_exit 'ip tuntap del tap0 mode tap' +AT_CHECK([ip tuntap add tap1 mode tap]) +on_exit 'ip tuntap del tap1 mode tap' + +AT_CHECK([ovs-vsctl add-port br0 tap0 -- set int tap0 type=tap]) +AT_CHECK([ovs-vsctl add-port br0 tap1 -- set int tap1 type=tap]) +AT_CHECK([ip link set tap0 netns at_ns0]) +AT_CHECK([ip link set tap1 netns at_ns1]) + +AT_CHECK([ip netns exec at_ns0 ip link set dev tap0 up]) +AT_CHECK([ip netns exec at_ns1 ip link set dev tap1 up]) +AT_CHECK([ip netns exec at_ns0 ip addr add 10.1.1.1/24 dev tap0]) +AT_CHECK([ip netns exec at_ns1 ip addr add 10.1.1.2/24 dev tap1]) + +NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.1.1.2 | FORMAT_PING], [0], [dnl +3 packets transmitted, 3 received, 0% packet loss, time 0ms +]) + +OVS_START_L7([at_ns1], [http]) +NS_CHECK_EXEC([at_ns0], [wget 10.1.1.2 -t 3 -T 1 --retry-connrefused -v -o wget0.log]) + +OVS_TRAFFIC_VSWITCHD_STOP(["/.*ethtool command ETHTOOL_G.*/d"]) + +AT_CLEANUP diff --git a/tests/system-tso-testsuite.at b/tests/system-tso-testsuite.at index 99d748006a86..594d1a6fde85 100644 --- a/tests/system-tso-testsuite.at +++ b/tests/system-tso-testsuite.at @@ -23,4 +23,5 @@ m4_include([tests/system-common-macros.at]) m4_include([tests/system-userspace-macros.at]) m4_include([tests/system-tso-macros.at]) +m4_include([tests/system-tap.at]) m4_include([tests/system-traffic.at])