Use declared statements to resolve augments 51/100151/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 18 Mar 2022 18:37:28 +0000 (19:37 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 19 Mar 2022 10:30:39 +0000 (11:30 +0100)
commitda12199fb82be75eccc92367f387c45f7679d222
tree15094dd4af11c25363decf76aa695e898309041a
parent72648dcb3a85ca7c49ca492cb54acd198cc1e0c9
Use declared statements to resolve augments

When trying to map effective instantiated model back to our Generator
hierarchy we need to not get confused by namespaces. The simplest way
to do that is to pick out augmentations first -- as those are the only
ones what can actually differ in namespace. The rest can be taken care
of just based on localName, as we are dealing with
SchemaTreeEffectiveStatements.

In general we can make the connection by tracing back the path we have
taken towards the instantiation site when seeing an
AugmentEffectiveStatement and match it to the corresponding
AbstractAugmentGenerator. Normally we could do this via straight
comparison of AugmentEffectiveStatements, but unfortunately their
equality contract does not give us that.

The reason for that is that we reuse things across groupings, whereas
YANG parser creates separate instantiations -- hence this breaks down
with UsesAugmentGenerator. We deal with that by comparing the declared
view of the two statements -- and those are guaranteed to be unique.

JIRA: MDSAL-735
Change-Id: I4d8f0e50541b53620cc5b0a2170484e85e9cf717
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 files changed:
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/AbstractAugmentGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/AbstractCompositeGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/AbstractExplicitGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/AugmentResolver.java [new file with mode: 0644]
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/ChildLookup.java [deleted file]
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/ChoiceGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/CompositeRuntimeTypeBuilder.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/IdentityGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/KeyGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/LeafGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/LeafListGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/ModuleAugmentGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/OpaqueObjectGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/TypedefGenerator.java
binding/mdsal-binding-generator/src/main/java/org/opendaylight/mdsal/binding/generator/impl/reactor/UsesAugmentGenerator.java