Fix codegen of root choices 78/72378/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 28 May 2018 17:51:15 +0000 (19:51 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 28 May 2018 20:12:10 +0000 (20:12 +0000)
commit395c945af30be1669da796f1f3daff9b954fcef8
treeb515e31289f952fcb5264d46fa4a08d5311a641f
parent65288f6d9f1728a5c450d1eb2e5f1d26477e9995
Fix codegen of root choices

If a choice which is a direct child of a module is targeted via
an augment, codegen fails.

The reason for this is that it attempts to use an empty SchemaPath
to find a DataSchemaNode: something that cannot be done. The problem
is the assumption that a Module is a SchemaNode -- which it is not.

To fix this, recognize when the parent path is empty and short-circuit
to the defining module if that is the case.

JIRA: MDSAL-345
Change-Id: I52679c822b220271d943bfbc421049d2dc394d70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f6e117a1e6a41447823258ac525ffcec4781ef0b)
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/AbstractTypeGenerator.java