From patchwork Wed Mar 11 23:46:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1253317 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=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=kCBuB05L; dkim-atps=neutral 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 48d7tV42qTz9sPF for ; Thu, 12 Mar 2020 10:47:36 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 18BC489290; Wed, 11 Mar 2020 23:47:34 +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 jktIMnzaKd7G; Wed, 11 Mar 2020 23:47:31 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id DD07C87EB8; Wed, 11 Mar 2020 23:47:31 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id C0306C07FF; Wed, 11 Mar 2020 23:47:31 +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 A6A7AC0177 for ; Wed, 11 Mar 2020 23:47:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 992A520BF8 for ; Wed, 11 Mar 2020 23:47:30 +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 FErMI99fGuAD for ; Wed, 11 Mar 2020 23:47:29 +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 silver.osuosl.org (Postfix) with ESMTPS id DAEEF20387 for ; Wed, 11 Mar 2020 23:47:29 +0000 (UTC) Received: by mail-pj1-f54.google.com with SMTP id mq3so1811285pjb.0 for ; Wed, 11 Mar 2020 16:47:29 -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=kCBuB05LTFutRinlvfWgzsB9FDzihBlcNiAQP7zdb2x/bLhaOw8J5cjzS1HN+0m6UR 4Zk+9dECaDL6bn+EwloUg/teO3lUdgAeP5Oz3opOAA43HjRhB/snVuyhWIiHqN/K87aw mXIZyDsZnKpKYcKHHQqZUFPVvCBCtBmWYw6qHEzYdWaXV8/dnFr1fGyMtFlMGeEOHsFy XAhARtgexnxQlP1mv2KMZrPQanKR2eAU5XiNlibHI92fLfAEp4HRrx9Uz4ZBZFgymYVW BYSZqYR/Jb4x6a9BzNtD5HmDwtsQYvCZuS9KMrfkI2bKk2lrLWzb9qM8ZCkOtLsTmUKh 4+uw== 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=DnhT/QHtffDIV3kI5oO5g1bwIze4miqEpkua6JSth4N8ROVKQglH5VYWPhhSfGemmc mEGdUKNXM9uJJtIsU2v/E6SyOYXE8+8TV6HuLkWAE0K99+cuONNGkB+jac6a2i1ZcbrP EUYxKweDuQ3SUY3Mzzg3FHuhnwK/oEqE6py93BgRbF0nNp5p8R4Z6QHyjvzrW2/xDafO YTcUCIT94I5pO5Sc6+OqT7cFjH5ROvargddsK8LPo0npniHFieyrJVgbIdemiF6saFP9 Fk60q2Zji7f/eE0dv8SHl2Eu0R8tGa/MWd+VANSnqwbCgrPFw4nSDCYLK0NCFBaC79RO XhFA== X-Gm-Message-State: ANhLgQ0lHOFWrhrRPBhnGtSlAE6KivtwfY76iKOnH7gTA1/4snvdm0YL a5cO08seV9rBeNWz2Pn1w3AUNctdbRY= X-Google-Smtp-Source: ADFU+vv5ZIVBmvE/Iflp2x4c5pFXRPd7fEs2JayHSeEMGLCL0UO365kC/5DH1RPQjYfd/qjswVKWnQ== X-Received: by 2002:a17:90b:4c8d:: with SMTP id my13mr1082234pjb.186.1583970448911; Wed, 11 Mar 2020 16:47:28 -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 x197sm3408504pfc.99.2020.03.11.16.47.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 11 Mar 2020 16:47:28 -0700 (PDT) From: William Tu To: dev@openvswitch.org Date: Wed, 11 Mar 2020 16:46:57 -0700 Message-Id: <1583970417-11691-2-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1583970417-11691-1-git-send-email-u9012063@gmail.com> References: <1583970417-11691-1-git-send-email-u9012063@gmail.com> Cc: fbl@sysclose.org, i.maximets@ovn.org Subject: [ovs-dev] [PATCHv4 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])