diff options
author | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2021-04-08 06:34:22 +0200 |
---|---|---|
committer | Michael DÜrre <michael.duerre@highstreet-technologies.com> | 2021-04-08 06:34:46 +0200 |
commit | f3969004c6ccac18e742c5fc48c844e315991023 (patch) | |
tree | f5486a62e842bb16ca7d3af47a8663df08feef55 /sdnr/wt/netconfnode-state-service/model | |
parent | a252be83694ae33260d99d5371ed48c1558aa2e8 (diff) |
update websocketmanager
update complete notification flow
Issue-ID: CCSDK-3252
Signed-off-by: Michael DÜrre <michael.duerre@highstreet-technologies.com>
Change-Id: I87ba00f615707b942471fcace57bcda50ce37e61
Diffstat (limited to 'sdnr/wt/netconfnode-state-service/model')
6 files changed, 126 insertions, 81 deletions
diff --git a/sdnr/wt/netconfnode-state-service/model/pom.xml b/sdnr/wt/netconfnode-state-service/model/pom.xml index 3c364102d..69f38ed9f 100644 --- a/sdnr/wt/netconfnode-state-service/model/pom.xml +++ b/sdnr/wt/netconfnode-state-service/model/pom.xml @@ -57,6 +57,11 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.opendaylight.mdsal</groupId> + <artifactId>mdsal-binding-dom-codec-api</artifactId> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.onap.ccsdk.features.sdnr.wt</groupId> <artifactId>sdnr-wt-data-provider-model</artifactId> <version>${project.version}</version> 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<String> with capabilites */ public List<String> 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<br> * 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 <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277#page-5</a> + * @return true notifications is supported in the capabilities + */ + boolean isNotificationsRFC5277Supported(); + /** + * Get extended accessor using MDSAL Binding API + * @return binding Accessor + */ Optional<NetconfBindingAccessor> getNetconfBindingAccessor(); + /** + * Get extended accessor using MDSAL DOM API + * + * @return DOM Accessor + */ Optional<NetconfDomAccessor> 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<NetconfNotifications> getNotificationAccessor(); + List<Stream> 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<Stream> streamList); + + /** + * Register notifications stream for the connection. + * + * @param streamName that should be "NETCONF" as default. + * @return progress indication + */ + ListenableFuture<RpcResult<CreateSubscriptionOutput>> 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 <T> 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 <T> specific child class of DOMNotificationListener * @param listener listener to be called - * @param types + * @param types as list of SchemaPath * @return handler to manager registration */ <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener( @NonNull T listener, Collection<SchemaPath> types); + /** * Register netconf notification listener for related mountpoint * + * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a> * @param <T> - * @param listener - * @param types - * @return + * @param listener to be registers + * @param types as array of SchemaPath + * @return Object to close and access */ <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener( @NonNull T listener, SchemaPath[] types); + /** + * Register netconf notification listener for related mountpoint + * + * @param <T> + * @param listener to be registers + * @param types as array of QName + * @return Object to close and access + */ + <T extends DOMNotificationListener> @NonNull ListenerRegistration<DOMNotificationListener> doRegisterNotificationListener( + @NonNull T listener, QName[] types); + /** + * Request notification streams from device. + * + * @return provided streams. + */ + @NonNull + Map<StreamKey, Stream> getNotificationStreamsAsMap(); + /** + * Send out a NETCONF create-subscription for one notification stream. + * + * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a> + * @param input with CreateSubscriptionInput + * @return RpcMessage for the RPC call. + */ + ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(CreateSubscriptionInput input); + + /** + * Send out a NETCONF create-subscription for one notification stream, using parameters. + * + * @See <a href="https://tools.ietf.org/html/rfc5277">https://tools.ietf.org/html/rfc5277</a> + * @param oStream Optional Stream + * @param filter Optional Filter + * @param startTime startTime according the RFC + * @param stopTime stopTime according the RFC + * @return + */ + ListenableFuture<? extends DOMRpcResult> invokeCreateSubscription(Optional<Stream> oStream, Optional<Filter> filter, + Optional<Instant> startTime, Optional<Instant> 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<? extends DOMRpcResult> 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<Stream> 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<Stream> streamList); - - /** - * Register notifications stream for the connection. - * - * @param streamName that should be "NETCONF" as default. - * @return progress indication - */ - ListenableFuture<RpcResult<CreateSubscriptionOutput>> registerNotificationsStream(String streamName); - -} |