From f3969004c6ccac18e742c5fc48c844e315991023 Mon Sep 17 00:00:00 2001 From: Michael DÜrre Date: Thu, 8 Apr 2021 06:34:22 +0200 Subject: update websocketmanager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update complete notification flow Issue-ID: CCSDK-3252 Signed-off-by: Michael DÜrre Change-Id: I87ba00f615707b942471fcace57bcda50ce37e61 --- .../wt/netconfnodestateservice/Capabilities.java | 18 ++++-- .../netconfnodestateservice/NetconfAccessor.java | 15 +++++ .../NetconfBindingAccessor.java | 28 ++++++-- .../NetconfDomAccessor.java | 75 ++++++++++++++++++++-- .../NetconfNotifications.java | 66 ------------------- 5 files changed, 121 insertions(+), 81 deletions(-) delete mode 100644 sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNotifications.java (limited to 'sdnr/wt/netconfnode-state-service/model/src') diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java index cd5339adb..9c24b8b4b 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/Capabilities.java @@ -123,7 +123,7 @@ public class Capabilities { /** * Get Capabilites - * + * * @return List with capabilites */ public List getCapabilities() { @@ -132,21 +132,25 @@ public class Capabilities { /** * Verify if the namespace is supported - * * @param qCapability from model * @return true if namespace is supported */ public boolean isSupportingNamespace(QName qCapability) { - String namespace = qCapability.getNamespace().toString(); - return isSupportingNamespaceAndRevision(namespace, null); + } + /** + * Verify if the namespace is supported + * @param namespace + * @return + */ + public boolean isSupportingNamespace(String namespace) { + return isSupportingNamespaceAndRevision(namespace, null); } /** * check if the namespace and its revision are supported by the given capabilities - * * @param qCapability capability from the model * @return true if supporting the model AND revision
* false if revision not available or both not found. @@ -179,7 +183,7 @@ public class Capabilities { /** * Provide revision as String from QName, considering older formats. - * + * * @param qCapability that specifies the revision * @return String with revisiondate or null */ @@ -208,7 +212,7 @@ public class Capabilities { /** * Get revision of first entry of related capability - * + * * @param qCapability that specifies the namespace * @return String with date or */ diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java index fa544e19a..a419b3ac3 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfAccessor.java @@ -49,8 +49,23 @@ public interface NetconfAccessor { */ Capabilities getCapabilites(); + /** + * check if the device supports RFC5277 {@code urn:ietf:params:netconf:capability:notification:1.0} + * @see https://tools.ietf.org/html/rfc5277#page-5 + * @return true notifications is supported in the capabilities + */ + boolean isNotificationsRFC5277Supported(); + /** + * Get extended accessor using MDSAL Binding API + * @return binding Accessor + */ Optional getNetconfBindingAccessor(); + /** + * Get extended accessor using MDSAL DOM API + * + * @return DOM Accessor + */ Optional getNetconfDomAccessor(); } diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfBindingAccessor.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfBindingAccessor.java index ffcacf213..c77cf5f4e 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfBindingAccessor.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfBindingAccessor.java @@ -17,12 +17,16 @@ */ package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice; -import java.util.Optional; +import com.google.common.util.concurrent.ListenableFuture; +import java.util.List; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.MountPoint; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionOutput; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.NotificationListener; +import org.opendaylight.yangtools.yang.common.RpcResult; /** * Interface handling netconf connection. @@ -46,10 +50,26 @@ public interface NetconfBindingAccessor extends NetconfAccessor { TransactionUtils getTransactionUtils(); /** - * Get notifications handler - * @return + * Get all notification streams + * @return stream list */ - Optional getNotificationAccessor(); + List getNotificationStreams(); + + /** + * Register notifications stream for the connection + * + * @param streamList that contains a list of streams to be subscribed for notifications + * @return progress indication + */ + void registerNotificationsStream(List streamList); + + /** + * Register notifications stream for the connection. + * + * @param streamName that should be "NETCONF" as default. + * @return progress indication + */ + ListenableFuture> registerNotificationsStream(String streamName); /** * Register netconf notification listener for related mountpoint diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java index 0818f7972..01d6659a5 100644 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java @@ -17,15 +17,25 @@ */ package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice; +import com.google.common.util.concurrent.ListenableFuture; +import java.time.Instant; import java.util.Collection; +import java.util.Map; import java.util.Optional; import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.mdsal.dom.api.DOMDataBroker; import org.opendaylight.mdsal.dom.api.DOMMountPoint; import org.opendaylight.mdsal.dom.api.DOMNotificationListener; +import org.opendaylight.mdsal.dom.api.DOMRpcResult; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.create.subscription.input.Filter; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.binding.DataObject; +import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.SchemaPath; @@ -47,6 +57,7 @@ public interface NetconfDomAccessor extends NetconfAccessor { /** * Deliver the data into a class + * * @param DataObject type * @param dataStoreType config or operational database * @param path data path @@ -57,6 +68,7 @@ public interface NetconfDomAccessor extends NetconfAccessor { /** * Read data from device + * * @param dataStoreType * @param path * @return NormalizedNode with data @@ -68,22 +80,77 @@ public interface NetconfDomAccessor extends NetconfAccessor { * * @param specific child class of DOMNotificationListener * @param listener listener to be called - * @param types + * @param types as list of SchemaPath * @return handler to manager registration */ @NonNull ListenerRegistration doRegisterNotificationListener( @NonNull T listener, Collection types); + /** * Register netconf notification listener for related mountpoint * + * @See https://tools.ietf.org/html/rfc5277 * @param - * @param listener - * @param types - * @return + * @param listener to be registers + * @param types as array of SchemaPath + * @return Object to close and access */ @NonNull ListenerRegistration doRegisterNotificationListener( @NonNull T listener, SchemaPath[] types); + /** + * Register netconf notification listener for related mountpoint + * + * @param + * @param listener to be registers + * @param types as array of QName + * @return Object to close and access + */ + @NonNull ListenerRegistration doRegisterNotificationListener( + @NonNull T listener, QName[] types); + /** + * Request notification streams from device. + * + * @return provided streams. + */ + @NonNull + Map getNotificationStreamsAsMap(); + /** + * Send out a NETCONF create-subscription for one notification stream. + * + * @See https://tools.ietf.org/html/rfc5277 + * @param input with CreateSubscriptionInput + * @return RpcMessage for the RPC call. + */ + ListenableFuture invokeCreateSubscription(CreateSubscriptionInput input); + + /** + * Send out a NETCONF create-subscription for one notification stream, using parameters. + * + * @See https://tools.ietf.org/html/rfc5277 + * @param oStream Optional Stream + * @param filter Optional Filter + * @param startTime startTime according the RFC + * @param stopTime stopTime according the RFC + * @return + */ + ListenableFuture invokeCreateSubscription(Optional oStream, Optional filter, + Optional startTime, Optional stopTime); + + /** + * Send out a NETCONF create-subscription for a list of streams, not offering replay options. + * + * @param streams is a list of stream with 0..n elements. + * @return if ok last rpc call result, if notok the result provided by rpc call providing error response. + */ + ListenableFuture invokeCreateSubscription(Stream... streams); + + /** + * Get NETCONF object to serialize between GenericNodes and Java classes + * + * @return serialization object. + */ + BindingNormalizedNodeSerializer getBindingNormalizedNodeSerializer(); } diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNotifications.java b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNotifications.java deleted file mode 100644 index b13030dee..000000000 --- a/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNotifications.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ============LICENSE_START======================================================================== - * ONAP : ccsdk feature sdnr wt - * ================================================================================================= - * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved. - * ================================================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License - * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express - * or implied. See the License for the specific language governing permissions and limitations under - * the License. - * ============LICENSE_END========================================================================== - */ -package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice; - -import com.google.common.util.concurrent.ListenableFuture; -import java.util.List; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionOutput; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.Stream; -import org.opendaylight.yangtools.yang.common.RpcResult; - -/** - * Interface handling netconf connection. - */ -public interface NetconfNotifications { - - static String DefaultNotificationsStream = "NETCONF"; - - /** - * check if the device supports notifications.yang - * @return true if notifications.yang is supported - */ - boolean isNotificationsSupported(); - - /** - * check if the device supports notifications.yang - * @return true if nc-notifications.yang is supported - */ - boolean isNCNotificationsSupported(); - /** - * Get all notification streams - * @return stream list - */ - List getNotificationStreams(); - - /** - * Register notifications stream for the connection - * - * @param streamList that contains a list of streams to be subscribed for notifications - * @return progress indication - */ - void registerNotificationsStream(List streamList); - - /** - * Register notifications stream for the connection. - * - * @param streamName that should be "NETCONF" as default. - * @return progress indication - */ - ListenableFuture> registerNotificationsStream(String streamName); - -} -- cgit 1.2.3-korg