Uploaded image for project: 'yangtools'
  1. yangtools
  2. YANGTOOLS-956

Augment of mandatory leaf not allowed from within submodule

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Medium
    • Resolution: Done
    • 2.0.10
    • 4.0.3, 3.0.7, 2.1.14
    • parser
    • None

    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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              rovarga Robert Varga
              verthezpw Peter Verthez
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: