[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m234s9jh0k.fsf@gmail.com>
Date: Fri, 29 Mar 2024 13:37:31 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Jiri
Pirko <jiri@...nulli.us>, Jacob Keller <jacob.e.keller@...el.com>,
Stanislav Fomichev <sdf@...gle.com>, donald.hunter@...hat.com
Subject: Re: [PATCH net-next v1 2/2] tools/net/ynl: Add multi message
support to ynl
Jakub Kicinski <kuba@...nel.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!
Powered by blists - more mailing lists