Merge "Use ImmutableNodes.fromInstanceId in restconf"
authorTony Tkacik <ttkacik@cisco.com>
Fri, 24 Apr 2015 11:47:01 +0000 (11:47 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 24 Apr 2015 11:47:01 +0000 (11:47 +0000)
1  2 
opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/restconf/impl/RestconfImpl.java

index 8e88be6f501a14ccd5f843c9bafb72100bd3d53f,6c44d26d35d9bb03df8c4b29d37b253848e5ccb1..1514a15d1132417849a0efb29e53b0ea26113b8f
@@@ -697,7 -697,7 +697,7 @@@ public class RestconfImpl implements Re
                  if (mountPoint != null) {
                      broker.commitConfigurationDataPut(mountPoint, normalizedII, payload.getData()).checkedGet();
                  } else {
-                     broker.commitConfigurationDataPut(normalizedII, payload.getData()).checkedGet();
+                     broker.commitConfigurationDataPut(controllerContext.getGlobalSchema(), normalizedII, payload.getData()).checkedGet();
                  }
  
                  break;
              throw new RestconfDocumentedException("Input is required.", ErrorType.PROTOCOL, ErrorTag.MALFORMED_MESSAGE);
          }
  
 -        final URI payloadNS = payload.getData().getNodeType().getNamespace();
 -        if (payloadNS == null) {
 -            throw new RestconfDocumentedException(
 -                    "Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)",
 -                    ErrorType.PROTOCOL, ErrorTag.UNKNOWN_NAMESPACE);
 -        }
 +        // FIXME: move this to parsing stage (we can have augmentation nodes here which do not have namespace)
 +//        final URI payloadNS = payload.getData().getNodeType().getNamespace();
 +//        if (payloadNS == null) {
 +//            throw new RestconfDocumentedException(
 +//                    "Data has bad format. Root element node must have namespace (XML format) or module name(JSON format)",
 +//                    ErrorType.PROTOCOL, ErrorTag.UNKNOWN_NAMESPACE);
 +//        }
  
          final DOMMountPoint mountPoint = payload.getInstanceIdentifierContext().getMountPoint();
          final InstanceIdentifierContext<?> iiWithData = payload.getInstanceIdentifierContext();
              if (mountPoint != null) {
                  broker.commitConfigurationDataPost(mountPoint, normalizedII, payload.getData()).checkedGet();
              } else {
-                 broker.commitConfigurationDataPost(normalizedII, payload.getData()).checkedGet();
+                 broker.commitConfigurationDataPost(controllerContext.getGlobalSchema(), normalizedII, payload.getData()).checkedGet();
              }
          } catch(final RestconfDocumentedException e) {
              throw e;