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

require-instance on leafref is always false in YANG 1.0 models

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Medium Medium
    • 1.1.4, 1.2.3, 2.0.4
    • 1.2.1
    • parser
    • None

      We have now a device that uses a YANG 1.1 model with require-instance=false on a leafref, so we are trying to make sure that we don't validate this leafref by checking when the LeafrefTypeDefinition.requireInstance() method returns false.

      But when we do that, we find that this method returns always false on YANG 1.0 models.   This is wrong, because in YANG 1.0 it should behave always as true (although the keyword did not exist then).   If not, since the parser does not provide input on whether some leaf is coming from a YANG 1.0 or YANG 1.1 model, we can't know whether requireInstance() is false because it was explicitly set as false, or because the keyword didn't exist.

      Attached a small model to reproduce: the "reference" leaf in mycontainer has requireInstance() = false.

      We are using Nitrogen SR1 at this moment.

        1. example.yang
          0.3 kB
          Peter Verthez

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

              Created:
              Updated:
              Resolved: