Allow no payload for RPCs with no input 37/80237/2
authorJakub Morvay <jmorvay@frinx.io>
Fri, 8 Feb 2019 13:01:16 +0000 (14:01 +0100)
committerJakub Morvay <jmorvay@frinx.io>
Fri, 8 Feb 2019 13:07:39 +0000 (14:07 +0100)
Do not require empty payload for RPCs with no input defined. Invoking
such RPCs without any payload at all should be also supported.

JIRA: NETCONF-607
Change-Id: Ibf8ca7d65cf25ac54f8283f65f4706ad3f69c5ee
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java

index d9fd106b0706983c698ac94fd08259cb043a05b2..299247214e722d7cceb870b01e4ee79454f2808c 100644 (file)
@@ -433,6 +433,11 @@ public final class RestconfImpl implements RestconfService {
     @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;