Merge "BUG 3015 - restconf: Un-helpful error message presented when no service provid...
[netconf.git] / opendaylight / restconf / sal-rest-connector / src / main / java / org / opendaylight / netconf / sal / restconf / impl / RestconfImpl.java
index bc2d23cd70f052cde95e2a304b40f1786a626b70..5356e75e460eef46fefc2aee69a7240e4a270a66 100644 (file)
@@ -717,11 +717,14 @@ public class RestconfImpl implements RestconfService {
          * document the behavior).
          */
         int tries = 2;
+        Status status = Status.NOT_MODIFIED;
         while(true) {
             try {
                 if (mountPoint != null) {
+                    status = broker.readConfigurationData(mountPoint, normalizedII) != null ? Status.OK : Status.CREATED;
                     broker.commitConfigurationDataPut(mountPoint, normalizedII, payload.getData()).checkedGet();
                 } else {
+                    status = broker.readConfigurationData(normalizedII) != null ? Status.OK : Status.CREATED;
                     broker.commitConfigurationDataPut(controllerContext.getGlobalSchema(), normalizedII, payload.getData()).checkedGet();
                 }
 
@@ -745,7 +748,7 @@ public class RestconfImpl implements RestconfService {
             }
         }
 
-        return Response.status(Status.OK).build();
+        return Response.status(status).build();
     }
 
     private static void validateTopLevelNodeName(final NormalizedNodeContext node,