Fix LeafRefContext for relative refs defined in external grouping 30/74630/2
authorMarek Gradzki <mgradzki@cisco.com>
Mon, 30 Jul 2018 06:45:29 +0000 (08:45 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 2 Aug 2018 08:49:14 +0000 (08:49 +0000)
commitb1feee95519d1bed1387ba417d7ab06eee86e3f9
treeecae97d4f6ea5c6b32300405b3847bca0d2cfa53
parent26e5a7d6b7872dac5143aa796a8e1f8b550ce929
Fix LeafRefContext for relative refs defined in external grouping

LeafRefPathParserListenerImpl builds LeafRefPath
using namespace of the module which contains leafref definition.

While it is valid approach for absolute paths with prefix (YANGTOOLS-749),
it cannot be used with groupings, because they are bound to namespace
when contents of the grouping is added to the schema tree.

This patch fixes the relative path case
by using the module which uses leafref.

JIRA: YANGTOOLS-891
Change-Id: Ia903138f80c437937374eb7d3460fdbe8b2a97c2
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
yang/yang-data-codec-xml/src/test/java/org/opendaylight/yangtools/yang/data/codec/xml/Yangtools891Test.java [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/bar.yang [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/baz-top.xml [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/baz.yang [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/foo.yang [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/grouping-with-leafref-invalid.xml [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/grouping-with-leafref-valid.xml [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/grouping-with-list-invalid.xml [new file with mode: 0644]
yang/yang-data-codec-xml/src/test/resources/yangtools891/grouping-with-list-valid.xml [new file with mode: 0644]
yang/yang-data-impl/src/main/java/org/opendaylight/yangtools/yang/data/impl/leafref/LeafRefPathParserListenerImpl.java