summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-04-19 00:30:17 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-19 00:30:17 +0000
commitf812f74460b20a2ba2d4c58e45fd9463a7209769 (patch)
tree278f9422619d36677988ead14ec569cc3e968590 /ms/blueprintsprocessor/functions
parentf5991756ab79209e793a9de072eb2100958c853f (diff)
parentcc96f30a504aa32030eafefdba69d635869c7949 (diff)
Merge "Add support for Ansible packages"
Diffstat (limited to 'ms/blueprintsprocessor/functions')
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt14
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt2
2 files changed, 8 insertions, 8 deletions
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index 6437cdf03..17d5fc76d 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -16,6 +16,8 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor
+import com.fasterxml.jackson.databind.node.MissingNode
+import com.fasterxml.jackson.databind.node.NullNode
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.*
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractComponentFunction
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ExecutionServiceConstant
@@ -47,6 +49,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
const val INPUT_ENDPOINT_SELECTOR = "endpoint-selector"
const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
const val INPUT_COMMAND = "command"
+ const val INPUT_PACKAGES = "packages"
}
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
@@ -75,11 +78,12 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val endPointSelector = getOperationInput(INPUT_ENDPOINT_SELECTOR)
val dynamicProperties = getOperationInput(INPUT_DYNAMIC_PROPERTIES)
val command = getOperationInput(INPUT_COMMAND).asText()
+ val packages = getOperationInput(INPUT_PACKAGES)
// TODO("Python execution command and Resolve some expressions with dynamic properties")
val scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath)
- val dependencies = operationAssignment.implementation?.dependencies
+// val dependencies = operationAssignment.implementation?.dependencies
try {
// Open GRPC Connection
@@ -87,13 +91,12 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
var executionLogs = ""
- // If dependencies are defined, then install in remote server
- if (dependencies != null && dependencies.isNotEmpty()) {
+ // If packages are defined, then install in remote server
+ if (packages !is MissingNode && packages !is NullNode) {
val prepareEnvInput = PrepareRemoteEnvInput(requestId = processId,
remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName,
blueprintVersion = blueprintVersion),
- remoteScriptType = RemoteScriptType.PYTHON,
- packages = dependencies
+ packages = packages
)
val prepareEnvOutput = remoteScriptExecutionService.prepareEnv(prepareEnvInput)
executionLogs = prepareEnvOutput.response
@@ -106,7 +109,6 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
val remoteExecutionInput = RemoteScriptExecutionInput(
requestId = processId,
remoteIdentifier = RemoteIdentifier(blueprintName = blueprintName, blueprintVersion = blueprintVersion),
- remoteScriptType = RemoteScriptType.PYTHON,
command = scriptCommand)
val remoteExecutionOutput = remoteScriptExecutionService.executeCommand(remoteExecutionInput)
executionLogs += remoteExecutionOutput.response
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
index 7cd5d5cac..03616d5e4 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorTest.kt
@@ -68,7 +68,6 @@ class MockRemoteScriptExecutionService : RemoteScriptExecutionService {
override suspend fun prepareEnv(prepareEnvInput: PrepareRemoteEnvInput): RemoteScriptExecutionOutput {
assertEquals(prepareEnvInput.requestId, "123456-1000", "failed to match request id")
- assertEquals(prepareEnvInput.remoteScriptType, RemoteScriptType.PYTHON, "failed to match script type")
assertNotNull(prepareEnvInput.packages, "failed to get packages")
val remoteScriptExecutionOutput = mockk<RemoteScriptExecutionOutput>()
@@ -78,7 +77,6 @@ class MockRemoteScriptExecutionService : RemoteScriptExecutionService {
override suspend fun executeCommand(remoteExecutionInput: RemoteScriptExecutionInput): RemoteScriptExecutionOutput {
assertEquals(remoteExecutionInput.requestId, "123456-1000", "failed to match request id")
- assertEquals(remoteExecutionInput.remoteScriptType, RemoteScriptType.PYTHON, "failed to match script type")
val remoteScriptExecutionOutput = mockk<RemoteScriptExecutionOutput>()
every { remoteScriptExecutionOutput.status } returns StatusType.SUCCESS