From patchwork Thu Mar 12 17:04:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1253785 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=sFhVLDKZ; 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 48dZvY2PZsz9sPR for ; Fri, 13 Mar 2020 04:05:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 4A22E891A3; Thu, 12 Mar 2020 17:05:09 +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 XHX7ZT7YxJaA; Thu, 12 Mar 2020 17:05:08 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 7F26A88CE4; Thu, 12 Mar 2020 17:05:08 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 621F0C089F; Thu, 12 Mar 2020 17:05:08 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 18D46C0177 for ; Thu, 12 Mar 2020 17:05:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 13244881D7 for ; Thu, 12 Mar 2020 17:05:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RdDNBqaE486K for ; Thu, 12 Mar 2020 17:05:03 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3F40E88440 for ; Thu, 12 Mar 2020 17:05:03 +0000 (UTC) Received: by mail-pj1-f42.google.com with SMTP id y7so2802834pjn.1 for ; Thu, 12 Mar 2020 10:05:03 -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=sFhVLDKZXedse3LDYWNH0hVt9tJftt6OwNMVBTpc0rV1YSbn+ypH/kb2fr5+61blK6 VdED+tNlkN//t+de9I+UocbWBf2bvH2WsXWXFSGjRpfMBpmgNc6qKu9BajonFpM4y+K5 GW2yFCgFd7bnqybhNlfM3cv1RGv4KyRMwJ3t4UTY7bJcQcLHHidgI1gfPxjGP2nfSDiA hZfqEFdm1IAzSsPjIJWNKC8Douw7pWPrktu5uj75m0L/xvUvPju5suJwrklKPIAQqZXt w+8Px5hgkdVqD9xTUPbE1FY1H3BQziyFD2jy6lxSoFMehqJRrHHZeO2FBNffUzlb71LI sJDQ== 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=QxvQiEvxvN2zcnJcNW5D1CCwsrm5Sd6zOTynJ7YeQTQb/YONuuXCy6hVhvR5Lb+2LF Yj6yfxvdIgie/1M/JGif3nvYYx/Q1dImrsRo3vYaF4jOd2XlMel7dCPPoIdTkR10D7aZ ntHWg8jRO5Lx/ZNdeogNurcUAZvkgVZyEXklCvvtlg7yoqHzW7TV8YNtf6XM9Sv80HZx 4qIDbXNupf0wDLiQSxtJv1C0FX/d8RUE8ncPReuEn87H4hpdCm750V3Ijkci0dWmiyB+ HquDN1KKK9isH6zC/LF+LuggKxYqTFYsBt7JrN8ppIjgds6WK0zFJvkXSBWLnEWxIMf7 dHTw== X-Gm-Message-State: ANhLgQ0B6qx9DVQ1+nE0QudU8gJRPGds27oQMqLKVxG917OLwXJuh5Hc 37T/X6cX8BPii4j1xe2kYdZu/Z+3eGc= X-Google-Smtp-Source: ADFU+vtfwweOui3W5qdNLviCGfO65Y3iD+Blx/UgzREGWLH/F3QMTyQX3PoSBFYpFoVC1T1QGtUSmw== X-Received: by 2002:a17:90b:3653:: with SMTP id nh19mr5194864pjb.41.1584032702126; Thu, 12 Mar 2020 10:05:02 -0700 (PDT) Received: from sc9-mailhost3.vmware.com ([66.170.99.95]) by smtp.gmail.com with ESMTPSA id f69sm2870492pfa.124.2020.03.12.10.04.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Mar 2020 10:05:00 -0700 (PDT) From: William Tu To: dev@openvswitch.org Date: Thu, 12 Mar 2020 10:04:31 -0700 Message-Id: <1584032671-58104-2-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1584032671-58104-1-git-send-email-u9012063@gmail.com> References: <1584032671-58104-1-git-send-email-u9012063@gmail.com> Cc: fbl@sysclose.org, i.maximets@ovn.org Subject: [ovs-dev] [PATCHv5 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])