From patchwork Tue Mar 17 20:02:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 1256862 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.138; helo=whitealder.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=uVtX8baj; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48hkcv5vTvz9sNg for ; Wed, 18 Mar 2020 07:03:27 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id E90D288A5B; Tue, 17 Mar 2020 20:03:25 +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 35rIjjukB5qV; Tue, 17 Mar 2020 20:03:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 448DD88A29; Tue, 17 Mar 2020 20:03:13 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2EAC3C18DA; Tue, 17 Mar 2020 20:03:13 +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 80C92C013E for ; Tue, 17 Mar 2020 20:03:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6ED1B888FB for ; Tue, 17 Mar 2020 20:03:11 +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 po8+sGs5YwRA for ; Tue, 17 Mar 2020 20:03:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by hemlock.osuosl.org (Postfix) with ESMTPS id E1874888EE for ; Tue, 17 Mar 2020 20:03:10 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id t3so12317477pgn.1 for ; Tue, 17 Mar 2020 13:03:10 -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=uVtX8bajZ7wY2b6yy2C/IyX0AUUGxg6uaONBgOX1odO9hMOuxoMnj/po/Dl0S+s/g7 Hjn++8EBye+Y3yLvHMBFGizMuYdGOjy5lREHXhkPOGJHmrGO7kXGr0lWxSKhvMU4PjZo Qu8G+NVAIbt0AiVQUa8gJH1eqwKvz7veIjkbV1GlgtyRjXmuNPIRB9+jNAQKsk6AsT9n 5aLlE9F80Ful9dBMR3W/EqGyZl3jJXRQdxy49J/2zQqKsknVUWO3KtcS6mna8HAEli51 u5j/QglzUi69RE99TuuIK22NY0uSYVhatIYEDOX33leXlzo4qI0KfJPpwOQ9Megm2hi2 fJZg== 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=KS0kAyriQDVcvgY6O6CVuVSV/GRNuwRraItlfDSoCSPvOigX6KDMaZdXSaRK+7D18F IGNIlS59TtH2LE5+aHYCZElwRjdnVXYTMvmM7eqvecKtrg6gS02s0sDnTODvmif5OBe+ 3xhaF68aDv+a7RwjFA5u8BE1WRpQHsgb93cFLLXZH9tQjTAbS/uNXb8YWFZnW9pd2i+L luB8Tc+0xIzyJa4m7PcELe8Oml1b9gGs0b+T0d1x23YLRGFYWDsiP2jgpXhiCoO7/QSi C1omEx75bUvfB95rq5iGgjTNuUppNkIAwOFdh8RjoQVrxrApvQvZjsgNLCpG1xbb8a7k HCqQ== X-Gm-Message-State: ANhLgQ1TY6PXOvqPqLgw2GSBUDd2a6AORIDR6Ur0c995C2GHPqX56uqp bJ6HIF9qLRWco0U55erDAGoQmKlc X-Google-Smtp-Source: ADFU+vsx/DyyyWgPsZgH4cppjdaDdIgCSIfyJmwvFtaxqwsjveZwHo37XDDP90JsR0/qq4gn8iuSPA== X-Received: by 2002:a63:e511:: with SMTP id r17mr891928pgh.352.1584475385831; Tue, 17 Mar 2020 13:03:05 -0700 (PDT) Received: from sc9-mailhost3.vmware.com (c-76-21-95-192.hsd1.ca.comcast.net. [76.21.95.192]) by smtp.gmail.com with ESMTPSA id s98sm203502pjb.46.2020.03.17.13.03.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Mar 2020 13:03:03 -0700 (PDT) From: William Tu To: dev@openvswitch.org Date: Tue, 17 Mar 2020 13:02:09 -0700 Message-Id: <1584475329-101190-2-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1584475329-101190-1-git-send-email-u9012063@gmail.com> References: <1584475329-101190-1-git-send-email-u9012063@gmail.com> Cc: fbl@sysclose.org, i.maximets@ovn.org Subject: [ovs-dev] [PATCHv7 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])