aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-04-24 13:39:55 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-24 13:39:55 +0000
commit7f15996a7b250760d1d3ecb32520ce4e8755964e (patch)
treef702330b81e808359510d0bdcac1cebdbe0f86c0
parent8f9a20b2908124655712b7688ba6b1b641b1608a (diff)
parent5a82232d3502a566466fac1f8d6f6aadc50fbc6e (diff)
Merge "Support for dynamic property in command args"
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json5
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json19
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json5
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt9
-rw-r--r--ms/command-executor/src/main/docker/Dockerfile5
5 files changed, 36 insertions, 7 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json
index 640a4ebee..e5b8b3062 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/node_types.json
@@ -34,6 +34,11 @@
"required": false,
"type": "json"
},
+ "argument-properties": {
+ "description": "Argument Json Content or DSL Json reference.",
+ "required": false,
+ "type": "json"
+ },
"command": {
"description": "Command to execute.",
"required": true,
diff --git a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json
index d78176f4c..48992bd72 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/remote_scripts/Definitions/remote_scripts.json
@@ -25,6 +25,13 @@
"file": "Definitions/policy_types.json"
}
],
+ "dsl_definitions": {
+ "execute-argument-properties": {
+ "input": {
+ "get_input": "input"
+ }
+ }
+ },
"topology_template": {
"workflows": {
"execute-remote-python": {
@@ -39,7 +46,12 @@
]
}
},
- "inputs": {},
+ "inputs": {
+ "input": {
+ "required": false,
+ "type": "string"
+ }
+ },
"outputs": {
"prepare-environment-logs": {
"type": "string",
@@ -107,7 +119,7 @@
"primary": "component-script"
},
"inputs": {
- "command": "python SamplePython.py blah",
+ "command": "python SamplePython.py $input",
"packages": [
{
"type": "pip",
@@ -115,7 +127,8 @@
"pyaml"
]
}
- ]
+ ],
+ "argument-properties": "*execute-argument-properties"
}
}
}
diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json
index 5c9503fc3..09b371c22 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-python-executor.json
@@ -32,6 +32,11 @@
"required": false,
"type": "json"
},
+ "argument-properties": {
+ "description": "Argument Json Content or DSL Json reference.",
+ "required": false,
+ "type": "json"
+ },
"command": {
"description": "Command to execute.",
"required": true,
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 488e0d054..df92d7157 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
@@ -28,6 +28,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.checkFileExists
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotBlank
import org.onap.ccsdk.cds.controllerblueprints.core.data.OperationAssignment
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedFile
+import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintVelocityTemplateService
import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.config.ConfigurableBeanFactory
@@ -47,6 +48,7 @@ open class ComponentRemotePythonExecutor(private val remoteScriptExecutionServic
companion object {
const val INPUT_ENDPOINT_SELECTOR = "endpoint-selector"
const val INPUT_DYNAMIC_PROPERTIES = "dynamic-properties"
+ const val INPUT_ARGUMENT_PROPERTIES = "argument-properties"
const val INPUT_COMMAND = "command"
const val INPUT_PACKAGES = "packages"
@@ -79,11 +81,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)
+ val argumentProperties = getOperationInput(INPUT_ARGUMENT_PROPERTIES)
- // TODO("Python execution command and Resolve some expressions with dynamic properties")
- val scriptCommand = command.replace(pythonScript.name, pythonScript.absolutePath)
+ var command = getOperationInput(INPUT_COMMAND).asText()
+ command = command.replace(pythonScript.name, pythonScript.absolutePath)
+ val scriptCommand = BluePrintVelocityTemplateService.generateContent(command, json = JacksonUtils.getJson(argumentProperties))
try {
// Open GRPC Connection
diff --git a/ms/command-executor/src/main/docker/Dockerfile b/ms/command-executor/src/main/docker/Dockerfile
index 50f592dd6..c0458bdf6 100644
--- a/ms/command-executor/src/main/docker/Dockerfile
+++ b/ms/command-executor/src/main/docker/Dockerfile
@@ -1,6 +1,9 @@
FROM python:3.6-slim
-ENV GRPC_PYTHON_VERSION 1.19.0
+ENV HTTP_PROXY ${HTTP_PROXY}
+ENV HTTPS_PROXY ${HTTPS_PROXY}
+
+ENV GRPC_PYTHON_VERSION 1.20.0
RUN python -m pip install --upgrade pip
RUN pip install grpcio==${GRPC_PYTHON_VERSION} grpcio-tools==${GRPC_PYTHON_VERSION}
RUN pip install virtualenv