diff options
Diffstat (limited to 'ms/blueprintsprocessor')
2 files changed, 15 insertions, 5 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() diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt index 345650686..b246b33e1 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceController.kt @@ -1,6 +1,6 @@ /* * Copyright © 2017-2018 AT&T Intellectual Property. - * Modifications Copyright © 2019 IBM. + * Modifications Copyright © 2019 IBM, Bell Canada. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam +import kotlinx.coroutines.Dispatchers import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ACTION_MODE_ASYNC import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput @@ -49,7 +50,7 @@ open class ExecutionServiceController { produces = [MediaType.APPLICATION_JSON_VALUE]) @ResponseBody @ApiOperation(value = "Health Check", hidden = true) - fun executionServiceControllerHealthCheck() = monoMdc { + fun executionServiceControllerHealthCheck() = monoMdc(Dispatchers.IO) { log.info("Health check success...") "Success".asJsonPrimitive() } @@ -63,7 +64,7 @@ open class ExecutionServiceController { @PreAuthorize("hasRole('USER')") fun process(@ApiParam(value = "ExecutionServiceInput payload.", required = true) @RequestBody executionServiceInput: ExecutionServiceInput) - : Mono<ResponseEntity<ExecutionServiceOutput>> = monoMdc { + : Mono<ResponseEntity<ExecutionServiceOutput>> = monoMdc(Dispatchers.IO) { if (executionServiceInput.actionIdentifiers.mode == ACTION_MODE_ASYNC) { throw IllegalStateException("Can't process async request through the REST endpoint. Use gRPC for async processing.") @@ -72,3 +73,4 @@ open class ExecutionServiceController { ResponseEntity(processResult, determineHttpStatusCode(processResult.status.code)) } } + |