Fix failure to generate runtime types with duplicate schema 37/93137/6
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 17 Oct 2020 22:21:51 +0000 (00:21 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 19 Oct 2020 08:44:10 +0000 (08:44 +0000)
commit965b13e31aefdef16f70019b8883164111411d67
tree5be6e58ccb79adba1704a6d5d9827247a7b879c7
parent0737ccce7333e2c9a4414b928701513381a86923
Fix failure to generate runtime types with duplicate schema

The equality contract for TypeDefinition has changed in yangtools-6,
so that TypeDefinitions compare as equal if they represent the same
*semantic* type.

In BindingRuntimeTimes we made the assumption that there is at most
a 1:1 mapping of schema-to-type and used a BiMap to track that
relationship.

Fix that assumption by keeping the maps separate, and teach
RuntimeTypeGenerator to be careful and use an IdentityHashMap to
build that for us.

JIRA: MDSAL-600
Change-Id: Iff5dc7116bf1e5e7c78050d4161282097a3ff033
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/RuntimeTypeGenerator.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/Mdsal600Test.java [new file with mode: 0644]
binding/mdsal-binding-generator-impl/src/test/resources/mdsal600.yang [new file with mode: 0644]
binding/mdsal-binding-runtime-api/src/main/java/org/opendaylight/mdsal/binding/runtime/api/BindingRuntimeTypes.java
binding/mdsal-binding-test-model/src/main/yang/mdsal600.yang [new file with mode: 0644]