[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220811085022.1539f0e3@kernel.org>
Date: Thu, 11 Aug 2022 08:50:22 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Benjamin Poirier <benjamin.poirier@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, sdf@...gle.com, jacob.e.keller@...el.com,
vadfed@...com, johannes@...solutions.net, jiri@...nulli.us,
dsahern@...nel.org, stephen@...workplumber.org, fw@...len.de,
linux-doc@...r.kernel.org
Subject: Re: [RFC net-next 3/4] ynl: add a sample python library
On Thu, 11 Aug 2022 14:48:49 +0900 Benjamin Poirier wrote:
> The schema validation part was not working. I got it going with the
> following changes. It then flags some problems in ethtool.yaml.
>
> diff --git a/tools/net/ynl/samples/ethtool.py b/tools/net/ynl/samples/ethtool.py
> index 63c8e29f8e5d..4c5a4629748d 100755
> --- a/tools/net/ynl/samples/ethtool.py
> +++ b/tools/net/ynl/samples/ethtool.py
> @@ -14,7 +14,7 @@ def main():
> parser.add_argument('--ifindex', dest='ifindex', type=str)
> args = parser.parse_args()
>
> - ynl = YnlFamily(args.spec)
> + ynl = YnlFamily(args.spec, args.schema)
>
> if args.dev_name:
> channels = ynl.channels_get({'header': {'dev_name': args.dev_name}})
> diff --git a/tools/net/ynl/samples/ynl.py b/tools/net/ynl/samples/ynl.py
> index 59c178e063f1..35c894b0ec19 100644
> --- a/tools/net/ynl/samples/ynl.py
> +++ b/tools/net/ynl/samples/ynl.py
> @@ -247,7 +247,7 @@ class YnlFamily:
> self.yaml = yaml.safe_load(stream)
>
> if schema:
> - with open(os.path.dirname(os.path.dirname(file_name)) + '/schema.yaml', "r") as stream:
> + with open(schema, "r") as stream:
> schema = yaml.safe_load(stream)
>
> jsonschema.validate(self.yaml, schema)
Hah, thanks! Looks like I also changed my mind between 'val' and 'value'
for the explicit value of the enum item. I'll correct those.
Powered by blists - more mailing lists