X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-topology-singleton%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Ftopology%2Fsingleton%2Fimpl%2FSlaveSalFacade.java;h=5c2b6bd57074d757bee8555041e4f2a373245f63;hb=f7a7694b1604dfcd231c70506b468bdfad34c21d;hp=d2d8c5f5a4a9ec6e4773079913af561d123e6ef6;hpb=e60546d08fbc89e4780406c4123ba25c3e7698ef;p=netconf.git diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/SlaveSalFacade.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/SlaveSalFacade.java index d2d8c5f5a4..5c2b6bd570 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/SlaveSalFacade.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/SlaveSalFacade.java @@ -5,66 +5,59 @@ * 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.topology.singleton.impl; import akka.actor.ActorRef; import akka.actor.ActorSystem; import akka.util.Timeout; import java.util.concurrent.atomic.AtomicBoolean; -import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; -import org.opendaylight.controller.md.sal.dom.api.DOMRpcService; -import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceNotificationService; -import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceSalProvider; +import org.opendaylight.mdsal.dom.api.DOMMountPointService; +import org.opendaylight.netconf.sal.connect.api.RemoteDeviceServices; +import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceMount; import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SlaveSalFacade { - private static final Logger LOG = LoggerFactory.getLogger(SlaveSalFacade.class); + private final AtomicBoolean registered = new AtomicBoolean(false); private final RemoteDeviceId id; - private final NetconfDeviceSalProvider salProvider; + private final NetconfDeviceMount mount; private final ActorSystem actorSystem; private final Timeout actorResponseWaitTime; - private final AtomicBoolean registered = new AtomicBoolean(false); public SlaveSalFacade(final RemoteDeviceId id, final ActorSystem actorSystem, final Timeout actorResponseWaitTime, final DOMMountPointService mountPointService) { this.id = id; - this.salProvider = new NetconfDeviceSalProvider(id, mountPointService); this.actorSystem = actorSystem; this.actorResponseWaitTime = actorResponseWaitTime; + mount = new NetconfDeviceMount(mountPointService, id); } - public void registerSlaveMountPoint(final SchemaContext remoteSchemaContext, final DOMRpcService deviceRpc, - final ActorRef masterActorRef) { + public void registerSlaveMountPoint(final EffectiveModelContext remoteSchemaContext, final ActorRef masterActorRef, + final RemoteDeviceServices services) { if (!registered.compareAndSet(false, true)) { + LOG.info("Mount point {} already registered, skipping registation", id); return; } - final NetconfDeviceNotificationService notificationService = new NetconfDeviceNotificationService(); - - final ProxyDOMDataBroker netconfDeviceDataBroker = - new ProxyDOMDataBroker(id, masterActorRef, actorSystem.dispatcher(), actorResponseWaitTime); - - salProvider.getMountInstance().onTopologyDeviceConnected(remoteSchemaContext, netconfDeviceDataBroker, - deviceRpc, notificationService); + final var netconfDeviceDataBroker = new ProxyDOMDataBroker(id, masterActorRef, + actorSystem.dispatcher(), actorResponseWaitTime); + final var proxyNetconfService = new ProxyNetconfDataTreeService(id, masterActorRef, + actorSystem.dispatcher(), actorResponseWaitTime); + mount.onDeviceConnected(remoteSchemaContext, services, netconfDeviceDataBroker, proxyNetconfService); LOG.info("{}: Slave mount point registered.", id); } public void close() { - if (!registered.compareAndSet(true, false)) { - return; + if (registered.compareAndSet(true, false)) { + mount.onDeviceDisconnected(); + LOG.info("{}: Slave mount point unregistered.", id); } - - salProvider.getMountInstance().onTopologyDeviceDisconnected(); - - LOG.info("{}: Slave mount point unregistered.", id); } }