Fix mapping of Revision in Deviations 79/83679/3
authorTibor Král <tibor.kral@pantheon.tech>
Thu, 15 Aug 2019 15:13:28 +0000 (17:13 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 16 Aug 2019 12:31:46 +0000 (12:31 +0000)
"IllegalArgumentException: Unknown value type Optional" exception
is thrown during initialization of RESTCONF with yang model containing
deviation.

JIRA: NETCONF-637
Change-Id: I8c19eb39d06ff38e691ea9a079507dab40311341
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/mapping/RestconfMappingNodeUtil.java

index 8361ace56e2cf819f096af70c9ce5eb5d0e11363..8a3fed5c00eb651958f39b054a1006ed1f3e8dd2 100644 (file)
@@ -197,14 +197,8 @@ public final class RestconfMappingNodeUtil {
             final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> deviationEntryNode =
                     Builders.mapEntryBuilder((ListSchemaNode) deviationsSchema);
             final QName lastComponent = deviation.getTargetPath().getLastComponent();
-            addChildOfModuleBySpecificModuleInternal(IetfYangLibrary.SPECIFIC_MODULE_NAME_LEAF_QNAME,
-                    deviationEntryNode, context.findModule(lastComponent.getModule()).get().getName(),
-                    ietfYangLibraryModule);
-            if (lastComponent.getRevision().isPresent()) {
-                addChildOfModuleBySpecificModuleInternal(IetfYangLibrary.SPECIFIC_MODULE_REVISION_LEAF_QNAME,
-                        deviationEntryNode, lastComponent.getRevision(),
-                        ietfYangLibraryModule);
-            }
+            addCommonLeafs(context.findModule(lastComponent.getModule()).get(), deviationEntryNode,
+                ietfYangLibraryModule);
             deviations.withChild(deviationEntryNode.build());
         }
         mapEntryBuilder.withChild(deviations.build());