Closed lordvalumart closed 3 months ago
24. 7. 2024 v 14:24, lordvalumart @.***>:
I would like to augment a container in two mutually-exclusive ways, depending on its contents. I would like both augmentations to introduce a node with the same name but a different type in each case. pyang rejects this with error: there is already a child node to <...> at <...> with the name "..." defined at <...>.
YANG schema validators are unable to determine that the two XPath expressions are mutually exclusive.
Lada
PS. Strictly speaking, they aren’t: if „my-integer“ instance doesn’t exist, then both are false.
Reproducer: module my-module { yang-version 1.1; namespace "urn:example:my-module"; prefix "my-module";
container my-container { leaf my-integer { type uint32; } }
augment "/my-container" { when 'my-integer = 0';
leaf my-new-node { type string; } }
augment "/my-container" { when 'my-integer != 0';
leaf my-new-node { type uint32; } } }
Can anyone say whether this is a bug in pyang, or does the YANG spec prohibit this? Thanks! — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Ladislav Lhotka PGP Key ID: 0xB8F92B08A9F76C67
Thanks, that makes sense. I guess then the message from pyang isn't quite accurate; if the augmentation contains a when
clause pyang can't determine whether or not there is an error.
I would like to augment a container in two mutually-exclusive ways, depending on its contents. I would like both augmentations to introduce a node with the same name but a different type in each case. pyang rejects this with
error: there is already a child node to <...> at <...> with the name "..." defined at <...>
.Reproducer:
Can anyone say whether this is a bug in pyang, or does the YANG spec prohibit this?
Thanks!