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

When condition of augment mistakenly added in constraints of augment target

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Resolution: Done
    • None
    • None
    • None
    • None
    • Operating System: All
      Platform: All

    • 5481

    Description

      We are trying to migrate to the new parser in Beryllium, but we've found a bug that is blocking us from migrating.

      When a module augments a target conditionally in another module, the when condition of the augment is added in the constraints of the augment target, which is wrong.

      I've added a minimal example as attachment on this bug.

      When parsing this example, the result can be seen below (this is the output of a dumper that we wrote). The problem is the whenCondition in the getConstraints on the top container, which should not be there.

      (also, there are a number of maxElements values that seem to be wrong, but that is not blocking us)

      [ContainerEffectiveStatementImpl
      getQName=(http://example.com/module1?revision=2016-03-09)top
      isConfiguration=true
      getConstraints=EffectiveConstraintDefinitionImpl

      {whenCondition=module1:top = 'extended', mustConstraints=[], mandatory=false, minElements=0, maxElements=2147483647}

      isAugmenting=false
      isAddedByUses=false
      isPresenceContainer=false
      getAvailableAugmentations=
      [AugmentationSchema
      getWhenCondition=module1:top = 'extended'
      getChildNodes=
      (http://example.com/module2?revision=2016-03-09)extended-leaf
      ]
      getUses=
      getChildNodes=
      [LeafEffectiveStatementImpl
      getQName=(http://example.com/module1?revision=2016-03-09)top-leaf
      isConfiguration=true
      getConstraints=

      {mustConstraints=[], mandatory=false, minElements=0, maxElements=2147483647}
      isAugmenting=false
      isAddedByUses=false
      getDefault=null
      getUnits=null
      getType=
      type=BaseStringType
      getQName=(urn:ietf:params:xml:ns:yang:1)string
      getUnits=null
      getDefaultValue=null
      getBaseType=null
      getLengthConstraints=
      getPatternConstraints=
      ]
      [LeafEffectiveStatementImpl
      getQName=(http://example.com/module2?revision=2016-03-09)extended-leaf
      isConfiguration=true
      getConstraints={mustConstraints=[], mandatory=false, minElements=0, maxElements=2147483647}

      isAugmenting=true
      isAddedByUses=false
      getDefault=null
      getUnits=null
      getType=
      type=BaseStringType
      getQName=(urn:ietf:params:xml:ns:yang:1)string
      getUnits=null
      getDefaultValue=null
      getBaseType=null
      getLengthConstraints=
      getPatternConstraints=
      ]
      ]

      Attachments

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

        Activity

          People

            pkajsa Peter Kajsa
            verthezpw Peter Verthez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: