Document RestconfServer.invokeRpc() 99/108999/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 16 Nov 2023 21:31:34 +0000 (22:31 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 18 Nov 2023 07:59:29 +0000 (08:59 +0100)
This should be called operationsPOST() to keep with flexible naming.
Document the behaviour and tie it to RFC8040.

JIRA: NETCONF-773
Change-Id: I05f77706de74e7fb2af57060317246d7773e92ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/MdsalRestconfServer.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfOperationsServiceImpl.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/RestconfServer.java

index ad0916a590a9614c7e275600b7e764eb7ccb3311..55f9bdb433ae0f4158302082d066db4b5f30347a 100644 (file)
@@ -128,7 +128,7 @@ public final class MdsalRestconfServer implements RestconfServer {
     }
 
     @Override
-    public RestconfFuture<OperationOutput> invokeRpc(final URI restconfURI, final String apiPath,
+    public RestconfFuture<OperationOutput> operationsPOST(final URI restconfURI, final String apiPath,
             final OperationInputBody body) {
         final var currentContext = databindProvider.currentContext();
         final var reqPath = bindRequestPath(currentContext, apiPath);
index 7a600eb3a4ba4a2ae5c4092602638bf3bcfb8b3a..9def8bd0d9b886eb96c2e7773ccb68401d30d5e9 100644 (file)
@@ -159,7 +159,7 @@ public final class RestconfOperationsServiceImpl {
 
     private void invokeRpc(final String identifier, final UriInfo uriInfo, final AsyncResponse ar,
             final OperationInputBody body) {
-        server.invokeRpc(uriInfo.getBaseUri(), identifier, body)
+        server.operationsPOST(uriInfo.getBaseUri(), identifier, body)
             .addCallback(new JaxRsRestconfCallback<OperationOutput>(ar) {
                 @Override
                 Response transform(final OperationOutput result) {
index 6d99a3834803c518e3e563f17be46782c8dfb7f6..431bc262b0bf365dc8e2d6de7700cb0931678a99 100644 (file)
@@ -9,6 +9,7 @@ package org.opendaylight.restconf.server.api;
 
 import java.net.URI;
 import org.eclipse.jdt.annotation.NonNullByDefault;
+import org.opendaylight.restconf.api.ApiPath;
 import org.opendaylight.restconf.common.errors.RestconfFuture;
 import org.opendaylight.restconf.nb.rfc8040.databind.OperationInputBody;
 import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
@@ -31,6 +32,17 @@ public interface RestconfServer {
     // FIXME: RestconfFuture if we transition to being used by restconf-client implementation
     NormalizedNodePayload yangLibraryVersionGET();
 
+    /**
+     * Invoke an RPC operation, as defined in
+     * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.6">RFC8040 Operation Resource</a>.
+     *
+     * @param restconfURI Base URI of the request
+     * @param operation {@code <operation>} path, really an {@link ApiPath} to an {@code rpc}
+     * @param body RPC operation
+     * @return A {@link RestconfFuture} of the {@link OperationOutput operation result}
+     */
+    // FIXME: 'operation' should really be an ApiIdentifier with non-null module, but we also support ang-ext:mount,
+    //        and hence it is a path right now
     // FIXME: use ApiPath instead of String
-    RestconfFuture<OperationOutput> invokeRpc(URI restconfURI, String apiPath, OperationInputBody body);
+    RestconfFuture<OperationOutput> operationsPOST(URI restconfURI, String operation, OperationInputBody body);
 }