diff options
| author | Donald Hunter <[email protected]> | 2024-04-18 10:47:36 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2024-04-23 00:20:42 +0000 |
| commit | ba8be00f68f5c70eb1df2193251a579923bd9501 (patch) | |
| tree | bc646c52a13b53dabff062a02240f87085908b60 /tools/testing/selftests/net/lib/py/utils.py | |
| parent | tools/net/ynl: Fix extack decoding for directional ops (diff) | |
| download | kernel-ba8be00f68f5c70eb1df2193251a579923bd9501.tar.gz kernel-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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/testing/selftests/net/lib/py/utils.py')
0 files changed, 0 insertions, 0 deletions
