From patchwork Mon Mar 9 23:19:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1251862 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=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=o/NTAEkJ; dkim-atps=neutral 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 48bvMP4tdLz9sPF for ; Tue, 10 Mar 2020 10:20:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 936358737F; Mon, 9 Mar 2020 23:19:59 +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 eL0MjHkEGTdc; Mon, 9 Mar 2020 23:19:58 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by fraxinus.osuosl.org (Postfix) with ESMTP id 6D7238733F; Mon, 9 Mar 2020 23:19:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4045CC1D74; Mon, 9 Mar 2020 23:19:58 +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 7066BC0177 for ; Mon, 9 Mar 2020 23:19:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 64DA988B41 for ; Mon, 9 Mar 2020 23:19:56 +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 fkKCrjfqkfQX for ; Mon, 9 Mar 2020 23:19:55 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by hemlock.osuosl.org (Postfix) with ESMTPS id D4EA788B03 for ; Mon, 9 Mar 2020 23:19:55 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id gv19so580858pjb.5 for ; Mon, 09 Mar 2020 16:19:55 -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=QoP9jyGCLhMeqlcnDp0Cr3J/V5rx1LZIaANMn4CIsS4=; b=o/NTAEkJgCxg4aaaPbpVuLDfYUXMiz79emoLkxpjtAXinIxY9/T5YOP9fx9BEVv0Dh hSYt2BFVXtr4rznCLKYts9+MVuDKq/d0f1HpBCL2FdRnd+1keyyzd81xwZjKdncYJM2w 4+RYh9JGY4uL0qKBit1YMJVJVfAklR3PdgU0Sb53JcyZiFVpMeIpoHU1JLg/2XWsTiv9 U6a/+x5HSqwusm6kbHH660ZV8SbE7l6fW2UmpUIOS6hNBFLaByCrHVrzC7hZX8n5MrkM rf8QkH2SuwPbwoJRHyy0qvgDhbTv0wnotfQQKN7AQmwORxLZ3B4jvPc+9EKoDJ28mXv6 utcA== 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=QoP9jyGCLhMeqlcnDp0Cr3J/V5rx1LZIaANMn4CIsS4=; b=DhuMBa3+arFUFxOUM38w3CGbg/tJ7iofhzJmkTCKgJM5OIKun/BsFOnRP6o40LY/wu wgt4e7lDVHeSYArVY8QQuS6ZtC9f2gxQpgHyxwhR6APYQmSuzSYn2MTtGLnNSWLroLG9 rvHJXyxaoXSC61yUvj4lhkc+cryz8Zru2ip+8P3K6mUQMri0iLspkW6lH9UohS4vu6BW H+UGOGnL1h0avSOm+EKVurVBhk/wdAS7a6EpiDbUY+R0MI1oJk4Lo3Ew6b2OM+Iu8xhY hqiPMwM5DnKYhueAGlpmGiensUBHjRDNJz1aVMlfSXhtNj4iu84mrSD2DKbnp+OOzZqs KhpA== X-Gm-Message-State: ANhLgQ1LqfaKiH5a0j12C7cTAiTGq0tHHCv935z1yY5W5bLCRtbR8g9/ r9FdU7YvbP9LUOZ/H/DEGPenx2mH X-Google-Smtp-Source: ADFU+vtZ/TpOrx3eqBbd89vBlAb6UWHJGV92xpm9h1TREG2qzlDBx2AUQg1dWjTX83Qt6mq2yNnhVw== X-Received: by 2002:a17:902:321:: with SMTP id 30mr18793219pld.130.1583795994738; Mon, 09 Mar 2020 16:19:54 -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 k1sm24039751pgg.56.2020.03.09.16.19.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 09 Mar 2020 16:19:54 -0700 (PDT) From: William Tu To: dev@openvswitch.org Date: Mon, 9 Mar 2020 16:19:22 -0700 Message-Id: <1583795962-45820-2-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583795962-45820-1-git-send-email-u9012063@gmail.com> References: <1583795962-45820-1-git-send-email-u9012063@gmail.com> Cc: fbl@sysclose.org, i.maximets@ovn.org Subject: [ovs-dev] [PATCHv3 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 --- v3: use 'ip tuntap add' instead of 'tunctl' --- 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])