From f7cc6a1daa39f583494dc0a71b89e1a1317a0a2b Mon Sep 17 00:00:00 2001 From: Ravi Pendurty Date: Wed, 3 Feb 2021 14:43:58 +0100 Subject: Migrate websocketmanager and netconfnode-state-service Migrate websocketmanager and netconfnode-state-service to Aluminium Issue-ID: CCSDK-3131 Signed-off-by: Ravi Pendurty Change-Id: If82aa071b8187f6cbd02f187d93b61a15463d718 Signed-off-by: Ravi Pendurty --- sdnr/wt/netconfnode-state-service/model/pom.xml | 2 +- .../netconfnodestateservice/NetconfAccessor.java | 69 +---------------- .../NetconfBindingAccessor.java | 64 ++++++++++++++++ .../NetconfDomAccessor.java | 89 ++++++++++++++++++++++ .../NetconfNotifications.java | 66 ++++++++++++++++ .../model/src/main/yang/config.yang | 29 +++++++ 6 files changed, 252 insertions(+), 67 deletions(-) create mode 100644 sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfBindingAccessor.java create mode 100644 sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java create mode 100644 sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNotifications.java create mode 100644 sdnr/wt/netconfnode-state-service/model/src/main/yang/config.yang (limited to 'sdnr/wt/netconfnode-state-service/model') diff --git a/sdnr/wt/netconfnode-state-service/model/pom.xml b/sdnr/wt/netconfnode-state-service/model/pom.xml index c731caee4..35501f6ec 100644 --- a/sdnr/wt/netconfnode-state-service/model/pom.xml +++ b/sdnr/wt/netconfnode-state-service/model/pom.xml @@ -29,7 +29,7 @@ org.onap.ccsdk.parent binding-parent - 2.1.0 + 2.1.1-SNAPSHOT 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 cca71457e..f24503957 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 @@ -17,18 +17,9 @@ */ package org.onap.ccsdk.features.sdnr.wt.netconfnodestateservice; -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 java.util.Optional; import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.NetconfNode; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.NotificationListener; -import org.opendaylight.yangtools.yang.common.RpcResult; /** * Interface handling netconf connection. @@ -52,62 +43,8 @@ public interface NetconfAccessor { */ Capabilities getCapabilites(); - /** - * @return the dataBroker - */ - DataBroker getDataBroker(); - - /** - * @return the MDSAL Mountpoint service - **/ - MountPoint getMountpoint(); - - /** - * @Return TransAction - */ - TransactionUtils getTransactionUtils(); - - /** - * Register netconf notification listener for related mountpoint - * - * @param specific child class of NotificationListener - * @param listener listener to be called - * @return handler to manager registration - */ - ListenerRegistration doRegisterNotificationListener( - @NonNull T listener); + Optional getNetconfBindingAccessor(); - /** - * Register notifications stream for the connection. - * - * @param streamName that should be "NETCONF" as default. - * @return progress indication - */ - ListenableFuture> registerNotificationsStream(String streamName); - - /** - * 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); - - /** - * 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(); + 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 new file mode 100644 index 000000000..ffcacf213 --- /dev/null +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfBindingAccessor.java @@ -0,0 +1,64 @@ +/* + * ============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 java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.MountPoint; +import org.opendaylight.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.NotificationListener; + +/** + * Interface handling netconf connection. + */ +public interface NetconfBindingAccessor extends NetconfAccessor { + + /** + * @return the dataBroker + */ + DataBroker getDataBroker(); + + /** + * @return the MDSAL Mountpoint service + **/ + MountPoint getMountpoint(); + + /** + * Get handler for read/write + * @Return Transaction + */ + TransactionUtils getTransactionUtils(); + + /** + * Get notifications handler + * @return + */ + Optional getNotificationAccessor(); + + /** + * Register netconf notification listener for related mountpoint + * + * @param specific child class of NotificationListener + * @param listener listener to be called + * @return handler to manager registration + */ + ListenerRegistration doRegisterNotificationListener( + @NonNull T listener); + +} 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 new file mode 100644 index 000000000..0818f7972 --- /dev/null +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfDomAccessor.java @@ -0,0 +1,89 @@ +/* + * ============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 java.util.Collection; +import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; +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.yangtools.concepts.ListenerRegistration; +import org.opendaylight.yangtools.yang.binding.DataObject; +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; + +/** + * Interface handling netconf connection. + */ +public interface NetconfDomAccessor extends NetconfAccessor { + + /** + * @return the dataBroker + */ + DOMDataBroker getDataBroker(); + + /** + * @return the MDSAL Mountpoint service + **/ + DOMMountPoint getMountpoint(); + + /** + * Deliver the data into a class + * @param DataObject type + * @param dataStoreType config or operational database + * @param path data path + * @return Optional with object + */ + Optional readData(LogicalDatastoreType dataStoreType, YangInstanceIdentifier path, + Class clazz); + + /** + * Read data from device + * @param dataStoreType + * @param path + * @return NormalizedNode with data + */ + Optional> readDataNode(LogicalDatastoreType dataStoreType, YangInstanceIdentifier path); + + /** + * Register netconf notification listener for related mountpoint + * + * @param specific child class of DOMNotificationListener + * @param listener listener to be called + * @param types + * @return handler to manager registration + */ + @NonNull ListenerRegistration doRegisterNotificationListener( + @NonNull T listener, Collection types); + /** + * Register netconf notification listener for related mountpoint + * + * @param + * @param listener + * @param types + * @return + */ + @NonNull ListenerRegistration doRegisterNotificationListener( + @NonNull T listener, SchemaPath[] types); + + + +} 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 new file mode 100644 index 000000000..b13030dee --- /dev/null +++ b/sdnr/wt/netconfnode-state-service/model/src/main/java/org/onap/ccsdk/features/sdnr/wt/netconfnodestateservice/NetconfNotifications.java @@ -0,0 +1,66 @@ +/* + * ============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); + +} diff --git a/sdnr/wt/netconfnode-state-service/model/src/main/yang/config.yang b/sdnr/wt/netconfnode-state-service/model/src/main/yang/config.yang new file mode 100644 index 000000000..82886e63b --- /dev/null +++ b/sdnr/wt/netconfnode-state-service/model/src/main/yang/config.yang @@ -0,0 +1,29 @@ +module config { + yang-version 1.1; + namespace urn:ietf:params:xml:ns:yang:config; + prefix config; + + revision 2020-12-08 { + description "Initial revision"; + } + + container configuration { + list entry { + key "setting"; + + leaf setting { + type string; + } + leaf value { + type uint8; + } + } + + leaf config1 { + type string; + } + leaf config2 { + type boolean; + } + } +} \ No newline at end of file -- cgit 1.2.3-korg