summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Mitsura <oleg.mitsura@amdocs.com>2019-11-05 15:37:15 -0500
committerOleg Mitsura <omitsura@gmail.com>2019-11-05 21:28:07 +0000
commit94f1bfcc93e46dc08f806e9a3b495abc9d9bf53d (patch)
treef5ae78e6d0888902ad4ad2a03f23a90d9dfce1e0
parente967b59012d3aec0a5ad01d1ad508fc1e0a61a5f (diff)
netconf retry disconnect()
Issue-ID: CCSDK-1908 Signed-off-by: Oleg Mitsura <oleg.mitsura@amdocs.com> Change-Id: I90ca822c042ec84fda717a152c4f699bacdd87ad
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt12
1 files changed, 10 insertions, 2 deletions
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
index a0f653591..69b9d70bf 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt
@@ -66,8 +66,15 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
}
override fun disconnect() {
- if (rpcService.closeSession(false).status.equals(
- RpcStatus.FAILURE, true)) {
+ var retryNum = 3
+ while(rpcService.closeSession(false).status
+ .equals(RpcStatus.FAILURE, true) &&retryNum>0) {
+ log.error("disconnect: graceful disconnect failed, attempt $retryNum")
+ retryNum--;
+ }
+ //if we can't close the session, try to force terminate.
+ if(retryNum == 0) {
+ log.error("disconnect: trying to force-terminate the session.")
rpcService.closeSession(true)
}
try {
@@ -276,6 +283,7 @@ class NetconfSessionImpl(private val deviceInfo: DeviceInfo, private val rpcServ
*/
@Throws(IOException::class)
private fun close() {
+ log.debug("close was called.")
session.close()
// Closes the socket which should interrupt the streamHandler
channel.close()