X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-topology%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Ftopology%2Fimpl%2FNetconfTopologyImpl.java;h=86ce1f9c02865e4aa3ecb26ca57ea9dba257735f;hb=a0833fb27c69d919a4420c6ecbd11a3b2a1119cb;hp=a17369f144accdd5b3e9f89ead6910a7d0162d8a;hpb=6dff9c9b56e47d0f11c0fc7972acc1c3d021cf16;p=netconf.git diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java index a17369f144..86ce1f9c02 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java @@ -5,11 +5,9 @@ * 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.impl; import com.google.common.util.concurrent.FutureCallback; -import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.MoreExecutors; import io.netty.util.concurrent.EventExecutor; import java.util.Collection; @@ -17,15 +15,17 @@ import javax.annotation.Nonnull; import org.opendaylight.aaa.encrypt.AAAEncryptionService; import org.opendaylight.controller.config.threadpool.ScheduledThreadPool; import org.opendaylight.controller.config.threadpool.ThreadPool; -import org.opendaylight.controller.md.sal.binding.api.DataBroker; -import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; -import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; -import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier; -import org.opendaylight.controller.md.sal.binding.api.DataTreeModification; -import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; +import org.opendaylight.mdsal.binding.api.DataBroker; +import org.opendaylight.mdsal.binding.api.DataObjectModification; +import org.opendaylight.mdsal.binding.api.DataTreeChangeListener; +import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; +import org.opendaylight.mdsal.binding.api.DataTreeModification; +import org.opendaylight.mdsal.binding.api.WriteTransaction; +import org.opendaylight.mdsal.common.api.CommitInfo; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.mdsal.dom.api.DOMMountPointService; import org.opendaylight.netconf.client.NetconfClientDispatcher; +import org.opendaylight.netconf.sal.connect.api.DeviceActionFactory; import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler; import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences; import org.opendaylight.netconf.sal.connect.netconf.sal.NetconfDeviceSalFacade; @@ -52,17 +52,28 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology private ListenerRegistration datastoreListenerRegistration = null; public NetconfTopologyImpl(final String topologyId, final NetconfClientDispatcher clientDispatcher, - final EventExecutor eventExecutor, final ScheduledThreadPool keepaliveExecutor, - final ThreadPool processingExecutor, - final SchemaRepositoryProvider schemaRepositoryProvider, - final DataBroker dataBroker, final DOMMountPointService mountPointService, - final AAAEncryptionService encryptionService) { + final EventExecutor eventExecutor, final ScheduledThreadPool keepaliveExecutor, + final ThreadPool processingExecutor, + final SchemaRepositoryProvider schemaRepositoryProvider, + final DataBroker dataBroker, final DOMMountPointService mountPointService, + final AAAEncryptionService encryptionService) { + this(topologyId, clientDispatcher, eventExecutor, keepaliveExecutor, processingExecutor, + schemaRepositoryProvider, dataBroker, mountPointService, encryptionService, null); + } + + public NetconfTopologyImpl(final String topologyId, final NetconfClientDispatcher clientDispatcher, + final EventExecutor eventExecutor, final ScheduledThreadPool keepaliveExecutor, + final ThreadPool processingExecutor, + final SchemaRepositoryProvider schemaRepositoryProvider, + final DataBroker dataBroker, final DOMMountPointService mountPointService, + final AAAEncryptionService encryptionService, + final DeviceActionFactory deviceActionFactory) { super(topologyId, clientDispatcher, eventExecutor, keepaliveExecutor, processingExecutor, - schemaRepositoryProvider, dataBroker, mountPointService, encryptionService); + schemaRepositoryProvider, dataBroker, mountPointService, encryptionService, deviceActionFactory); } @Override - public void close() throws Exception { + public void close() { // close all existing connectors, delete whole topology in datastore? for (final NetconfConnectorDTO connectorDTO : activeConnectors.values()) { connectorDTO.close(); @@ -77,7 +88,7 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology @Override protected RemoteDeviceHandler createSalFacade(final RemoteDeviceId id) { - return new NetconfDeviceSalFacade(id, mountPointService, dataBroker); + return new NetconfDeviceSalFacade(id, mountPointService, dataBroker, topologyId); } /** @@ -87,23 +98,22 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology final WriteTransaction wtx = dataBroker.newWriteOnlyTransaction(); initTopology(wtx, LogicalDatastoreType.CONFIGURATION); initTopology(wtx, LogicalDatastoreType.OPERATIONAL); - Futures.addCallback(wtx.submit(), new FutureCallback() { + wtx.commit().addCallback(new FutureCallback() { @Override - public void onSuccess(final Void result) { + public void onSuccess(final CommitInfo result) { LOG.debug("topology initialization successful"); } @Override public void onFailure(final Throwable throwable) { - LOG.error("Unable to initialize netconf-topology, {}", throwable); + LOG.error("Unable to initialize netconf-topology", throwable); } }, MoreExecutors.directExecutor()); LOG.debug("Registering datastore listener"); - datastoreListenerRegistration = - dataBroker.registerDataTreeChangeListener( - new DataTreeIdentifier<>(LogicalDatastoreType.CONFIGURATION, - TopologyUtil.createTopologyListPath(topologyId).child(Node.class)), this); + datastoreListenerRegistration = dataBroker.registerDataTreeChangeListener(DataTreeIdentifier.create( + LogicalDatastoreType.CONFIGURATION, TopologyUtil.createTopologyListPath(topologyId).child(Node.class)), + this); } @Override