Codify RestconfServer.yangLibraryVersionGET() 98/108998/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 16 Nov 2023 21:01:34 +0000 (22:01 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 16 Nov 2023 21:08:45 +0000 (22:08 +0100)
The inquiry to the supported ietf-yang-library version is a well-defined
RESTCONF operation. Codify our implementations through RestconfServer.

JIRA: NETCONF-773
Change-Id: Ie969a9d4897c232769005d3c628826401febecbe
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/server/api/RestconfServer.java

index 5b440a25031e82bd999bb49b70206517a1aedd95..ad0916a590a9614c7e275600b7e764eb7ccb3311 100644 (file)
@@ -117,7 +117,8 @@ public final class MdsalRestconfServer implements RestconfServer {
             mountPointService));
     }
 
-    public @NonNull NormalizedNodePayload yangLibraryVersionGET() {
+    @Override
+    public NormalizedNodePayload yangLibraryVersionGET() {
         final var stack = SchemaInferenceStack.of(databindProvider.currentContext().modelContext());
         stack.enterYangData(YangApi.NAME);
         stack.enterDataTree(Restconf.QNAME);
index fff6dc23d9144316cd0bd9cbbb629dc13ce2b4e3..6d99a3834803c518e3e563f17be46782c8dfb7f6 100644 (file)
@@ -11,6 +11,7 @@ import java.net.URI;
 import org.eclipse.jdt.annotation.NonNullByDefault;
 import org.opendaylight.restconf.common.errors.RestconfFuture;
 import org.opendaylight.restconf.nb.rfc8040.databind.OperationInputBody;
+import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
 import org.opendaylight.restconf.server.spi.OperationOutput;
 
 /**
@@ -19,6 +20,16 @@ import org.opendaylight.restconf.server.spi.OperationOutput;
  */
 @NonNullByDefault
 public interface RestconfServer {
+    /**
+     * Return the revision of {@code ietf-yang-library} module implemented by this server, as defined in
+     * <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.3.3">RFC8040 {+restconf}/yang-library-version</a>.
+     *
+     * @return A {@code yang-library-version} element
+     */
+    // FIXME: this is a simple coning-variadic return, similar to how OperationsContent is handled use a common
+    //        construct for both cases
+    // FIXME: RestconfFuture if we transition to being used by restconf-client implementation
+    NormalizedNodePayload yangLibraryVersionGET();
 
     // FIXME: use ApiPath instead of String
     RestconfFuture<OperationOutput> invokeRpc(URI restconfURI, String apiPath, OperationInputBody body);