Close device handler when it fails to connect 44/108844/1
authorIvan Hrasko <ivan.hrasko@pantheon.tech>
Fri, 3 Nov 2023 12:48:13 +0000 (13:48 +0100)
committerPeter Suna <peter.suna@pantheon.tech>
Fri, 3 Nov 2023 15:55:58 +0000 (16:55 +0100)
Close RemoteDeviceHandler instance and thus delete operational data
for device from data-store when we failed to establish connection,
for example because of wrong password format used.

JIRA: NETCONF-1114
Change-Id: I9db06595a3867ec04ad30aa76b7a5b21c75b7a8f
(cherry picked from commit 204069e28ae7a784955f69d272777bbe367b163c)
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/spi/AbstractNetconfTopology.java

index 5a9df3f45b21c1cca016f403ebbd1520228401eb..660a650093ea3c9c9d921d3b680f78d409eaff7a 100644 (file)
@@ -177,6 +177,7 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
             // This is a workaround for NETCONF-1114 where the encrypted password's lexical structure is not enforced
             // in the datastore and it ends up surfacing when we decrypt the password.
             LOG.warn("RemoteDevice{{}} failed to connect", nodeId, e);
+            deviceCommunicatorDTO.close();
             return Futures.immediateFailedFuture(e);
         }
         final ListenableFuture<NetconfDeviceCapabilities> future =