From patchwork Fri Nov 8 11:15:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1191824 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.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.b="XahYceT6"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 478d716T6Vz9sNH for ; Fri, 8 Nov 2019 22:18:21 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 04BF213EE; Fri, 8 Nov 2019 11:15:39 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E218F13EC for ; Fri, 8 Nov 2019 11:15:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id B9507EC for ; Fri, 8 Nov 2019 11:15:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573211735; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KWERE+vDy86o9TXSzuJT8sl4iDhb2jUSE6LuyWPNUsE=; b=XahYceT60FFKiL3rQices5ldqW7nfF5LVzqE38NEEW4AsYmWoQP6gbTCltN13oh5w1thsK gfUfplGL7KyvM7568mFyQetAZJB1WOcxfWhjCvWZ3YuaJUszaM41XMS9F6+aFds+/yFLht yzXqFQQDQG7lrNIsz8j8OkmIpvuGQ4A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-62-7xDhvjV0N9uxtKcxuuwf2g-1; Fri, 08 Nov 2019 06:15:33 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 514441800D7B; Fri, 8 Nov 2019 11:15:32 +0000 (UTC) Received: from dceara.remote.csb (ovpn-117-112.ams2.redhat.com [10.36.117.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A30060C18; Fri, 8 Nov 2019 11:15:31 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 8 Nov 2019 12:15:28 +0100 Message-Id: <20191108111523.10100.58145.stgit@dceara.remote.csb> In-Reply-To: <20191108111457.10100.28180.stgit@dceara.remote.csb> References: <20191108111457.10100.28180.stgit@dceara.remote.csb> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: 7xDhvjV0N9uxtKcxuuwf2g-1 X-Mimecast-Spam-Score: 0 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: hzhou@ovn.org Subject: [ovs-dev] [PATCH ovn 2/3] ovn-detrace: Fix line parsing. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org The script was never parsing the first cookie in the input. Also, add a check to make sure that the cookie refers to a Logical_Flow before trying to print the record. Signed-off-by: Dumitru Ceara --- utilities/ovn-detrace.in | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/utilities/ovn-detrace.in b/utilities/ovn-detrace.in index 9471e37..34b6b0e 100755 --- a/utilities/ovn-detrace.in +++ b/utilities/ovn-detrace.in @@ -188,22 +188,26 @@ def main(): cookie = None while True: line = sys.stdin.readline() + + if line == '': + break + + line = line.strip() + if cookie: # print lflow info when the current flow block ends - if regex_table_id.match(line) or line.strip() == '': + if regex_table_id.match(line): lflow = get_lflow_from_cookie(ovsdb_ovnsb, cookie) - print_lflow(lflow, " * ") - print_lflow_nb_hint(lflow, " * ", ovsdb_ovnnb) - cookie = None + if lflow: + print_lflow(lflow, " * ") + print_lflow_nb_hint(lflow, " * ", ovsdb_ovnnb) + cookie = None - print line.strip() - if line == "": - break + print line m = regex_cookie.match(line) - if not m: - continue - cookie = m.group(1) + if m: + cookie = m.group(1) if __name__ == "__main__":