Tie RestconfStreamsSubscriptionServiceImpl to its model 67/107067/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Jul 2023 17:41:17 +0000 (19:41 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Jul 2023 20:52:44 +0000 (22:52 +0200)
The implementation here is tied to subscribe-to-notification.yang,
make sure we have a strong connection to the model.

Change-Id: Ia1fc08b37a483d6ae69580c90da30687a4f779f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-common-models/src/main/yang/subscribe-to-notification.yang
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfStreamsSubscriptionServiceImpl.java

index 5fe7df70a6cede13b03ce4ef9a1523cdb0e1acd6..e350528cbd4645e27cdd3af1590ed4270aa8795e 100644 (file)
@@ -1,5 +1,4 @@
 module subscribe-to-notification {
-
     yang-version 1;
     namespace "subscribe:to:notification";
     prefix "subs-to-notifi";
@@ -7,11 +6,10 @@ module subscribe-to-notification {
     description
         "Added input parameters to rpc create-data-change-event-subscription and to create-notification-stream";
 
-    revision "2016-10-28" {
-    }
+    revision "2016-10-28";
 
-    container "notifi"{
-        leaf "location"{
+    container notifi {
+        leaf location {
             type string;
         }
     }
index de030d0ea289e8f48e5e17e82f823b9231f2a78f..305db75a4b0777a63f6ff537c564a66d2d9dace1 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
 import org.opendaylight.restconf.nb.rfc8040.rests.services.api.RestconfStreamsSubscriptionService;
 import org.opendaylight.restconf.nb.rfc8040.rests.utils.RestconfStreamsConstants;
 import org.opendaylight.restconf.nb.rfc8040.streams.StreamsConfiguration;
+import org.opendaylight.yang.gen.v1.subscribe.to.notification.rev161028.Notifi;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
@@ -34,10 +35,8 @@ import org.slf4j.LoggerFactory;
 @Path("/")
 public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSubscriptionService {
     private static final Logger LOG = LoggerFactory.getLogger(RestconfStreamsSubscriptionServiceImpl.class);
-    private static final QName LOCATION_QNAME =
-        QName.create("subscribe:to:notification", "2016-10-28", "location").intern();
+    private static final QName LOCATION_QNAME = QName.create(Notifi.QNAME, "location").intern();
     private static final NodeIdentifier LOCATION_NODEID = NodeIdentifier.create(LOCATION_QNAME);
-    private static final QName NOTIFI_QNAME = QName.create(LOCATION_QNAME, "notifi").intern();
 
     private final SubscribeToStreamUtil streamUtils;
     private final HandlersHolder handlersHolder;
@@ -87,7 +86,7 @@ public class RestconfStreamsSubscriptionServiceImpl implements RestconfStreamsSu
      */
     private static InstanceIdentifierContext prepareIIDSubsStreamOutput(final EffectiveModelContext modelContext) {
         return InstanceIdentifierContext.ofStack(
-            SchemaInferenceStack.ofDataTreePath(modelContext, NOTIFI_QNAME, LOCATION_QNAME));
+            SchemaInferenceStack.ofDataTreePath(modelContext, Notifi.QNAME, LOCATION_QNAME));
     }
 
     /**