Merge "Allow no payload for RPCs with no input"
authorJakub Morvay <jakub.morvay@gmail.com>
Fri, 8 Feb 2019 18:38:15 +0000 (18:38 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 8 Feb 2019 18:38:15 +0000 (18:38 +0000)
1  2 
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java

index 0f947884f49232cd56229c93d669f33dfe10d593,299247214e722d7cceb870b01e4ee79454f2808c..60fcfff5189d859942bf981ea74bc8bc8da22367
@@@ -433,6 -433,11 +433,11 @@@ public final class RestconfImpl impleme
      @Override
      public NormalizedNodeContext invokeRpc(final String identifier, final NormalizedNodeContext payload,
              final UriInfo uriInfo) {
+         if (payload == null) {
+             // no payload specified, reroute this to no payload invokeRpc implementation
+             return invokeRpc(identifier, "", uriInfo);
+         }
          final SchemaPath type = payload.getInstanceIdentifierContext().getSchemaNode().getPath();
          final URI namespace = payload.getInstanceIdentifierContext().getSchemaNode().getQName().getNamespace();
          final ListenableFuture<DOMRpcResult> response;
          }
  
          if (!rpc.getInput().getChildNodes().isEmpty()) {
 -            LOG.debug("RPC {} does not need input value.", rpc);
 -            throw new RestconfDocumentedException("RPC " + rpc + " does not take any input value.",
 -                    ErrorType.RPC, ErrorTag.INVALID_VALUE);
 +            LOG.debug("No input specified for RPC {} with an input section", rpc);
 +            throw new RestconfDocumentedException("No input specified for RPC " + rpc
 +                    + " with an input section defined", ErrorType.RPC, ErrorTag.MISSING_ELEMENT);
          }
  
          final ListenableFuture<DOMRpcResult> response;