Correct device-notification output 61/110261/2
authorRobert Varga <robert.varga@pantheon.tech>
Sun, 18 Feb 2024 18:22:04 +0000 (19:22 +0100)
committerRobert Varga <nite@hq.sk>
Mon, 19 Feb 2024 10:45:54 +0000 (10:45 +0000)
Stream subscription always results in to stream name, with the actual
location being discoverable via stream state.

JIRA: NETCONF-1102
Change-Id: Ia66c8d944053536f8d7676e120ab4a558137a6a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-common-models/src/main/yang/odl-device-notification.yang
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/mdsal/streams/devnotif/SubscribeDeviceNotificationRpc.java

index cf6849a99d06a38e9b977d192cb8902d06ce6f13..266b9a85377bc28f8dc8120a017f0a9f8a95b47e 100644 (file)
@@ -20,6 +20,10 @@ module odl-device-notification {
      accompanies this distribution, and is available at
      http://www.eclipse.org/legal/epl-v10.html";
 
+  revision "2024-02-18" {
+    description "Corrected output to result in a stream name";
+  }
+
   revision "2022-11-06" {
     description
       "Initial revision";
@@ -30,16 +34,16 @@ module odl-device-notification {
       "Subscribe to notifications on specified device.";
 
     input {
-        leaf path {
-          type instance-identifier;
-          description "Device mount point path";
-        }
-     }
-     output {
-        leaf stream-path {
-          type inet:uri;
-          description "Device Notification stream URL";
-        }
-     }
+      leaf path {
+        type instance-identifier;
+        description "Device mount point path";
+      }
+    }
+    output {
+      leaf stream-name {
+        type string;
+        description "Notification stream name.";
+      }
+    }
   }
 }
index d1918f2e097507542ddc1b6e050a1e0dfd127b85..b75086a5cb3187b23865e389cb135095eced2b2e 100644 (file)
@@ -20,9 +20,9 @@ import org.opendaylight.restconf.server.api.OperationsPostResult;
 import org.opendaylight.restconf.server.spi.OperationInput;
 import org.opendaylight.restconf.server.spi.RestconfStream;
 import org.opendaylight.restconf.server.spi.RpcImplementation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.device.notification.rev221106.SubscribeDeviceNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.device.notification.rev221106.SubscribeDeviceNotificationInput;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.device.notification.rev221106.SubscribeDeviceNotificationOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.device.notification.rev240218.SubscribeDeviceNotification;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.device.notification.rev240218.SubscribeDeviceNotificationInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.device.notification.rev240218.SubscribeDeviceNotificationOutput;
 import org.opendaylight.yangtools.yang.common.ErrorTag;
 import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -42,9 +42,8 @@ import org.osgi.service.component.annotations.Reference;
 public final class SubscribeDeviceNotificationRpc extends RpcImplementation {
     private static final NodeIdentifier DEVICE_NOTIFICATION_PATH_NODEID =
         NodeIdentifier.create(QName.create(SubscribeDeviceNotificationInput.QNAME, "path").intern());
-    // FIXME: NETCONF-1102: this should be 'stream-name'
-    private static final NodeIdentifier DEVICE_NOTIFICATION_STREAM_PATH_NODEID =
-        NodeIdentifier.create(QName.create(SubscribeDeviceNotificationInput.QNAME, "stream-path").intern());
+    private static final NodeIdentifier DEVICE_NOTIFICATION_STREAM_NAME_NODEID =
+        NodeIdentifier.create(QName.create(SubscribeDeviceNotificationInput.QNAME, "stream-name").intern());
 
     private final DOMMountPointService mountPointService;
     private final RestconfStream.Registry streamRegistry;
@@ -85,7 +84,7 @@ public final class SubscribeDeviceNotificationRpc extends RpcImplementation {
                 + new YangInstanceIdentifierSerializer(input.databind()).serializePath(path))
             .transform(stream -> input.newOperationOutput(ImmutableNodes.newContainerBuilder()
                 .withNodeIdentifier(new NodeIdentifier(SubscribeDeviceNotificationOutput.QNAME))
-                .withChild(ImmutableNodes.leafNode(DEVICE_NOTIFICATION_STREAM_PATH_NODEID, stream.name()))
+                .withChild(ImmutableNodes.leafNode(DEVICE_NOTIFICATION_STREAM_NAME_NODEID, stream.name()))
                 .build()));
     }
 }