Fix config/oper reconciliation for leaf-lists 14/85114/6
authorwsx25289 <10200860@zte.com.cn>
Tue, 15 Oct 2019 08:01:30 +0000 (04:01 -0400)
committerRobert Varga <nite@hq.sk>
Mon, 4 Nov 2019 09:21:57 +0000 (09:21 +0000)
When config and operational datastore both have same data, then if
we get data which has a leaf-list node by rests/data, it will fail,
because there is no code to process leaf-list.

Change-Id: I4724447158bf0a1a12e87145dcb361e8196b1170
Signed-off-by: Wsx25289 <10200860@zte.com.cn>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtil.java

index 9f2c74dcb859ab668c463684b5c5c530825d00a7..448599b6ad19b27c4e4ad19df0c96d191e39a59d 100644 (file)
@@ -668,6 +668,11 @@ public final class ReadDataTransactionUtil {
             mapValueToBuilder(((LeafSetNode<Object>) configDataNode).getValue(),
                     ((LeafSetNode<Object>) stateDataNode).getValue(), builder);
             return builder.build();
+        } else if (configDataNode instanceof LeafSetEntryNode) {
+            final NormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>>
+                    builder = Builders.leafSetEntryBuilder().withNodeIdentifier(((LeafSetEntryNode<?>) configDataNode)
+                    .getIdentifier()).withValue(configDataNode.getValue());
+            return builder.build();
         } else if (configDataNode instanceof UnkeyedListNode) {
             final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> builder = Builders
                     .unkeyedListBuilder().withNodeIdentifier(((UnkeyedListNode) configDataNode).getIdentifier());