diff options
author | Donald Hunter <donald.hunter@gmail.com> | 2024-04-18 11:47:36 +0100 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-04-22 17:20:42 -0700 |
commit | ba8be00f68f5c70eb1df2193251a579923bd9501 (patch) | |
tree | bc646c52a13b53dabff062a02240f87085908b60 /tools/testing/selftests/net/lib/py/utils.py | |
parent | 0a966d606c681b891fc7ef2e3ace67ac507a221d (diff) | |
download | linux-ba8be00f68f5c70eb1df2193251a579923bd9501.tar.gz linux-ba8be00f68f5c70eb1df2193251a579923bd9501.tar.bz2 linux-ba8be00f68f5c70eb1df2193251a579923bd9501.zip |
tools/net/ynl: Add multi message support to ynl
Add a "--multi <do-op> <json>" command line to ynl that makes it
possible to add several operations to a single netlink request payload.
The --multi command line option is repeated for each operation.
This is used by the nftables family for transaction batches. For
example:
./tools/net/ynl/cli.py \
--spec Documentation/netlink/specs/nftables.yaml \
--multi batch-begin '{"res-id": 10}' \
--multi newtable '{"name": "test", "nfgen-family": 1}' \
--multi newchain '{"name": "chain", "table": "test", "nfgen-family": 1}' \
--multi batch-end '{"res-id": 10}'
[None, None, None, None]
It can also be used for bundling get requests:
./tools/net/ynl/cli.py \
--spec Documentation/netlink/specs/nftables.yaml \
--multi gettable '{"name": "test", "nfgen-family": 1}' \
--multi getchain '{"name": "chain", "table": "test", "nfgen-family": 1}' \
--output-json
[{"name": "test", "use": 1, "handle": 1, "flags": [],
"nfgen-family": 1, "version": 0, "res-id": 2},
{"table": "test", "name": "chain", "handle": 1, "use": 0,
"nfgen-family": 1, "version": 0, "res-id": 2}]
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://lore.kernel.org/r/20240418104737.77914-4-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/testing/selftests/net/lib/py/utils.py')
0 files changed, 0 insertions, 0 deletions