Clean up NetconfTopology methods
[netconf.git] / netconf / netconf-topology / src / main / java / org / opendaylight / netconf / topology / spi / AbstractNetconfTopology.java
index 7c7a2d7baa9f6a01e8ae215c5a3e200a330e2be9..9c9d722196146154b3c39dc505c1d8fb048f914d 100644 (file)
@@ -47,7 +47,6 @@ import org.opendaylight.netconf.sal.connect.netconf.NetconfDevice.SchemaResource
 import org.opendaylight.netconf.sal.connect.netconf.NetconfDeviceBuilder;
 import org.opendaylight.netconf.sal.connect.netconf.SchemalessNetconfDevice;
 import org.opendaylight.netconf.sal.connect.netconf.auth.DatastoreBackedPublicKeyAuth;
-import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCapabilities;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator;
 import org.opendaylight.netconf.sal.connect.netconf.listener.NetconfSessionPreferences;
 import org.opendaylight.netconf.sal.connect.netconf.listener.UserPreferences;
@@ -74,6 +73,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev15
 import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev150114.netconf.schema.storage.YangLibrary;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yangtools.yang.common.Empty;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
 import org.opendaylight.yangtools.yang.model.repo.spi.PotentialSchemaSource;
@@ -125,7 +125,7 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
     }
 
     @Override
-    public ListenableFuture<NetconfDeviceCapabilities> connectNode(final NodeId nodeId, final Node configNode) {
+    public ListenableFuture<Empty> connectNode(final NodeId nodeId, final Node configNode) {
         LOG.info("Connecting RemoteDevice{{}} , with config {}", nodeId, hideCredentials(configNode));
         return setupConnection(nodeId, configNode);
     }
@@ -145,7 +145,7 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
     }
 
     @Override
-    public ListenableFuture<Void> disconnectNode(final NodeId nodeId) {
+    public ListenableFuture<Empty> disconnectNode(final NodeId nodeId) {
         LOG.debug("Disconnecting RemoteDevice{{}}", nodeId.getValue());
 
         final NetconfConnectorDTO connectorDTO = activeConnectors.remove(nodeId);
@@ -155,11 +155,10 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
         }
 
         connectorDTO.close();
-        return Futures.immediateFuture(null);
+        return Futures.immediateFuture(Empty.value());
     }
 
-    protected ListenableFuture<NetconfDeviceCapabilities> setupConnection(final NodeId nodeId,
-                                                                          final Node configNode) {
+    protected ListenableFuture<Empty> setupConnection(final NodeId nodeId, final Node configNode) {
         final NetconfNode netconfNode = configNode.augmentation(NetconfNode.class);
         final NetconfNodeAugmentedOptional nodeOptional = configNode.augmentation(NetconfNodeAugmentedOptional.class);
 
@@ -171,14 +170,14 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
         final NetconfClientSessionListener netconfClientSessionListener = deviceCommunicatorDTO.getSessionListener();
         final NetconfReconnectingClientConfiguration clientConfig =
                 getClientConfig(netconfClientSessionListener, netconfNode, nodeId);
-        final ListenableFuture<NetconfDeviceCapabilities> future =
+        final ListenableFuture<Empty> future =
                 deviceCommunicator.initializeRemoteConnection(clientDispatcher, clientConfig);
 
         activeConnectors.put(nodeId, deviceCommunicatorDTO);
 
-        Futures.addCallback(future, new FutureCallback<NetconfDeviceCapabilities>() {
+        Futures.addCallback(future, new FutureCallback<>() {
             @Override
-            public void onSuccess(final NetconfDeviceCapabilities result) {
+            public void onSuccess(final Empty result) {
                 LOG.debug("Connector for {} started succesfully", nodeId.getValue());
             }