diff options
Diffstat (limited to 'ms/blueprintsprocessor/functions')
-rw-r--r-- | ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/core/NetconfSessionImpl.kt | 12 |
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 83622d41e..6be93179f 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, retrying $retryNum times...") + 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 { @@ -277,6 +284,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() |