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=41e4ef62fd98a51e34934fb707e2e0cf9e8714ed;hb=e7abbe8b97f494030992ea8f9cc81a982695852b;hp=00da8fd10e824f76b1a6f27fa11f939388ad22a4;hpb=8f8b49c1f6a113e88672f935c9cb497944af39f8;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 00da8fd10e..41e4ef62fd 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 @@ -13,6 +13,7 @@ import com.google.common.util.concurrent.Futures; import io.netty.util.concurrent.EventExecutor; import java.util.Collection; 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; @@ -23,8 +24,6 @@ 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.controller.sal.binding.api.BindingAwareBroker; -import org.opendaylight.controller.sal.core.api.Broker; import org.opendaylight.netconf.client.NetconfClientDispatcher; import org.opendaylight.netconf.sal.connect.api.RemoteDeviceHandler; import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences; @@ -44,26 +43,27 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class NetconfTopologyImpl extends AbstractNetconfTopology implements DataTreeChangeListener, AutoCloseable { +public class NetconfTopologyImpl extends AbstractNetconfTopology + implements DataTreeChangeListener, AutoCloseable { private static final Logger LOG = LoggerFactory.getLogger(NetconfTopologyImpl.class); private ListenerRegistration datastoreListenerRegistration = null; public NetconfTopologyImpl(final String topologyId, final NetconfClientDispatcher clientDispatcher, - final BindingAwareBroker bindingAwareBroker, final Broker domBroker, final EventExecutor eventExecutor, final ScheduledThreadPool keepaliveExecutor, - final ThreadPool processingExecutor, final SchemaRepositoryProvider schemaRepositoryProvider, - final DataBroker dataBroker, final DOMMountPointService mountPointService) { - super(topologyId, clientDispatcher, - bindingAwareBroker, domBroker, eventExecutor, - keepaliveExecutor, processingExecutor, schemaRepositoryProvider, dataBroker, mountPointService); + final ThreadPool processingExecutor, + final SchemaRepositoryProvider schemaRepositoryProvider, + final DataBroker dataBroker, final DOMMountPointService mountPointService, + final AAAEncryptionService encryptionService) { + super(topologyId, clientDispatcher, eventExecutor, keepaliveExecutor, processingExecutor, + schemaRepositoryProvider, dataBroker, mountPointService, encryptionService); } @Override public void close() throws Exception { // close all existing connectors, delete whole topology in datastore? - for (NetconfConnectorDTO connectorDTO : activeConnectors.values()) { + for (final NetconfConnectorDTO connectorDTO : activeConnectors.values()) { connectorDTO.close(); } activeConnectors.clear(); @@ -75,12 +75,12 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology implements Data } @Override - protected RemoteDeviceHandler createSalFacade(RemoteDeviceId id, Broker domBroker, BindingAwareBroker bindingBroker) { - return new NetconfDeviceSalFacade(id, domBroker, bindingAwareBroker); + protected RemoteDeviceHandler createSalFacade(final RemoteDeviceId id) { + return new NetconfDeviceSalFacade(id, mountPointService, dataBroker); } /** - * Invoke by blueprint + * Invoked by blueprint. */ public void init() { final WriteTransaction wtx = dataBroker.newWriteOnlyTransaction(); @@ -88,13 +88,13 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology implements Data initTopology(wtx, LogicalDatastoreType.OPERATIONAL); Futures.addCallback(wtx.submit(), new FutureCallback() { @Override - public void onSuccess(Void result) { + public void onSuccess(final Void result) { LOG.debug("topology initialization successful"); } @Override - public void onFailure(Throwable t) { - LOG.error("Unable to initialize netconf-topology, {}", t); + public void onFailure(final Throwable throwable) { + LOG.error("Unable to initialize netconf-topology, {}", throwable); } }); @@ -108,8 +108,8 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology implements Data } @Override - public void onDataTreeChanged(@Nonnull Collection> collection) { - for (DataTreeModification change : collection) { + public void onDataTreeChanged(@Nonnull final Collection> collection) { + for (final DataTreeModification change : collection) { final DataObjectModification rootNode = change.getRootNode(); switch (rootNode.getModificationType()) { case SUBTREE_MODIFIED: @@ -120,7 +120,8 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology implements Data case WRITE: LOG.debug("Config for node {} created", TopologyUtil.getNodeId(rootNode.getIdentifier())); if (activeConnectors.containsKey(TopologyUtil.getNodeId(rootNode.getIdentifier()))) { - LOG.warn("RemoteDevice{{}} was already configured, reconfiguring..", TopologyUtil.getNodeId(rootNode.getIdentifier())); + LOG.warn("RemoteDevice{{}} was already configured, reconfiguring..", + TopologyUtil.getNodeId(rootNode.getIdentifier())); disconnectNode(TopologyUtil.getNodeId(rootNode.getIdentifier())); } connectNode(TopologyUtil.getNodeId(rootNode.getIdentifier()), rootNode.getDataAfter()); @@ -129,16 +130,20 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology implements Data LOG.debug("Config for node {} deleted", TopologyUtil.getNodeId(rootNode.getIdentifier())); disconnectNode(TopologyUtil.getNodeId(rootNode.getIdentifier())); break; + default: + LOG.debug("Unsupported modification type: {}.", rootNode.getModificationType()); } } } private void initTopology(final WriteTransaction wtx, final LogicalDatastoreType datastoreType) { final NetworkTopology networkTopology = new NetworkTopologyBuilder().build(); - final InstanceIdentifier networkTopologyId = InstanceIdentifier.builder(NetworkTopology.class).build(); + final InstanceIdentifier networkTopologyId = + InstanceIdentifier.builder(NetworkTopology.class).build(); wtx.merge(datastoreType, networkTopologyId, networkTopology); final Topology topology = new TopologyBuilder().setTopologyId(new TopologyId(topologyId)).build(); - wtx.merge(datastoreType, networkTopologyId.child(Topology.class, new TopologyKey(new TopologyId(topologyId))), topology); + wtx.merge(datastoreType, + networkTopologyId.child(Topology.class, new TopologyKey(new TopologyId(topologyId))), topology); } }