Fix LeafRefContext for relative refs defined in external grouping 71/74871/1
authorMarek Gradzki <mgradzki@cisco.com>
Mon, 30 Jul 2018 06:45:29 +0000 (08:45 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 6 Aug 2018 14:41:45 +0000 (16:41 +0200)
commit6cc3cc053f14daea83992604a49258e4ecc5c012
tree0f5a42493f31abaff9b537cfca461b7da69f803f
parent3efe81ba870335a314ffe487a9e5c4a6edcbca4d
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>
(cherry picked from commit b1feee95519d1bed1387ba417d7ab06eee86e3f9)
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