From patchwork Thu May 16 07:20:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jakob Meng X-Patchwork-Id: 1935817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HAVxxvjp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vg1hr4875z20dQ for ; Thu, 16 May 2024 17:20:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 4864D407E5; Thu, 16 May 2024 07:20:42 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id Pc6he3THKaXr; Thu, 16 May 2024 07:20:41 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.9.56; helo=lists.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 913DA407E1 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HAVxxvjp Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 913DA407E1; Thu, 16 May 2024 07:20:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 44FCDC0077; Thu, 16 May 2024 07:20:38 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9770EC0DCF for ; Thu, 16 May 2024 07:20:33 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 79174821AF for ; Thu, 16 May 2024 07:20:32 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id i9r4KAbDL3IM for ; Thu, 16 May 2024 07:20:31 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=170.10.129.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=jmeng@redhat.com; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 849B9821A1 Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=none dis=none) header.from=redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 849B9821A1 Authentication-Results: smtp1.osuosl.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HAVxxvjp Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 849B9821A1 for ; Thu, 16 May 2024 07:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715844030; 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; bh=2mu5GEshdRauh+adotA1TD6Gk3SjmppEHJa9vsK3dsg=; b=HAVxxvjpwiGCXPKO6DYFT2iUI1vKUB/sqr1rbiMufYuAm9qIxjLNqw/avYWmLlD/wD+Z3l LdhnfEP8iLnXGjWTbnRoJJhcCXEI4woaUWHhO2XVLaOvD/nM7PybwJCjaPwM/pMLv8ojXY GrGIHPusq44B3nYBDCauH97m0GS7rnw= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-261-kDDYVpxVM_OOzyKeYZuBjg-1; Thu, 16 May 2024 03:20:25 -0400 X-MC-Unique: kDDYVpxVM_OOzyKeYZuBjg-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-41feab38d16so27053095e9.3 for ; Thu, 16 May 2024 00:20:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715844023; x=1716448823; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2mu5GEshdRauh+adotA1TD6Gk3SjmppEHJa9vsK3dsg=; b=tcOPHvTUv6lyCuGpakW2vUY//wwbSSykGcpfEZXaimlyU7Q8tEgPmhVA4HD78SIdWV W5DHx4T60wfDFn2K/a9imbK/3EygFWv7gvLkRzj+TcEXSzdQneEGELZF5TxvVxOtUglh /IeO97lYO5HKn5hDS+TJ218T71vx3DdrpW3yEVZCUzIes0L62rUT8QKiobFiDVWPJPzV REBLip8uErZN+pF8MXV1kViaD2fytL6GavCQeP8vxzBIlsBJT3V2AdOKSTjAypNgY9Z2 j4jb6IZsyaNHSdD4j3ADFQSBhfqvr6CfnCCwpoW0xSb00BIZ3AYj99S5ZxTVUosfggOm Q2GQ== X-Gm-Message-State: AOJu0YznaI752UjMyOXoqIWuBKOcBQnMbBJmMQi/bPIh8qSPnTmwuJ3F oGeKP4I2yHbVqOvWzvfzUYpAWyKlUrLV3hOOCu06tQsLC9vr1LX0N4Mi9xPDyoIEKeMVkeAkvmY sB3KPZ4nCKTWMbb1JwSSBPKG+xjlyDedq1IiiJ0kyX9BeErIronNbXlsKWV4m+TiCQJvhqv9gzv vXXIPtaBqEhAABsJUnhD4ybX2WIWrE X-Received: by 2002:a05:600c:1c02:b0:419:f27f:6b05 with SMTP id 5b1f17b1804b1-41feaa2f438mr120875825e9.8.1715844023076; Thu, 16 May 2024 00:20:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwyaFIPdhryRqLIYoTDuqQaeseJJ8StJuuj7L8JrmzghiCpbJhg0fwHT+VFhHPCa3ELJqRow== X-Received: by 2002:a05:600c:1c02:b0:419:f27f:6b05 with SMTP id 5b1f17b1804b1-41feaa2f438mr120875595e9.8.1715844022654; Thu, 16 May 2024 00:20:22 -0700 (PDT) Received: from positronik4lide.. ([87.122.57.114]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-41f9bc3b12fsm151059505e9.0.2024.05.16.00.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 00:20:22 -0700 (PDT) From: jmeng@redhat.com To: dev@openvswitch.org, i.maximets@ovn.org, echaudro@redhat.com, ktraynor@redhat.com, aconole@redhat.com, rjarry@redhat.com Date: Thu, 16 May 2024 09:20:09 +0200 Message-Id: <20240516072015.18455-1-jmeng@redhat.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH v10 0/6] Add global option to output JSON from ovs-appctl cmds. 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: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Jakob Meng v10 addresses all of Ilya's comments for v9 [0], most importantly: * Output formatting has been moved from unixctl_client_transact() in unixctl.c to ovs-appctl.c; same for Python code. * unixctl_command_reply_error() will never wrap plain-text in JSON. * unixctl_command_reply_error_json() has been dropped. * Home-grown args parsing in unixctl_set_options() has been replaced with ovs_cmdl_parse_all(). * ovs-appctl manpage has been updated with '--format' and '--pretty' options. * JSON output is always sorted now (also for non-pretty). * JSON output of 'list-commands' will now be a dictionary, not an array. * JSON output of 'dpif/show' command changed (last patch). * NEWS entries have been sorted, clarified and shortened. * Trailing newline has been moved from program version string to ovs_print_version(). For cleaner JSON output in new 'version' test. [0] https://patchwork.ozlabs.org/project/openvswitch/list/?series=402752&archive=both&state=* Thanks again, Ilya, for your thorough review and helpful suggestions☺️ I hope, the patches are getting better now! Best regards, Jakob Jakob Meng (6): Add global option for JSON output to ovs-appctl. python: Add option for JSON output to unixctl classes and appctl.py. appctl: Add option '--pretty' for pretty-printing JSON output. python: Add option for pretty-printing JSON output to appctl.py. vswitchd: Add JSON output for 'list-commands' command. ofproto: Add JSON output for 'dpif/show' command. Documentation/ref/ovs-appctl.8.rst | 19 +++ NEWS | 9 ++ lib/unixctl.c | 239 ++++++++++++++++++++++------- lib/unixctl.h | 20 ++- lib/util.c | 6 +- ofproto/ofproto-dpif.c | 120 +++++++++++++-- python/ovs/unixctl/client.py | 5 +- python/ovs/unixctl/server.py | 55 +++++-- python/ovs/util.py | 8 + tests/appctl.py | 40 ++++- tests/ovs-vswitchd.at | 29 ++++ tests/pmd.at | 23 +++ tests/unixctl-py.at | 8 + utilities/ovs-appctl.c | 152 +++++++++++++++--- 14 files changed, 625 insertions(+), 108 deletions(-)