From: Jakub Morvay Date: Fri, 18 Jan 2019 13:19:43 +0000 (+0100) Subject: Remove netconf-notification X-Git-Tag: release/neon~10^2~1 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=netconf.git;a=commitdiff_plain;h=17e8bd47d5568174d123c72179af61863179a1e5 Remove netconf-notification Remove netconf-notification project. This project has two functions. It provides implementation of netconf notifications logic in netconf servers. The second function is that it also starts netconf notification infrastructure. This used to be wired with other netconf server components and together they formed netconf server for css. css does not longer exist. Get rid of netconf-notification instantiation logic (Activator and other related classes). It is not longer needed. Also move other classes to mdsal-netconf-notification project. This project just starts this notification infrastructure for mdsal netconf northbound endpoint and now is primary user of this classes. Change-Id: I3f2968623295beff9bcfbce6aa48c82532ef1502 Signed-off-by: Jakub Morvay --- diff --git a/features/netconf/odl-netconf-notifications-impl/pom.xml b/features/netconf/odl-netconf-notifications-impl/pom.xml index 790e48f479..b9002ab020 100644 --- a/features/netconf/odl-netconf-notifications-impl/pom.xml +++ b/features/netconf/odl-netconf-notifications-impl/pom.xml @@ -56,10 +56,5 @@ xml features - - ${project.groupId} - netconf-notifications-impl - ${project.version} - diff --git a/netconf/mdsal-netconf-notification/pom.xml b/netconf/mdsal-netconf-notification/pom.xml index 4e58605b53..d06c953f09 100644 --- a/netconf/mdsal-netconf-notification/pom.xml +++ b/netconf/mdsal-netconf-notification/pom.xml @@ -15,62 +15,57 @@ ../netconf-parent - org.opendaylight.netconf mdsal-netconf-notification 1.6.0-SNAPSHOT ${project.artifactId} bundle - - ${project.groupId} - netconf-mapping-api + com.google.guava + guava - ${project.groupId} - netconf-notifications-impl + org.opendaylight.controller + sal-common-util - ${project.groupId} - netconf-notifications-api + org.opendaylight.mdsal + mdsal-binding-generator-impl org.opendaylight.mdsal mdsal-binding-api - org.opendaylight.controller - sal-common-util + org.opendaylight.mdsal + mdsal-binding-dom-codec - - org.slf4j - slf4j-api + ${project.groupId} + ietf-netconf-notifications - com.google.guava - guava + ${project.groupId} + netconf-api + + + ${project.groupId} + netconf-notifications-api + + + ${project.groupId} + netconf-mapping-api + + + ${project.groupId} + netconf-util - org.opendaylight.yangtools - mockito-configuration + org.xmlunit + xmlunit-legacy + test - - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.artifactId} - netconf-notifications-impl - - - - - diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducer.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducer.java similarity index 98% rename from netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducer.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducer.java index a7c695cf53..7b810a9908 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducer.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducer.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/NetconfNotificationManager.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationManager.java similarity index 98% rename from netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/NetconfNotificationManager.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationManager.java index 01ab841163..d9d18e008c 100644 --- a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/NetconfNotificationManager.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationManager.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.notifications.impl; +package org.opendaylight.netconf.mdsal.notification.impl; import com.google.common.base.Preconditions; import com.google.common.collect.HashMultimap; @@ -19,6 +19,7 @@ import java.util.Map; import java.util.Set; import javax.annotation.concurrent.GuardedBy; import javax.annotation.concurrent.ThreadSafe; +import org.opendaylight.netconf.mdsal.notification.impl.ops.NotificationsTransformUtil; import org.opendaylight.netconf.notifications.BaseNotificationPublisherRegistration; import org.opendaylight.netconf.notifications.NetconfNotification; import org.opendaylight.netconf.notifications.NetconfNotificationCollector; @@ -27,7 +28,6 @@ import org.opendaylight.netconf.notifications.NetconfNotificationRegistry; import org.opendaylight.netconf.notifications.NotificationListenerRegistration; import org.opendaylight.netconf.notifications.NotificationPublisherRegistration; import org.opendaylight.netconf.notifications.NotificationRegistration; -import org.opendaylight.netconf.notifications.impl.ops.NotificationsTransformUtil; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.Streams; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.StreamsBuilder; diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationService.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationOperationService.java similarity index 92% rename from netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationService.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationOperationService.java index fef38d1c90..3bfa7baaf7 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationService.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationOperationService.java @@ -6,14 +6,14 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import java.util.Collections; import java.util.Set; import org.opendaylight.netconf.mapping.api.NetconfOperation; import org.opendaylight.netconf.mapping.api.NetconfOperationService; +import org.opendaylight.netconf.mdsal.notification.impl.ops.CreateSubscription; import org.opendaylight.netconf.notifications.NetconfNotificationRegistry; -import org.opendaylight.netconf.notifications.impl.ops.CreateSubscription; public class NetconfNotificationOperationService implements NetconfOperationService { private final Set netconfOperations; diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationServiceFactory.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationOperationServiceFactory.java similarity index 97% rename from netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationServiceFactory.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationOperationServiceFactory.java index 1846494aa8..15e39790ee 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/NetconfNotificationOperationServiceFactory.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationOperationServiceFactory.java @@ -6,7 +6,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import java.util.Collections; import java.util.Set; diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NotificationToMdsalWriter.java similarity index 98% rename from netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NotificationToMdsalWriter.java index d19fa0b777..5ab4b294b2 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/NotificationToMdsalWriter.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.MoreExecutors; diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListener.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/OperationalDatastoreListener.java similarity index 96% rename from netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListener.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/OperationalDatastoreListener.java index 3275f29796..5154b83874 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListener.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/OperationalDatastoreListener.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.DataTreeChangeListener; diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducer.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/SessionNotificationProducer.java similarity index 98% rename from netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducer.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/SessionNotificationProducer.java index 4bc7d9ff13..3bea088fd8 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducer.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/SessionNotificationProducer.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import com.google.common.base.Preconditions; import java.util.Collection; diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/ops/CreateSubscription.java similarity index 97% rename from netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/ops/CreateSubscription.java index bfc59c2598..710dcdf007 100644 --- a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/ops/CreateSubscription.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.notifications.impl.ops; +package org.opendaylight.netconf.mdsal.notification.impl.ops; import com.google.common.base.Preconditions; import java.util.ArrayList; @@ -17,11 +17,11 @@ import org.opendaylight.netconf.api.NetconfSession; import org.opendaylight.netconf.api.xml.XmlElement; import org.opendaylight.netconf.api.xml.XmlNetconfConstants; import org.opendaylight.netconf.mapping.api.SessionAwareNetconfOperation; +import org.opendaylight.netconf.mdsal.notification.impl.NetconfNotificationManager; import org.opendaylight.netconf.notifications.NetconfNotification; import org.opendaylight.netconf.notifications.NetconfNotificationListener; import org.opendaylight.netconf.notifications.NetconfNotificationRegistry; import org.opendaylight.netconf.notifications.NotificationListenerRegistration; -import org.opendaylight.netconf.notifications.impl.NetconfNotificationManager; import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation; import org.opendaylight.netconf.util.messages.SubtreeFilter; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.CreateSubscriptionInput; diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/ops/NotificationsTransformUtil.java similarity index 98% rename from netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java rename to netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/ops/NotificationsTransformUtil.java index c9ceabda4a..24c669e868 100644 --- a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/ops/NotificationsTransformUtil.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.notifications.impl.ops; +package org.opendaylight.netconf.mdsal.notification.impl.ops; import com.google.common.base.Preconditions; import com.google.common.collect.Collections2; diff --git a/netconf/mdsal-netconf-notification/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-notification.xml b/netconf/mdsal-netconf-notification/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-notification.xml index 05ae2fb635..2effa17419 100755 --- a/netconf/mdsal-netconf-notification/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-notification.xml +++ b/netconf/mdsal-netconf-notification/src/main/resources/org/opendaylight/blueprint/mdsal-netconf-notification.xml @@ -20,7 +20,7 @@ @@ -41,21 +41,21 @@ diff --git a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducerTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducerTest.java similarity index 99% rename from netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducerTest.java rename to netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducerTest.java index c23d0b9911..7dceaf771c 100644 --- a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/CapabilityChangeNotificationProducerTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducerTest.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; diff --git a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/NetconfNotificationManagerTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationManagerTest.java similarity index 99% rename from netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/NetconfNotificationManagerTest.java rename to netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationManagerTest.java index 04afed6eef..a3daf2698b 100644 --- a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/NetconfNotificationManagerTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/NetconfNotificationManagerTest.java @@ -6,7 +6,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.notifications.impl; +package org.opendaylight.netconf.mdsal.notification.impl; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; diff --git a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriterTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/NotificationToMdsalWriterTest.java similarity index 98% rename from netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriterTest.java rename to netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/NotificationToMdsalWriterTest.java index 0aec779b2f..a3ff0f5e1f 100644 --- a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriterTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/NotificationToMdsalWriterTest.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyBoolean; diff --git a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListenerTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/OperationalDatastoreListenerTest.java similarity index 96% rename from netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListenerTest.java rename to netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/OperationalDatastoreListenerTest.java index bc0a2fa8ff..efd2a5c73b 100644 --- a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/OperationalDatastoreListenerTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/OperationalDatastoreListenerTest.java @@ -6,7 +6,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; diff --git a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducerTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/SessionNotificationProducerTest.java similarity index 98% rename from netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducerTest.java rename to netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/SessionNotificationProducerTest.java index f0a6317764..9cf18b9712 100644 --- a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/SessionNotificationProducerTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/SessionNotificationProducerTest.java @@ -5,7 +5,7 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.controller.config.yang.netconf.mdsal.notification; +package org.opendaylight.netconf.mdsal.notification.impl; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; diff --git a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscriptionTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/ops/CreateSubscriptionTest.java similarity index 97% rename from netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscriptionTest.java rename to netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/ops/CreateSubscriptionTest.java index db532a90d4..e24ef4f67d 100644 --- a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscriptionTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/ops/CreateSubscriptionTest.java @@ -6,7 +6,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.notifications.impl.ops; +package org.opendaylight.netconf.mdsal.notification.impl.ops; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; diff --git a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtilTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/ops/NotificationsTransformUtilTest.java similarity index 98% rename from netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtilTest.java rename to netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/ops/NotificationsTransformUtilTest.java index c48590496b..88becc0d4d 100644 --- a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtilTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/ops/NotificationsTransformUtilTest.java @@ -6,7 +6,7 @@ * and is available at http://www.eclipse.org/legal/epl-v10.html */ -package org.opendaylight.netconf.notifications.impl.ops; +package org.opendaylight.netconf.mdsal.notification.impl.ops; import static org.junit.Assert.assertTrue; diff --git a/netconf/netconf-artifacts/pom.xml b/netconf/netconf-artifacts/pom.xml index deb8dd1ca7..63726eee90 100644 --- a/netconf/netconf-artifacts/pom.xml +++ b/netconf/netconf-artifacts/pom.xml @@ -177,11 +177,6 @@ netconf-notifications-api ${project.version} - - ${project.groupId} - netconf-notifications-impl - ${project.version} - ${project.groupId} mdsal-netconf-notification diff --git a/netconf/netconf-impl/pom.xml b/netconf/netconf-impl/pom.xml index 2ebd6713b8..0341404401 100644 --- a/netconf/netconf-impl/pom.xml +++ b/netconf/netconf-impl/pom.xml @@ -56,10 +56,6 @@ ${project.groupId} netconf-notifications-api - - ${project.groupId} - netconf-notifications-impl - ${project.groupId} netconf-netty-util diff --git a/netconf/netconf-notifications-impl/pom.xml b/netconf/netconf-notifications-impl/pom.xml deleted file mode 100644 index f2c2eeb94a..0000000000 --- a/netconf/netconf-notifications-impl/pom.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - 4.0.0 - - org.opendaylight.netconf - netconf-parent - 1.6.0-SNAPSHOT - ../netconf-parent - - - org.opendaylight.netconf - netconf-notifications-impl - 1.6.0-SNAPSHOT - bundle - - - - ${project.groupId} - netconf-notifications-api - - - ${project.groupId} - netconf-util - - - org.opendaylight.mdsal - mdsal-binding-generator-impl - - - ${project.groupId} - netconf-api - - - org.opendaylight.mdsal - mdsal-binding-dom-codec - - - ${project.groupId} - ietf-netconf-notifications - - - com.google.guava - guava - - - org.osgi - org.osgi.core - - - org.slf4j - slf4j-api - - - org.xmlunit - xmlunit-legacy - - - org.opendaylight.yangtools - mockito-configuration - - - - - - - org.apache.felix - maven-bundle-plugin - - - org.opendaylight.netconf.notifications.impl.osgi.Activator - org.opendaylight.netconf.notifications.impl.* - - - - - - diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/Get.java b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/Get.java deleted file mode 100644 index e55f852a89..0000000000 --- a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/Get.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.netconf.notifications.impl.ops; - -import com.google.common.base.Preconditions; -import java.io.IOException; -import javax.xml.stream.XMLStreamException; -import javax.xml.transform.dom.DOMResult; -import org.opendaylight.netconf.api.DocumentedException; -import org.opendaylight.netconf.api.xml.XmlElement; -import org.opendaylight.netconf.api.xml.XmlNetconfConstants; -import org.opendaylight.netconf.mapping.api.HandlingPriority; -import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution; -import org.opendaylight.netconf.notifications.NetconfNotificationRegistry; -import org.opendaylight.netconf.util.NetconfUtil; -import org.opendaylight.netconf.util.mapping.AbstractNetconfOperation; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.Netconf; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.NetconfBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.Streams; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.model.api.SchemaPath; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Serialize the subtree for netconf notifications into the response of get rpc. - * This operation just adds its subtree into the common response of get rpc. - */ -public class Get extends AbstractNetconfOperation implements AutoCloseable { - - private static final String GET = "get"; - private static final InstanceIdentifier NETCONF_SUBTREE_INSTANCE_IDENTIFIER = - InstanceIdentifier.builder(Netconf.class).build(); - - private final NetconfNotificationRegistry notificationRegistry; - - public Get(final String netconfSessionIdForReporting, final NetconfNotificationRegistry notificationRegistry) { - super(netconfSessionIdForReporting); - Preconditions.checkNotNull(notificationRegistry); - this.notificationRegistry = notificationRegistry; - } - - @Override - protected String getOperationName() { - return GET; - } - - @Override - protected Element handle(final Document document, final XmlElement message, - final NetconfOperationChainedExecution subsequentOperation) { - throw new UnsupportedOperationException("Never gets called"); - } - - @Override - public Document handle(final Document requestMessage, final NetconfOperationChainedExecution subsequentOperation) - throws DocumentedException { - final Document partialResponse = subsequentOperation.execute(requestMessage); - final Streams availableStreams = notificationRegistry.getNotificationPublishers(); - if (!availableStreams.getStream().isEmpty()) { - serializeStreamsSubtree(partialResponse, availableStreams); - } - return partialResponse; - } - - static void serializeStreamsSubtree(final Document partialResponse, final Streams availableStreams) - throws DocumentedException { - final Netconf netconfSubtree = new NetconfBuilder().setStreams(availableStreams).build(); - final NormalizedNode normalized = toNormalized(netconfSubtree); - - final DOMResult result = new DOMResult(getPlaceholder(partialResponse)); - - try { - NetconfUtil.writeNormalizedNode(normalized, result, SchemaPath.ROOT, - NotificationsTransformUtil.NOTIFICATIONS_SCHEMA_CTX); - } catch (final XMLStreamException | IOException e) { - throw new IllegalStateException("Unable to serialize " + netconfSubtree, e); - } - } - - private static Element getPlaceholder(final Document innerResult) - throws DocumentedException { - final XmlElement rootElement = XmlElement.fromDomElementWithExpected(innerResult.getDocumentElement(), - XmlNetconfConstants.RPC_REPLY_KEY, XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0); - return rootElement.getOnlyChildElement(XmlNetconfConstants.DATA_KEY).getDomElement(); - } - - private static NormalizedNode toNormalized(final Netconf netconfSubtree) { - return NotificationsTransformUtil.CODEC_REGISTRY - .toNormalizedNode(NETCONF_SUBTREE_INSTANCE_IDENTIFIER, netconfSubtree).getValue(); - } - - @Override - protected HandlingPriority getHandlingPriority() { - return HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.increasePriority(2); - } - - @Override - public void close() { - - } -} diff --git a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/osgi/Activator.java b/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/osgi/Activator.java deleted file mode 100644 index 967bd08914..0000000000 --- a/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/osgi/Activator.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.netconf.notifications.impl.osgi; - -import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.Sets; -import java.util.Collections; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Set; -import org.opendaylight.netconf.api.capability.BasicCapability; -import org.opendaylight.netconf.api.capability.Capability; -import org.opendaylight.netconf.api.monitoring.CapabilityListener; -import org.opendaylight.netconf.api.util.NetconfConstants; -import org.opendaylight.netconf.mapping.api.NetconfOperation; -import org.opendaylight.netconf.mapping.api.NetconfOperationService; -import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory; -import org.opendaylight.netconf.notifications.NetconfNotification; -import org.opendaylight.netconf.notifications.NetconfNotificationCollector; -import org.opendaylight.netconf.notifications.impl.NetconfNotificationManager; -import org.opendaylight.netconf.notifications.impl.ops.CreateSubscription; -import org.opendaylight.netconf.notifications.impl.ops.Get; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Activator implements BundleActivator { - - private static final Logger LOG = LoggerFactory.getLogger(Activator.class); - - private ServiceRegistration netconfNotificationCollectorServiceRegistration; - private ServiceRegistration operationaServiceRegistration; - private NetconfNotificationManager netconfNotificationManager; - - @Override - public void start(final BundleContext context) { - netconfNotificationManager = new NetconfNotificationManager(); - // Add properties to autowire with netconf-impl instance for cfg subsystem - final Dictionary props = new Hashtable<>(); - props.put(NetconfConstants.SERVICE_NAME, NetconfConstants.NETCONF_NOTIFICATION); - netconfNotificationCollectorServiceRegistration = context.registerService(NetconfNotificationCollector.class, - netconfNotificationManager, new Hashtable<>()); - - final NetconfOperationServiceFactory netconfOperationServiceFactory = new NetconfOperationServiceFactory() { - - private final Set capabilities = - Collections.singleton(new BasicCapability(NetconfNotification.NOTIFICATION_NAMESPACE)); - - @Override - public Set getCapabilities() { - return capabilities; - } - - @Override - public AutoCloseable registerCapabilityListener(final CapabilityListener listener) { - listener.onCapabilitiesChanged(capabilities, Collections.emptySet()); - return () -> listener.onCapabilitiesChanged(Collections.emptySet(), capabilities); - } - - @Override - public NetconfOperationService createService(final String netconfSessionIdForReporting) { - return new NetconfOperationService() { - - private final CreateSubscription createSubscription = - new CreateSubscription(netconfSessionIdForReporting, netconfNotificationManager); - - @Override - public Set getNetconfOperations() { - return Sets.newHashSet( - new Get(netconfSessionIdForReporting, netconfNotificationManager), - createSubscription); - } - - @Override - public void close() { - createSubscription.close(); - } - }; - } - }; - - final Dictionary properties = new Hashtable<>(); - properties.put(NetconfConstants.SERVICE_NAME, NetconfConstants.NETCONF_MONITORING); - operationaServiceRegistration = context.registerService(NetconfOperationServiceFactory.class, - netconfOperationServiceFactory, properties); - } - - @Override - public void stop(final BundleContext context) { - if (netconfNotificationCollectorServiceRegistration != null) { - netconfNotificationCollectorServiceRegistration.unregister(); - netconfNotificationCollectorServiceRegistration = null; - } - if (netconfNotificationManager != null) { - netconfNotificationManager.close(); - } - if (operationaServiceRegistration != null) { - operationaServiceRegistration.unregister(); - operationaServiceRegistration = null; - } - } - - @VisibleForTesting - NetconfNotificationManager getNetconfNotificationManager() { - return netconfNotificationManager; - } -} diff --git a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/GetTest.java b/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/GetTest.java deleted file mode 100644 index 0a7aa6d7e5..0000000000 --- a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/ops/GetTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.netconf.notifications.impl.ops; - -import com.google.common.collect.Lists; -import java.io.IOException; -import org.junit.Test; -import org.opendaylight.netconf.api.xml.XmlUtil; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.Streams; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.StreamsBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamBuilder; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -public class GetTest { - - @Test - public void testSerializeStreamsSubtree() throws Exception { - final StreamsBuilder streamsBuilder = new StreamsBuilder(); - final StreamBuilder streamBuilder = new StreamBuilder(); - final StreamNameType base = new StreamNameType("base"); - streamBuilder.setName(base); - streamBuilder.withKey(new StreamKey(base)); - streamBuilder.setDescription("description"); - streamBuilder.setReplaySupport(false); - streamsBuilder.setStream(Lists.newArrayList(streamBuilder.build())); - final Streams streams = streamsBuilder.build(); - - final Document response = getBlankResponse(); - Get.serializeStreamsSubtree(response, streams); - NotificationsTransformUtilTest.compareXml(XmlUtil.toString(response), - "\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "base\n" - + "description\n" - + "false\n" - + "\n" - + "\n" - + "\n" - + "\n" - + "\n"); - } - - private static Document getBlankResponse() throws IOException, SAXException { - - return XmlUtil.readXmlToDocument("\n" - + "\n" - + "\n" - + ""); - } -} diff --git a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/osgi/ActivatorTest.java b/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/osgi/ActivatorTest.java deleted file mode 100644 index ddacdd957c..0000000000 --- a/netconf/netconf-notifications-impl/src/test/java/org/opendaylight/netconf/notifications/impl/osgi/ActivatorTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.netconf.notifications.impl.osgi; - -import static org.junit.Assert.assertEquals; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; - -import java.util.Collections; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Set; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.opendaylight.netconf.api.capability.BasicCapability; -import org.opendaylight.netconf.api.capability.Capability; -import org.opendaylight.netconf.api.monitoring.CapabilityListener; -import org.opendaylight.netconf.api.util.NetconfConstants; -import org.opendaylight.netconf.mapping.api.NetconfOperation; -import org.opendaylight.netconf.mapping.api.NetconfOperationService; -import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory; -import org.opendaylight.netconf.notifications.NetconfNotification; -import org.opendaylight.netconf.notifications.NetconfNotificationCollector; -import org.opendaylight.netconf.notifications.impl.NetconfNotificationManager; -import org.opendaylight.netconf.notifications.impl.ops.CreateSubscription; -import org.opendaylight.netconf.notifications.impl.ops.Get; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -public class ActivatorTest { - - @Test - public void testActivator() throws Exception { - final Activator activator = new Activator(); - final BundleContext context = mock(BundleContext.class); - - - final ServiceRegistration netconfNotificationCollectorServiceRegistration = mock(ServiceRegistration.class); - final ServiceRegistration operationaServiceRegistration = mock(ServiceRegistration.class); - - // test registering services - doReturn(netconfNotificationCollectorServiceRegistration).when(context) - .registerService(eq(NetconfNotificationCollector.class), any(NetconfNotificationManager.class), any()); - doReturn(operationaServiceRegistration).when(context).registerService(eq(NetconfOperationServiceFactory.class), - any(NetconfOperationServiceFactory.class), any()); - - activator.start(context); - - verify(context, times(1)).registerService(eq(NetconfNotificationCollector.class), - any(NetconfNotificationManager.class), eq(new Hashtable<>())); - - final ArgumentCaptor serviceFactoryArgumentCaptor = - ArgumentCaptor.forClass(NetconfOperationServiceFactory.class); - - final Dictionary properties = new Hashtable<>(); - properties.put(NetconfConstants.SERVICE_NAME, NetconfConstants.NETCONF_MONITORING); - - verify(context, times(1)).registerService(eq(NetconfOperationServiceFactory.class), - serviceFactoryArgumentCaptor.capture(), eq(properties)); - - // test service factory argument requisites - final NetconfOperationServiceFactory serviceFactory = serviceFactoryArgumentCaptor.getValue(); - - final Set capabilities = - Collections.singleton(new BasicCapability(NetconfNotification.NOTIFICATION_NAMESPACE)); - - assertEquals(capabilities.iterator().next() - .getCapabilityUri(), serviceFactory.getCapabilities().iterator().next().getCapabilityUri()); - assertEquals(capabilities.iterator().next() - .getCapabilitySchema(), serviceFactory.getCapabilities().iterator().next().getCapabilitySchema()); - assertEquals(capabilities.iterator().next() - .getModuleNamespace(), serviceFactory.getCapabilities().iterator().next().getModuleNamespace()); - assertEquals(capabilities.iterator().next() - .getModuleName(), serviceFactory.getCapabilities().iterator().next().getModuleName()); - - final CapabilityListener listener = mock(CapabilityListener.class); - - doNothing().when(listener).onCapabilitiesChanged(any(), any()); - - serviceFactory.registerCapabilityListener(listener); - - verify(listener).onCapabilitiesChanged(serviceFactory.getCapabilities(), Collections.emptySet()); - - final NetconfOperationService netconfOperationService = serviceFactory.createService("id"); - final Set netconfOperations = netconfOperationService.getNetconfOperations(); - - final CreateSubscription createSubscription = - new CreateSubscription("id", activator.getNetconfNotificationManager()); - - netconfOperations.forEach( - operation -> { - if (operation instanceof CreateSubscription) { - assertEquals(createSubscription.toString(), operation.toString()); - } - if (operation instanceof Get) { - assertEquals("id", ((Get) operation).getNetconfSessionIdForReporting()); - } - } - ); - - // test unregister after stop - doNothing().when(netconfNotificationCollectorServiceRegistration).unregister(); - doNothing().when(operationaServiceRegistration).unregister(); - - activator.stop(context); - - verify(netconfNotificationCollectorServiceRegistration, times(1)).unregister(); - verify(operationaServiceRegistration, times(1)).unregister(); - - } - - -} diff --git a/netconf/pom.xml b/netconf/pom.xml index c534a49b8d..d4e70a743e 100644 --- a/netconf/pom.xml +++ b/netconf/pom.xml @@ -46,7 +46,6 @@ netconf-client netconf-auth aaa-authn-odl-plugin - netconf-notifications-impl netconf-notifications-api netconf-topology netconf-topology-singleton