From 065e76a7e3d9cf968fbbf456203ce0657a45fa2c Mon Sep 17 00:00:00 2001 From: Brinda Santh Date: Wed, 10 Apr 2019 14:05:29 -0400 Subject: Add remote python executor Change-Id: I288e182847f250c8e26e9bc10b8f3124afc2f583 Issue-ID: CCSDK-1215 Signed-off-by: Brinda Santh --- .../core/api/data/BlueprintRemoteProcessorData.kt | 45 ++++++++++++++++++++++ .../execution/RemoteScriptExecutionService.kt | 27 +++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt create mode 100644 ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt (limited to 'ms/blueprintsprocessor/modules') diff --git a/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt new file mode 100644 index 000000000..90eb933f4 --- /dev/null +++ b/ms/blueprintsprocessor/modules/commons/processor-core/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/core/api/data/BlueprintRemoteProcessorData.kt @@ -0,0 +1,45 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.core.api.data + +import com.fasterxml.jackson.databind.JsonNode + +enum class RemoteScriptType { + PYTHON, ANSIBLE, KOTLIN, SH +} + +data class RemoteIdentifier(var blueprintName: String? = null, + var blueprintVersion: String? = null) + + +data class RemoteScriptExecutionInput(var requestId: String, + var remoteIdentifier: RemoteIdentifier? = null, + var remoteScriptType: RemoteScriptType, + var command: String, + var timeOut: Long = 30, + var properties: MutableMap = hashMapOf() +) + + +data class RemoteScriptExecutionOutput(var requestId: String, var response: String) + +data class PrepareRemoteEnvInput(var requestId: String, + var remoteScriptType: RemoteScriptType, + var packages: MutableList?, + var timeOut: Long = 120, + var properties: MutableMap = hashMapOf() +) \ No newline at end of file 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 new file mode 100644 index 000000000..5d279ce3f --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/RemoteScriptExecutionService.kt @@ -0,0 +1,27 @@ +/* + * Copyright © 2019 IBM. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.onap.ccsdk.cds.blueprintsprocessor.services.execution + +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.PrepareRemoteEnvInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionInput +import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.RemoteScriptExecutionOutput + + +interface RemoteScriptExecutionService { + suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput): RemoteScriptExecutionOutput + suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput): RemoteScriptExecutionOutput +} \ No newline at end of file -- cgit 1.2.3-korg