use of org.opendaylight.netconf.sal.connect.netconf.listener.NetconfDeviceCommunicator in project netconf by opendaylight.
the class RemoteDeviceConnectorImpl method startRemoteDeviceConnection.
@Override
public void startRemoteDeviceConnection(final RemoteDeviceHandler<NetconfSessionPreferences> deviceHandler) {
final NetconfNode netconfNode = netconfTopologyDeviceSetup.getNode().augmentation(NetconfNode.class);
final NodeId nodeId = netconfTopologyDeviceSetup.getNode().getNodeId();
requireNonNull(netconfNode.getHost());
requireNonNull(netconfNode.getPort());
this.deviceCommunicatorDTO = createDeviceCommunicator(nodeId, netconfNode, deviceHandler);
final NetconfDeviceCommunicator deviceCommunicator = deviceCommunicatorDTO.getCommunicator();
final NetconfClientSessionListener netconfClientSessionListener = deviceCommunicatorDTO.getSessionListener();
final NetconfReconnectingClientConfiguration clientConfig = getClientConfig(netconfClientSessionListener, netconfNode);
final ListenableFuture<NetconfDeviceCapabilities> future = deviceCommunicator.initializeRemoteConnection(netconfTopologyDeviceSetup.getNetconfClientDispatcher(), clientConfig);
Futures.addCallback(future, new FutureCallback<NetconfDeviceCapabilities>() {
@Override
public void onSuccess(final NetconfDeviceCapabilities result) {
LOG.debug("{}: Connector started successfully", remoteDeviceId);
}
@Override
public void onFailure(final Throwable throwable) {
LOG.error("{}: Connector failed", remoteDeviceId, throwable);
}
}, MoreExecutors.directExecutor());
}
Aggregations