From patchwork Mon Dec 7 20:30:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1441571 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=) 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 4Dh7Pp4tB7z9sRf for ; Thu, 18 Feb 2021 19:37:50 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 31221872C9; Thu, 18 Feb 2021 08:37:49 +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 lDudtg+KCpSd; Thu, 18 Feb 2021 08:37:48 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id ABD3B872BF; Thu, 18 Feb 2021 08:37:48 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 908E6C000E; Thu, 18 Feb 2021 08:37:48 +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 81F7CC000D for ; Thu, 18 Feb 2021 08:37:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 6FC798666A for ; Thu, 18 Feb 2021 08:37:47 +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 TIaRQz3xzosW for ; Thu, 18 Feb 2021 08:37:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ti0189a330-0925.bb.online.no (ti0189a330-0925.bb.online.no [88.88.218.161]) by whitealder.osuosl.org (Postfix) with ESMTP id BCDC386DDE for ; Thu, 18 Feb 2021 08:37:21 +0000 (UTC) X-Mailbox-Line: From 15a82bc8c4ef2b4a4cec1f87d95c788f0ee8fbd5 Mon Sep 17 00:00:00 2001 Message-Id: <15a82bc8c4ef2b4a4cec1f87d95c788f0ee8fbd5.1613635760.git.frode.nordahl@canonical.com> In-Reply-To: References: From: Dumitru Ceara To: dev@openvswitch.org Date: Mon, 7 Dec 2020 21:30:52 +0100 Subject: [ovs-dev] [PATCH ovn branch-20.06 14/15] tests: Add ofctl_strip_all() to filter OVS flow outputs. 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" Extend the already existing ofctl_strip() to also ignore n_packets, n_bytes, cookie. Use some helper functions from tests/system-userspace-packet-type-aware.at, which will be removed by a future commit. Signed-off-by: Dumitru Ceara Signed-off-by: Numan Siddique (cherry picked from commit 0879a0aa9f332bdc689769a1bc2f156f1c3149a5) Signed-off-by: Frode Nordahl --- tests/ofproto-macros.at | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at index 6c4ff60e7..22999c1ca 100644 --- a/tests/ofproto-macros.at +++ b/tests/ofproto-macros.at @@ -1,12 +1,27 @@ m4_divert_push([PREPARE_TESTS]) [ +# Strips 'n_packets=...' from ovs-ofctl output. +strip_n_packets () { + sed 's/ n_packets=[0-9]*,//' +} + +# Strips 'n_bytes=...' from ovs-ofctl output. +strip_n_bytes () { + sed 's/ n_bytes=[0-9]*,//' +} + +# Strips 'cookie=...' from ovs-ofctl output. +strip_cookie () { + sed 's/ cookie=0x[0-9a-fA-F]*,//' +} + # Strips out uninteresting parts of ovs-ofctl output, as well as parts # that vary from one run to another. ofctl_strip () { sed ' s/ (xid=0x[0-9a-fA-F]*)// s/ duration=[0-9.]*s,// -s/ cookie=0x0,// +s/ cookie=0,// s/ table=0,// s/ n_packets=0,// s/ n_bytes=0,// @@ -19,6 +34,12 @@ s/dir\/[0-9]*\/br0.mgmt/dir\/XXXX\/br0.mgmt/ ' } +# Strips out uninteresting parts of ovs-ofctl output, including n_packets=.. +# n_bytes=.. +ofctl_strip_all () { + ofctl_strip | strip_n_packets | strip_n_bytes | strip_cookie +} + # Filter (multiline) vconn debug messages from ovs-vswitchd.log. # Use with vconn_sub() and ofctl_strip() print_vconn_debug () { awk -F\| < ovs-vswitchd.log '