Use declared statements to resolve augments
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 18 Mar 2022 18:37:28 +0000 (19:37 +0100)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 19 Jun 2024 00:41:39 +0000 (10:41 +1000)
commitf7f4e3b6d0fbc988b43d341fe5c2e101d3a25da0
tree16ce8f7f9c91334b2988ddb21fb3fbd12ca2edf8
parentbd2f36e15c68e88195786da8e7fed94a59203fdd
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