Subject: Re: ynl with nftables.yaml

From: Donald Hunter <[email-masked]>
Date: Thu, 30 Oct 2025 12:25:17 +0000

Ratheesh Kannoth <[email-masked]> writes:

> Hi List,
>
> When I get below error, when I execute the example command mentioned in https://lwn.net/Articles/970364/ .  
>
> ####################
> root@localhost:~/linux# ./tools/net/ynl/pyynl/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}'
> Traceback (most recent call last):
>   File "/root/linux/./tools/net/ynl/pyynl/cli.py", line 163, in <module>
>     main()
>     ~~~~^^
>   File "/root/linux/./tools/net/ynl/pyynl/cli.py", line 123, in main
>     ynl = YnlFamily(spec, args.schema, args.process_unknown,
>                     recv_size=args.dbg_small_recv)
>   File "/root/linux/tools/net/ynl/pyynl/lib/ynl.py", line 468, in __init__
>     super().__init__(def_path, schema)
>     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
>   File "/root/linux/tools/net/ynl/pyynl/lib/nlspec.py", line 462, in __init__
>     jsonschema.validate(self.yaml, schema)
>     ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
>   File "/usr/local/lib/python3.13/site-packages/jsonschema/validators.py", line 1332, in validate
>     raise error
> jsonschema.exceptions.ValidationError: 'set id' does not match '^[0-9a-z-]+$'
>
> Failed validating 'pattern' in schema['properties']['attribute-sets']['items']['properties']['attributes']['items']['properties']['name']:
>     {'type': 'string', 'pattern': '^[0-9a-z-]+$'}
>
> On instance['attribute-sets'][34]['attributes'][1]['name']:
>     'set id'

Yes, there is an invalid attribute name in nftables.yaml. The attribute should be
set-id