[YANGTOOLS-589] When condition of augment mistakenly added in constraints of augment target Created: 09/Mar/16  Updated: 10/Apr/22  Resolved: 11/Mar/16

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Peter Verthez Assignee: Peter Kajsa
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: Zip Archive modules.zip    
External issue ID: 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=
]
]



 Comments   
Comment by Peter Verthez [ 09/Mar/16 ]

Attachment modules.zip has been added with description: Minimal example

Comment by Peter Kajsa [ 10/Mar/16 ]

fix master: https://git.opendaylight.org/gerrit/#/c/36058/2
fix stable/beryllium: https://git.opendaylight.org/gerrit/#/c/36060/

Generated at Wed Feb 07 20:53:41 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.