Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
5335
Description
In one of the proposed BBF (Broadband Forum) models we are getting an error during parsing, which is, according to us a bug in the YANG parser. We are using the Lithium release currently (the original one, not one of the SRs).
I'm not allowed to attach the BBF model here, but I've reproduced the bug with a dummy model based on the example jukebox model, which I'm attaching here.
The situation is:
- the jukebox-cd module is augmenting the "jukebox" container with an extra child container "cdcapable", which is a container with presence (this last point is crucial)
- the jukebox-cd-sub submodule of the jukebox-cd module is then further augmenting that "cdcapable" container with a mandatory leaf "number-of-cds"
When we parse this via the YANG parser, we are getting the following error:
Error in module 'jukebox-cd-sub' at line 27: Error in augment parsing: cannot augment mandatory node number-of-cds
org.opendaylight.yangtools.yang.parser.util.YangParseException: Error in module 'jukebox-cd-sub' at line 27: Error in augment parsing: cannot augment mandatory node number-of-cds
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.checkAugmentMandatoryNodes(YangParserImpl.java:882)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.resolveAugments(YangParserImpl.java:908)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.build(YangParserImpl.java:712)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseYangModelSources(YangParserImpl.java:358)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseYangModelsMapped(YangParserImpl.java:282)
at org.opendaylight.yangtools.yang.parser.impl.YangParserImpl.parseFiles(YangParserImpl.java:159)
According to us, and the people in the BBF working group, the given augment should be allowed.
In the RFC it says:
If the target node is in another module, then nodes added by the
augmentation MUST NOT be mandatory nodes (see Section 3.1).
But here the target node is in the same module (the augment is in a submodule of that module, but we assume that should not matter).
Also, according to the spirit of the RFC, the fact that the "cdcapable" container is a container with presence, makes that this is a safe augmentation which can't give a problem in clients that don't use the jukebox-cd module (the case of a container without presence is also not forbidden by the letter of the RFC, but could indeed pose a problem for such clients).
Is our understanding correct, so that this is a bug in yang-tools?