Tolerate unresolvable leafrefs in groupings 42/41142/7
authorVratko Polak <vrpolak@cisco.com>
Fri, 1 Jul 2016 11:21:15 +0000 (13:21 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 20 Mar 2019 09:28:16 +0000 (09:28 +0000)
commit1e1d8a29875fe39cc41cc430d6d96ccebd5eb5f0
tree2d2b504c77dd9e1079fb0a883117b2ede9b54542
parente4c2cc63642bc697402ef850b87506bf536c6d28
Tolerate unresolvable leafrefs in groupings

In case a grouping contains a relative leafref pointing outside of
the grouping subtree we cannot safely determine the target type, which
lead to an IllegalArgumentException.

In this case we need to resolve the return type to an Object, which
loses type safety, but really is the best we can do as we just do not
know in what contexts that grouping is used.

Unfortunately this requires API changes to mdsal-binding-generator-api
as we need to communicate the fact we are resolving a type definition
in the context of a grouping to TypeProvider implementations.

JIRA: MDSAL-182
Change-Id: Iaf96d133c08eb47f4bb27b6c4f3db1463b78f05e
Signed-off-by: Vratko Polak <vrpolak@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator-api/src/main/java/org/opendaylight/mdsal/binding/generator/spi/TypeProvider.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/AbstractTypeGenerator.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/BaseYangTypes.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/Mdsal182Test.java [new file with mode: 0644]
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/TypeProviderTest.java
binding/mdsal-binding-generator-impl/src/test/resources/mdsal-182/good-leafref.yang [new file with mode: 0644]
binding/mdsal-binding-generator-impl/src/test/resources/mdsal-182/grouping-leafref.yang [new file with mode: 0644]
binding/mdsal-binding-test-model/src/main/yang/mdsal-182.yang [new file with mode: 0644]