From d08286491038484b55474ee038e032e008309708 Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Wed, 17 Jul 2019 13:12:57 -0400 Subject: Enable dynamic remote python executor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I77a60de87acec862ce47256557a1223fefe82a12 Issue-ID: CCSDK-1497 Signed-off-by: Alexis de Talhouët --- .../services/execution/RemoteScriptExecutionService.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'ms/blueprintsprocessor/modules/services') diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt index 3af57a22b..d4195ae45 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt @@ -22,6 +22,7 @@ import com.google.protobuf.Timestamp import com.google.protobuf.util.JsonFormat import io.grpc.ManagedChannel import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.* +import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcClientService import org.onap.ccsdk.cds.blueprintsprocessor.grpc.service.BluePrintGrpcLibPropertyService import org.onap.ccsdk.cds.controllerblueprints.command.api.* import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils @@ -31,9 +32,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty import org.springframework.context.annotation.Scope import org.springframework.stereotype.Service - interface RemoteScriptExecutionService { - suspend fun init(selector: String) + suspend fun init(selector: Any) suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput): RemoteScriptExecutionOutput suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput): RemoteScriptExecutionOutput suspend fun close() @@ -51,9 +51,14 @@ class GrpcRemoteScriptExecutionService(private val bluePrintGrpcLibPropertyServi private var channel: ManagedChannel? = null private lateinit var commandExecutorServiceGrpc: CommandExecutorServiceGrpc.CommandExecutorServiceBlockingStub - override suspend fun init(selector: String) { + override suspend fun init(selector: Any) { // Get the GRPC Client Service based on selector - val grpcClientService = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(selector) + val grpcClientService: BluePrintGrpcClientService + if (selector is JsonNode) { + grpcClientService = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(selector) + } else { + grpcClientService = bluePrintGrpcLibPropertyService.blueprintGrpcClientService(selector.toString()) + } // Get the GRPC Channel channel = grpcClientService.channel() // Create Non Blocking Stub -- cgit 1.2.3-korg