Bug: 8037 YANG Patch using "replace" instead of "merge" 01/53701/1
authorWenbo Hu <huwenbo1988@gmail.com>
Tue, 21 Mar 2017 23:46:39 +0000 (10:46 +1100)
committerWenbo Hu <huwenbo1988@gmail.com>
Thu, 23 Mar 2017 06:43:34 +0000 (06:43 +0000)
Change-Id: Ic53b0649b52529e9bf244b82d85582d343aa95e9
Signed-off-by: Wenbo Hu <huwenbo1988@gmail.com>
(cherry picked from commit c82fa3134d0f582f7e49f5b6cfe8e50a02d77f19)

restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java
restconf/sal-rest-connector/src/main/java/org/opendaylight/restconf/restful/utils/PatchDataTransactionUtil.java

index e71934d6642c2c12b31c12f7deaa47a30a6a7735..62b8eb77670fb4845a0842053f2d4a1c0cfb98b0 100644 (file)
@@ -1150,12 +1150,9 @@ public class BrokerFacade {
         LOG.trace("Merge {} within Restconf PATCH: {} with payload {}", datastore.name(), path, payload);
         ensureParentsByMerge(datastore, path, writeTransaction, schemaContext);
 
-        // merging is necessary only for lists otherwise we can call put method
-        if (payload instanceof MapNode) {
-            writeTransaction.merge(datastore, path, payload);
-        } else {
-            writeTransaction.put(datastore, path, payload);
-        }
+        // Since YANG Patch provides the option to specify what kind of operation for each edit,
+        // OpenDaylight should not change it.
+        writeTransaction.merge(datastore, path, payload);
     }
 
     public void setDomDataBroker(final DOMDataBroker domDataBroker) {
index 4741592977562a631056fe57949ff4f220ddeaa3..88502e6aad2a471589c5d824fffc97d2ff197f1e 100644 (file)
@@ -205,13 +205,7 @@ public final class PatchDataTransactionUtil {
                                                    final SchemaContextRef schemaContextRef) {
         LOG.trace("Merge {} within Restconf PATCH: {} with payload {}", dataStore.name(), path, payload);
         TransactionUtil.ensureParentsByMerge(path, schemaContextRef.get(), writeTransaction);
-
-        // merging is necessary only for lists otherwise we can call put method
-        if (payload instanceof MapNode) {
-            writeTransaction.merge(dataStore, path, payload);
-        } else {
-            writeTransaction.put(dataStore, path, payload);
-        }
+        writeTransaction.merge(dataStore, path, payload);
     }
 
     /**