Description
We are currently using version 2.0.11 of the YANG parser.
There is a problem with augments of mandatory data. When we parse the model in the attached augmentfailing.zip, the yang parser prints the following warning, and that specific augment is not added:
2019-02-14 12:47:52,504 WARN [com.nokia.netconf.yang.converter.ExportUtilsTest.main()] augment.AbstractAugmentStatementSupport$1 (AbstractAugmentStatementSupport.java:126) - Failed to add augmentation /home/verthezp/tmp/AugBug/sub-module-1.yang:14:4 defined at /home/verthezp/tmp/AugBug/sub-module-2.yang:22:2 org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException: An augment cannot add node 'dummyleaf' because it is mandatory and in module different than target [at /home/verthezp/tmp/AugBug/sub-module-2.yang:16:4]
If we look at the RFC, this is in reference to the following section in https://tools.ietf.org/html/rfc7950#section-7.17 :
If the augmentation adds mandatory nodes (see Section 3) that
represent configuration to a target node in another module, the
augmentation MUST be made conditional with a "when" statement. Care
must be taken when defining the "when" expression so that clients
that do not know about the augmenting module do not break.
But the augment in sub-module-2.yang is not adding mandatory nodes to a target node in another module: mm:first-augment is belonging to the same module. So the warning of ODL seems to be wrong.
The model in the attachment augmentok.zip is succeeding, so the problem may be that the augment in sub-module-2.yang in augmentfailing.zip is targeting '/am:another-container/mm:first-augment', where the first part of the path is indeed in another module. But only the last part of the path determines the target node according to us.
Attachments
Issue Links
- relates to
-
YANGTOOLS-784 Defer statement initialization in InferredStatementContext
-
- Resolved
-