From ea1c8b477e615f4dd45204b221fe7eacfe5474af Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Mon, 20 Jun 2022 22:27:19 +0200 Subject: [PATCH] Aligned attributes of CDS components Issue-ID: CCSDK-3698 Signed-off-by: Lukasz Rajewski Change-Id: Ie5c78a9a347373b5faf588627e42138806d69c0c --- .../component-config-snapshots-executor.json | 16 ++++++-- .../node_type/component-jython-executor.json | 4 ++ .../node_type/component-netconf-executor.json | 4 ++ .../component-remote-ansible-executor.json | 12 ++++++ .../component-remote-python-executor.json | 12 ++++++ .../component-remote-script-executor.json | 5 +++ .../node_type/component-resource-resolution.json | 5 +++ .../node_type/component-script-executor.json | 4 ++ .../snapshots/ComponentConfigSnapshotsExecutor.kt | 46 +++++++++++----------- .../ComponentConfigSnapshotsExecutorTest.kt | 46 +++++++++++----------- .../netconf/executor/ComponentNetconfExecutor.kt | 6 +++ .../executor/ComponentRemotePythonExecutor.kt | 2 + .../executor/ComponentRemotePythonExecutorDSL.kt | 30 +++++++++++++- .../resolution/ResourceResolutionComponent.kt | 1 + .../resolution/ResourceResolutionComponentDSL.kt | 4 ++ .../execution/ComponentRemoteScriptExecutor.kt | 1 + .../execution/ComponentRemoteScriptExecutorDSL.kt | 12 +++++- 17 files changed, 158 insertions(+), 52 deletions(-) diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json index caae68eef..91cd66533 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-config-snapshots-executor.json @@ -13,10 +13,6 @@ "config-snapshot-value": { "required": false, "type": "string" - }, - "response-data": { - "required": false, - "type": "json" } }, "capabilities": { @@ -85,6 +81,18 @@ } ] } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } } } } diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json index ae674f3ec..f1b8dc52a 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-jython-executor.json @@ -5,6 +5,10 @@ "response-data": { "required": false, "type": "json" + }, + "status": { + "required": true, + "type": "string" } }, "capabilities": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json index b51d4d55d..b6a505710 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-netconf-executor.json @@ -5,6 +5,10 @@ "response-data": { "required": false, "type": "json" + }, + "status": { + "required": true, + "type": "string" } }, "capabilities": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json index 125d1ea2f..7b90c4729 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-ansible-executor.json @@ -70,6 +70,18 @@ "required": true, "type": "string" } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } } } } 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 8fa8e7c7b..33b735433 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 @@ -73,6 +73,18 @@ "type": "integer", "default": 180 } + }, + "outputs": { + "response-data": { + "description": "Execution Response Data.", + "required": false, + "type": "string" + }, + "status": { + "description": "Status of the Component Execution ( success or failure )", + "required": true, + "type": "string" + } } } } diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json index 6909d20bc..baa3f5b0f 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-remote-script-executor.json @@ -52,6 +52,11 @@ } }, "outputs": { + "response-data": { + "description": "Execution Response Data.", + "required": false, + "type": "string" + }, "status": { "description": "Status of the Component Execution ( success or failure )", "required": true, diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json index 853fe563e..43f5a6701 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-resource-resolution.json @@ -11,6 +11,11 @@ "description": "Holds resolved values for each artifact prefix eg. { vdns: { vnf-id: 123 } }", "required": true, "type": "map" + }, + "status": { + "description": "Resource Assignment status.", + "required": true, + "type": "string" } }, "capabilities": { diff --git a/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json b/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json index a2cd32ec2..80a63efee 100644 --- a/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json +++ b/components/model-catalog/definition-type/starter-type/node_type/component-script-executor.json @@ -5,6 +5,10 @@ "response-data": { "required": false, "type": "json" + }, + "status": { + "required": true, + "type": "string" } }, "capabilities": { diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt index af3753e1a..394e669d7 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutor.kt @@ -75,12 +75,12 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso const val DIFF_XML = "XML" // output fields names (and values) populated by this executor. - const val OUTPUT_STATUS = "config-snapshot-status" - const val OUTPUT_MESSAGE = "config-snapshot-message" - const val OUTPUT_SNAPSHOT = "config-snapshot-value" + const val ATTRIBUTE_STATUS = "config-snapshot-status" + const val ATTRIBUTE_MESSAGE = "config-snapshot-message" + const val ATTRIBUTE_SNAPSHOT = "config-snapshot-value" - const val OUTPUT_STATUS_SUCCESS = "success" - const val OUTPUT_STATUS_ERROR = "error" + const val ATTRIBUTE_STATUS_SUCCESS = "success" + const val ATTRIBUTE_STATUS_ERROR = "error" } /** @@ -103,7 +103,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso OPERATION_DIFF -> compareConfigurationSnapshot(resourceId, resourceType, contentType) else -> setNodeOutputErrors( - OUTPUT_STATUS_ERROR, + ATTRIBUTE_STATUS_ERROR, "Operation parameter must be fetch, store or diff" ) } @@ -113,7 +113,7 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso * General error handling for the executor. */ override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { - setNodeOutputErrors(OUTPUT_STATUS_ERROR, "Error : ${runtimeException.message}") + setNodeOutputErrors(ATTRIBUTE_STATUS_ERROR, "Error : ${runtimeException.message}") } /** @@ -126,11 +126,11 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso ) { try { val cfgSnapshotValue = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, status) - setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, cfgSnapshotValue) + setNodeOutputProperties(ATTRIBUTE_STATUS_SUCCESS, cfgSnapshotValue) } catch (er: NoSuchElementException) { val message = "No Resource config snapshot identified by resourceId={$resourceId}, " + "resourceType={$resourceType} does not exists" - setNodeOutputErrors(OUTPUT_STATUS_ERROR, message) + setNodeOutputErrors(ATTRIBUTE_STATUS_ERROR, message) } } @@ -145,10 +145,10 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso ) { if (cfgSnapshotValue.isNotEmpty()) { val cfgSnapshotSaved = cfgSnapshotService.write(cfgSnapshotValue, resourceId, resourceType, status) - setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, cfgSnapshotSaved.config_snapshot ?: "") + setNodeOutputProperties(ATTRIBUTE_STATUS_SUCCESS, cfgSnapshotSaved.config_snapshot ?: "") } else { val message = "Could not store config snapshot identified by resourceId={$resourceId},resourceType={$resourceType} does not exists" - setNodeOutputErrors(OUTPUT_STATUS_ERROR, message) + setNodeOutputErrors(ATTRIBUTE_STATUS_ERROR, message) } } @@ -161,14 +161,14 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso val cfgCandidate = cfgSnapshotService.findByResourceIdAndResourceTypeAndStatus(resourceId, resourceType, CANDIDATE) if (cfgRunning.isEmpty() || cfgCandidate.isEmpty()) { - setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, Strings.EMPTY) + setNodeOutputProperties(ATTRIBUTE_STATUS_SUCCESS, Strings.EMPTY) return } when (contentType.toUpperCase()) { DIFF_JSON -> { val patchNode = JsonDiff.asJson(cfgRunning.jsonAsJsonType(), cfgCandidate.jsonAsJsonType()) - setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, patchNode.toString()) + setNodeOutputProperties(ATTRIBUTE_STATUS_SUCCESS, patchNode.toString()) } DIFF_XML -> { val myDiff = DiffBuilder @@ -180,11 +180,11 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso .normalizeWhitespace() .build() - setNodeOutputProperties(OUTPUT_STATUS_SUCCESS, formatXmlDifferences(myDiff)) + setNodeOutputProperties(ATTRIBUTE_STATUS_SUCCESS, formatXmlDifferences(myDiff)) } else -> { val message = "Could not compare config snapshots for type $contentType" - setNodeOutputErrors(OUTPUT_STATUS_ERROR, message) + setNodeOutputErrors(ATTRIBUTE_STATUS_ERROR, message) } } } @@ -193,22 +193,22 @@ open class ComponentConfigSnapshotsExecutor(private val cfgSnapshotService: Reso * Utility function to set the output properties of the executor node */ private fun setNodeOutputProperties(status: String, snapshot: String) { - setAttribute(OUTPUT_STATUS, status.asJsonPrimitive()) - setAttribute(OUTPUT_SNAPSHOT, snapshot.asJsonPrimitive()) - log.debug("Setting output $OUTPUT_STATUS=$status") + setAttribute(ATTRIBUTE_STATUS, status.asJsonPrimitive()) + setAttribute(ATTRIBUTE_SNAPSHOT, snapshot.asJsonPrimitive()) + log.debug("Setting output $ATTRIBUTE_STATUS=$status") } /** * Utility function to set the output properties and errors of the executor node, in case of errors */ private fun setNodeOutputErrors(status: String, message: String) { - setAttribute(OUTPUT_STATUS, status.asJsonPrimitive()) - setAttribute(OUTPUT_MESSAGE, message.asJsonPrimitive()) - setAttribute(OUTPUT_SNAPSHOT, "".asJsonPrimitive()) + setAttribute(ATTRIBUTE_STATUS, status.asJsonPrimitive()) + setAttribute(ATTRIBUTE_MESSAGE, message.asJsonPrimitive()) + setAttribute(ATTRIBUTE_SNAPSHOT, "".asJsonPrimitive()) - log.info("Setting error and output $OUTPUT_STATUS=$status, $OUTPUT_MESSAGE=$message ") + log.info("Setting error and output $ATTRIBUTE_STATUS=$status, $ATTRIBUTE_MESSAGE=$message ") - addError(status, OUTPUT_MESSAGE, message) + addError(status, ATTRIBUTE_MESSAGE, message) } /** diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt index 3a3dd102a..bcb87aed7 100644 --- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt @@ -108,17 +108,17 @@ class ComponentConfigSnapshotsExecutorTest { } // then; we should get success and the TEST1 payload in our output properties assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) assertEquals( snapshotConfig.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT + ComponentConfigSnapshotsExecutor.ATTRIBUTE_SNAPSHOT ) ) } @@ -147,17 +147,17 @@ class ComponentConfigSnapshotsExecutorTest { } // then; we should get success and the TEST payload in our output properties assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) assertEquals( snapshotConfig.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT + ComponentConfigSnapshotsExecutor.ATTRIBUTE_SNAPSHOT ) ) } @@ -186,17 +186,17 @@ class ComponentConfigSnapshotsExecutorTest { // then; we should get success and the PAYLOAD payload in our output properties assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) assertEquals( snapshotConfig.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT + ComponentConfigSnapshotsExecutor.ATTRIBUTE_SNAPSHOT ) ) } @@ -220,10 +220,10 @@ class ComponentConfigSnapshotsExecutorTest { } assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) } @@ -249,10 +249,10 @@ class ComponentConfigSnapshotsExecutorTest { // then; we should get error in our output properties assertTrue(bluePrintRuntimeService.getBluePrintError().allErrors().size == 1) assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_ERROR.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) val msg = "Operation parameter must be fetch, store or diff" @@ -260,7 +260,7 @@ class ComponentConfigSnapshotsExecutorTest { msg.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_MESSAGE + ComponentConfigSnapshotsExecutor.ATTRIBUTE_MESSAGE ) ) } @@ -288,10 +288,10 @@ class ComponentConfigSnapshotsExecutorTest { // then; we should get error in our output properties assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_ERROR.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) val message = "Could not compare config snapshots for type YANG" @@ -299,7 +299,7 @@ class ComponentConfigSnapshotsExecutorTest { message.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_MESSAGE + ComponentConfigSnapshotsExecutor.ATTRIBUTE_MESSAGE ) ) } @@ -330,10 +330,10 @@ class ComponentConfigSnapshotsExecutorTest { // then; we should get success assertTrue(bluePrintRuntimeService.getBluePrintError().allErrors().size == 0) assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) @@ -347,7 +347,7 @@ class ComponentConfigSnapshotsExecutorTest { diffJson.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT + ComponentConfigSnapshotsExecutor.ATTRIBUTE_SNAPSHOT ) ) } @@ -379,10 +379,10 @@ class ComponentConfigSnapshotsExecutorTest { // then; we should get success assertTrue(bluePrintRuntimeService.getBluePrintError().allErrors().size == 0) assertEquals( - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(), + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS_SUCCESS.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_STATUS + ComponentConfigSnapshotsExecutor.ATTRIBUTE_STATUS ) ) @@ -399,7 +399,7 @@ class ComponentConfigSnapshotsExecutorTest { diffXml.asJsonPrimitive(), bluePrintRuntimeService.getNodeTemplateAttributeValue( nodeTemplateName, - ComponentConfigSnapshotsExecutor.OUTPUT_SNAPSHOT + ComponentConfigSnapshotsExecutor.ATTRIBUTE_SNAPSHOT ) ) } diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt index aa13fa0d7..779d18f11 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt @@ -39,6 +39,12 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic const val SCRIPT_TYPE = "script-type" const val SCRIPT_CLASS_REFERENCE = "script-class-reference" const val INSTANCE_DEPENDENCIES = "instance-dependencies" + + const val ATTRIBUTE_RESPONSE_DATA = "response-data" + const val ATTRIBUTE_STATUS = "status" + + const val OUTPUT_RESPONSE_DATA = "response-data" + const val OUTPUT_STATUS = "status" } lateinit var scriptComponent: AbstractScriptComponentFunction 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 f0ea8c3fb..a07c53bf1 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 @@ -83,6 +83,8 @@ open class ComponentRemotePythonExecutor( const val ATTRIBUTE_PREPARE_ENV_LOG = "prepare-environment-logs" const val ATTRIBUTE_EXEC_CMD_LOG = "execute-command-logs" const val ATTRIBUTE_RESPONSE_DATA = "response-data" + const val OUTPUT_RESPONSE_DATA = "response-data" + const val OUTPUT_STATUS = "status" const val DEFAULT_ENV_PREPARE_TIMEOUT_IN_SEC = 120 const val DEFAULT_EXECUTE_TIMEOUT_IN_SEC = 180 const val DEFAULT_CBA_UPLOAD_TIMEOUT_IN_SEC = 30 diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt index 3df25c402..7f9f2b105 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutorDSL.kt @@ -18,6 +18,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ArrayNode +import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentScriptExecutor import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive @@ -53,6 +54,10 @@ fun BluePrintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType { ComponentRemotePythonExecutor.ATTRIBUTE_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, false ) + attribute( + ComponentRemotePythonExecutor.ATTRIBUTE_EXEC_CMD_STATUS, BluePrintConstants.DATA_TYPE_STRING, + true + ) operation("ComponentRemotePythonExecutor", "ComponentRemotePythonExecutor Operation") { inputs { @@ -84,6 +89,16 @@ fun BluePrintTypes.nodeTypeComponentRemotePythonExecutor(): NodeType { entrySchema("dt-system-packages") } } + outputs { + property( + ComponentRemotePythonExecutor.OUTPUT_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, + false, "Output Response" + ) + property( + ComponentRemotePythonExecutor.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING, + true, "Status of the Component Execution ( success or failure )" + ) + } } } } @@ -184,5 +199,18 @@ class ComponentRemotePythonExecutorNodeTemplateBuilder(id: String, description: } } - class OutputsBuilder : PropertiesAssignmentBuilder() + class OutputsBuilder : PropertiesAssignmentBuilder() { + + fun status(status: String) = status(status.asJsonPrimitive()) + + fun status(status: JsonNode) { + property(ComponentScriptExecutor.OUTPUT_STATUS, status) + } + + fun responseData(responseData: String) = responseData(responseData.asJsonType()) + + fun responseData(responseData: JsonNode) { + property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, responseData) + } + } } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt index d46f75e41..98130cd6e 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt @@ -50,6 +50,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re const val INPUT_OCCURRENCE = "occurrence" const val ATTRIBUTE_ASSIGNMENT_PARAM = "assignment-params" + const val ATTRIBUTE_ASSIGNMENT_MAP = "assignment-map" const val ATTRIBUTE_STATUS = "status" const val OUTPUT_RESOURCE_ASSIGNMENT_PARAMS = "resource-assignment-params" diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt index 774873a43..a9370e2f2 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt @@ -49,6 +49,10 @@ fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType { ResourceResolutionComponent.ATTRIBUTE_ASSIGNMENT_PARAM, BluePrintConstants.DATA_TYPE_STRING, true ) + attribute( + ResourceResolutionComponent.ATTRIBUTE_ASSIGNMENT_MAP, BluePrintConstants.DATA_TYPE_MAP, + true + ) attribute( ResourceResolutionComponent.ATTRIBUTE_STATUS, BluePrintConstants.DATA_TYPE_STRING, true diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt index 2581e5628..be9ddb8c2 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt @@ -54,6 +54,7 @@ open class ComponentRemoteScriptExecutor( const val ATTRIBUTE_RESPONSE_DATA = "response-data" const val ATTRIBUTE_STATUS = "status" + const val OUTPUT_RESPONSE_DATA = "response-data" const val OUTPUT_STATUS = "status" } diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt index 7bb071501..6f3cc3ac5 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutorDSL.kt @@ -83,6 +83,10 @@ fun BluePrintTypes.nodeTypeComponentRemoteScriptExecutor(): NodeType { ) } outputs { + property( + ComponentRemoteScriptExecutor.OUTPUT_RESPONSE_DATA, BluePrintConstants.DATA_TYPE_JSON, + false, "Output Response" + ) property( ComponentRemoteScriptExecutor.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING, true, "Status of the Component Execution ( success or failure )" @@ -161,7 +165,13 @@ class ComponentRemoteScriptExecutorNodeTemplateBuilder(id: String, description: fun status(status: String) = status(status.asJsonPrimitive()) fun status(status: JsonNode) { - property(ComponentRemoteScriptExecutor.OUTPUT_STATUS, status) + property(ComponentScriptExecutor.OUTPUT_STATUS, status) + } + + fun responseData(responseData: String) = responseData(responseData.asJsonType()) + + fun responseData(responseData: JsonNode) { + property(ComponentScriptExecutor.OUTPUT_RESPONSE_DATA, responseData) } } } -- 2.16.6