Fix config/oper reconciliation for leaf-lists 38/85538/1
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:22:23 +0000 (09:22 +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>
(cherry picked from commit cf8760f55d752af8abafbf09d0f4f9116b9c753b)

restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/utils/ReadDataTransactionUtil.java

index e162181f30b473bb198c9b3aeb27809389e2a98c..6fcdcdbb22530681ac309927e73a88f275da4163 100644 (file)
@@ -648,6 +648,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());