X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-netconf-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fconnect%2Fnetconf%2Fsal%2FNetconfDeviceSalProvider.java;h=3246f519042802cedd396708ed17c0db69c79301;hp=dfae165d30c3fba4059b0c4c4aa5fb9308b825f6;hb=8ce853c0627e829d40fe18e550bc807efbcbafee;hpb=10d39810f724474b84d0e6d3f5676a5154593ca2 diff --git a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java index dfae165d30..3246f51904 100644 --- a/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java +++ b/opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/sal/NetconfDeviceSalProvider.java @@ -10,20 +10,19 @@ package org.opendaylight.controller.sal.connect.netconf.sal; import com.google.common.base.Preconditions; import java.util.Collection; import java.util.Collections; -import java.util.concurrent.ExecutorService; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint; import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; +import org.opendaylight.controller.md.sal.dom.api.DOMNotificationService; +import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; import org.opendaylight.controller.sal.binding.api.BindingAwareProvider; import org.opendaylight.controller.sal.connect.util.RemoteDeviceId; import org.opendaylight.controller.sal.core.api.Broker; import org.opendaylight.controller.sal.core.api.Provider; -import org.opendaylight.controller.sal.core.api.RpcProvisionRegistry; -import org.opendaylight.controller.sal.core.api.notify.NotificationPublishService; import org.opendaylight.yangtools.concepts.ObjectRegistration; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -33,15 +32,13 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding private static final Logger logger = LoggerFactory.getLogger(NetconfDeviceSalProvider.class); private final RemoteDeviceId id; - private final ExecutorService executor; private volatile NetconfDeviceDatastoreAdapter datastoreAdapter; private MountInstance mountInstance; private volatile NetconfDeviceTopologyAdapter topologyDatastoreAdapter; - public NetconfDeviceSalProvider(final RemoteDeviceId deviceId, final ExecutorService executor) { + public NetconfDeviceSalProvider(final RemoteDeviceId deviceId) { this.id = deviceId; - this.executor = executor; } public MountInstance getMountInstance() { @@ -91,6 +88,8 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding mountInstance.close(); datastoreAdapter.close(); datastoreAdapter = null; + topologyDatastoreAdapter.close(); + topologyDatastoreAdapter = null; } static final class MountInstance implements AutoCloseable { @@ -98,7 +97,7 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding private DOMMountPointService mountService; private final RemoteDeviceId id; private ObjectRegistration registration; - private NotificationPublishService notificationSerivce; + private NetconfDeviceNotificationService notificationService; private ObjectRegistration topologyRegistration; @@ -109,8 +108,8 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding @Deprecated synchronized void onDeviceConnected(final SchemaContext initialCtx, - final DOMDataBroker broker, final RpcProvisionRegistry rpc, - final NotificationPublishService notificationSerivce) { + final DOMDataBroker broker, final DOMRpcService rpc, + final NetconfDeviceNotificationService notificationService) { Preconditions.checkNotNull(mountService, "Closed"); Preconditions.checkState(registration == null, "Already initialized"); @@ -119,9 +118,9 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding mountBuilder.addInitialSchemaContext(initialCtx); mountBuilder.addService(DOMDataBroker.class, broker); - mountBuilder.addService(RpcProvisionRegistry.class, rpc); - this.notificationSerivce = notificationSerivce; - mountBuilder.addService(NotificationPublishService.class, notificationSerivce); + mountBuilder.addService(DOMRpcService.class, rpc); + mountBuilder.addService(DOMNotificationService.class, notificationService); + this.notificationService = notificationService; registration = mountBuilder.register(); } @@ -143,8 +142,8 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding } synchronized void onTopologyDeviceConnected(final SchemaContext initialCtx, - final DOMDataBroker broker, final RpcProvisionRegistry rpc, - final NotificationPublishService notificationSerivce) { + final DOMDataBroker broker, final DOMRpcService rpc, + final NetconfDeviceNotificationService notificationService) { Preconditions.checkNotNull(mountService, "Closed"); Preconditions.checkState(topologyRegistration == null, "Already initialized"); @@ -153,9 +152,8 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding mountBuilder.addInitialSchemaContext(initialCtx); mountBuilder.addService(DOMDataBroker.class, broker); - mountBuilder.addService(RpcProvisionRegistry.class, rpc); - this.notificationSerivce = notificationSerivce; - mountBuilder.addService(NotificationPublishService.class, notificationSerivce); + mountBuilder.addService(DOMRpcService.class, rpc); + mountBuilder.addService(DOMNotificationService.class, notificationService); topologyRegistration = mountBuilder.register(); } @@ -184,9 +182,9 @@ final class NetconfDeviceSalProvider implements AutoCloseable, Provider, Binding mountService = null; } - public synchronized void publish(final CompositeNode domNotification) { - Preconditions.checkNotNull(notificationSerivce, "Device not set up yet, cannot handle notification {}", domNotification); - notificationSerivce.publish(domNotification); + public synchronized void publish(final ContainerNode domNotification) { + Preconditions.checkNotNull(notificationService, "Device not set up yet, cannot handle notification {}", domNotification); + notificationService.publishNotification(domNotification); } }