[YANGTOOLS-757] BA -> BI mapping fails when de-serializing reused identity leaf with default value Created: 13/Mar/17  Updated: 10/Apr/22  Resolved: 14/Mar/17

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

Type: Bug
Reporter: Milos Fabian Assignee: Unassigned
Resolution: Cannot Reproduce 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 bug.zip    
External issue ID: 7959

 Description   

ODL Version: Boron-SR3 SNAPSHOT

Please find attached sample yang data models + failing test case (includes passing workaround test case too).

In model "foo" there are defined: base and derived identity, identity-ref type and grouping containing leaf of defined identity-ref type with default value.

In model "bar" there are defined: container reusing grouping defined in "foo" model and "workaround" container with redefined default value (this one is working as you can see in the test suite).

Error occurs when mapping BA "Bar" container to BI normalized nodes container.

Trace from a test run:

com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException: Supplied QName (urn:opendaylight:bar?revision=2017-03-13)foo-identity is not a valid identity
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
at org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext.getIdentityClass(BindingRuntimeContext.java:447)
at org.opendaylight.yangtools.binding.data.codec.impl.IdentityCodec.deserialize(IdentityCodec.java:27)
at org.opendaylight.yangtools.binding.data.codec.impl.IdentityCodec.deserialize(IdentityCodec.java:17)
at org.opendaylight.yangtools.binding.data.codec.impl.LeafNodeCodecContext.qnameDomValueFromString(LeafNodeCodecContext.java:115)
at org.opendaylight.yangtools.binding.data.codec.impl.LeafNodeCodecContext.createDefaultObject(LeafNodeCodecContext.java:66)
at org.opendaylight.yangtools.binding.data.codec.impl.LeafNodeCodecContext.<init>(LeafNodeCodecContext.java:56)
at org.opendaylight.yangtools.binding.data.codec.impl.BindingCodecContext.getLeafNodesUsingReflection(BindingCodecContext.java:264)
at org.opendaylight.yangtools.binding.data.codec.impl.BindingCodecContext.getLeafNodes(BindingCodecContext.java:229)
at org.opendaylight.yangtools.binding.data.codec.impl.DataObjectCodecContext.<init>(DataObjectCodecContext.java:84)
at org.opendaylight.yangtools.binding.data.codec.impl.ContainerNodeCodecContext.<init>(ContainerNodeCodecContext.java:19)
at org.opendaylight.yangtools.binding.data.codec.impl.DataContainerCodecPrototype.createInstance(DataContainerCodecPrototype.java:126)
at org.opendaylight.yangtools.binding.data.codec.impl.DataContainerCodecPrototype.get(DataContainerCodecPrototype.java:112)
at org.opendaylight.yangtools.binding.data.codec.impl.SchemaRootCodecContext.createDataTreeChildContext(SchemaRootCodecContext.java:175)
at org.opendaylight.yangtools.binding.data.codec.impl.SchemaRootCodecContext.access$000(SchemaRootCodecContext.java:39)
at org.opendaylight.yangtools.binding.data.codec.impl.SchemaRootCodecContext$1.load(SchemaRootCodecContext.java:45)
at org.opendaylight.yangtools.binding.data.codec.impl.SchemaRootCodecContext$1.load(SchemaRootCodecContext.java:42)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
at org.opendaylight.yangtools.binding.data.codec.impl.SchemaRootCodecContext.getOrRethrow(SchemaRootCodecContext.java:242)
at org.opendaylight.yangtools.binding.data.codec.impl.SchemaRootCodecContext.streamChild(SchemaRootCodecContext.java:136)
at org.opendaylight.yangtools.binding.data.codec.impl.DataContainerCodecContext.bindingPathArgumentChild(DataContainerCodecContext.java:79)
at org.opendaylight.yangtools.binding.data.codec.impl.BindingCodecContext.getCodecContextNode(BindingCodecContext.java:127)
at org.opendaylight.yangtools.binding.data.codec.impl.BindingCodecContext.newWriter(BindingCodecContext.java:104)
at org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry.toNormalizedNode(BindingNormalizedNodeCodecRegistry.java:102)
at org.opendaylight.controller.md.sal.binding.impl.BindingToNormalizedNodeCodec.toNormalizedNode(BindingToNormalizedNodeCodec.java:135)
at org.opendaylight.mdsal.bug.BugReusedIdentityLeafWithDefaultValue.bugTest(BugReusedIdentityLeafWithDefaultValue.java:31)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.IllegalArgumentException: Supplied QName (urn:opendaylight:bar?revision=2017-03-13)foo-identity is not a valid identity
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145)
at org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext$1.load(BindingRuntimeContext.java:92)
at org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext$1.load(BindingRuntimeContext.java:88)
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
... 60 more



 Comments   
Comment by Milos Fabian [ 13/Mar/17 ]

Attachment bug.zip has been added with description: yang data models + test suite

Comment by Martin Ciglan [ 13/Mar/17 ]

discussed with Milos, it seems to work with identity prefixed:

grouping foo-grouping {
leaf foo-leaf

{ type foo-type; default foo:foo-identity; }

}
}

moving to yangtools

Comment by Peter Kajsa [ 14/Mar/17 ]

Appropriate prefix of base identity is required, because without the prefix it is not possible to find out correct namespace of the base identity.

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