All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org,  "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	 Paolo Abeni <pabeni@redhat.com>,  Jiri Pirko <jiri@resnulli.us>,
	 Jacob Keller <jacob.e.keller@intel.com>,
	Stanislav Fomichev <sdf@google.com>,
	 donald.hunter@redhat.com
Subject: Re: [PATCH net-next v1 2/2] tools/net/ynl: Add multi message support to ynl
Date: Fri, 29 Mar 2024 13:37:31 +0000	[thread overview]
Message-ID: <m234s9jh0k.fsf@gmail.com> (raw)
In-Reply-To: <20240328175729.15208f4a@kernel.org> (Jakub Kicinski's message of "Thu, 28 Mar 2024 17:57:29 -0700")

Jakub Kicinski <kuba@kernel.org> writes:

> On Wed, 27 Mar 2024 18:17:00 +0000 Donald Hunter wrote:
>> -    parser = argparse.ArgumentParser(description='YNL CLI sample')
>> +    description = """
>> +    YNL CLI utility - a general purpose netlink utility that uses YNL specs
>
> YNL specs is intentional or should have been YAML? :)

I'm not sure it was intentional, but YAML is definitely better :-)

>> +    to drive protocol encoding and decoding.
>> +    """
>> +    epilog = """
>> +    The --multi option can be repeated to include several operations
>> +    in the same netlink payload.
>> +    """
>> +
>> +    parser = argparse.ArgumentParser(description=description,
>> +                                     epilog=epilog)
>>      parser.add_argument('--spec', dest='spec', type=str, required=True)
>>      parser.add_argument('--schema', dest='schema', type=str)
>>      parser.add_argument('--no-schema', action='store_true')
>>      parser.add_argument('--json', dest='json_text', type=str)
>> -    parser.add_argument('--do', dest='do', type=str)
>> -    parser.add_argument('--dump', dest='dump', type=str)
>> +    parser.add_argument('--do', dest='do', metavar='OPERATION', type=str)
>> +    parser.add_argument('--dump', dest='dump', metavar='OPERATION', type=str)
>>      parser.add_argument('--sleep', dest='sleep', type=int)
>>      parser.add_argument('--subscribe', dest='ntf', type=str)
>>      parser.add_argument('--replace', dest='flags', action='append_const',
>> @@ -40,6 +50,8 @@ def main():
>>      parser.add_argument('--output-json', action='store_true')
>>      parser.add_argument('--dbg-small-recv', default=0, const=4000,
>>                          action='store', nargs='?', type=int)
>> +    parser.add_argument('--multi', dest='multi', nargs=2, action='append',
>> +                        metavar=('OPERATION', 'JSON_TEXT'), type=str)
>
> We'd only support multiple "do" requests, I wonder if we should somehow
> call this out. Is --multi-do unnecessary extra typing?

I prefer --multi but will update the help text to say "DO-OPERATIION"
and "... several do operations".

> Code itself looks pretty good!

  reply	other threads:[~2024-03-29 13:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27 18:16 [PATCH net-next v1 0/2] netlink: Add nftables spec w/ multi messages Donald Hunter
2024-03-27 18:16 ` [PATCH net-next v1 1/2] doc/netlink/specs: Add draft nftables spec Donald Hunter
2024-03-27 18:17 ` [PATCH net-next v1 2/2] tools/net/ynl: Add multi message support to ynl Donald Hunter
2024-03-29  0:57   ` Jakub Kicinski
2024-03-29 13:37     ` Donald Hunter [this message]
2024-03-29 15:43       ` Jakub Kicinski
2024-03-29 18:57         ` Donald Hunter
2024-03-29 21:01           ` Donald Hunter
2024-03-29 21:01             ` Donald Hunter
2024-03-29 21:46             ` Jakub Kicinski
2024-03-29 21:46               ` Jakub Kicinski
2024-03-29 22:12               ` Pablo Neira Ayuso
2024-03-27 22:45 ` [PATCH net-next v1 0/2] netlink: Add nftables spec w/ multi messages Pablo Neira Ayuso
2024-03-28 15:33   ` Donald Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m234s9jh0k.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@redhat.com \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.