From 2ee4376dafa2bf4b887c86a0c4d95a37fd630080 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Thu, 6 Dec 2018 13:25:36 -0500 Subject: Store step inputs to blueprint runtime service. Change-Id: Ib01edfc358625d25ac0625f88739c7c57f7f967c Issue-ID: CCSDK-670 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../core/api/data/BlueprintProcessorData.kt | 3 --- .../resources/execution-input/default-input.json | 6 ----- .../execution/AbstractComponentFunction.kt | 30 ++++++++++++++-------- .../executor/ComponentExecuteNodeExecutor.kt | 15 ++++++----- 4 files changed, 27 insertions(+), 27 deletions(-) (limited to 'ms/blueprintsprocessor/modules') diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt index 427063e4b..3cad62711 100644 --- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt +++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt @@ -18,7 +18,6 @@ package org.onap.ccsdk.apps.blueprintsprocessor.core.api.data import com.fasterxml.jackson.annotation.JsonFormat -import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node.ObjectNode import io.swagger.annotations.ApiModelProperty import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment @@ -59,7 +58,6 @@ open class ExecutionServiceInput { lateinit var actionIdentifiers: ActionIdentifiers @get:ApiModelProperty(required = true) lateinit var payload: ObjectNode - var metadata: MutableMap = hashMapOf() } open class ExecutionServiceOutput { @@ -71,7 +69,6 @@ open class ExecutionServiceOutput { var status: Status = Status() @get:ApiModelProperty(required = true) lateinit var payload: ObjectNode - var metadata: MutableMap = hashMapOf() } open class ActionIdentifiers { diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json index a6eb7a813..47ace853c 100644 --- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json +++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json @@ -19,11 +19,5 @@ "hostname": "localhost" } } - }, - "metadata": { - "current-node-template": "resource-assignment-py", - "current-step": "resource-assignment-py", - "current-operation": "process", - "current-interface": "ResourceAssignmentComponent" } } \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt index 37f14925d..c6ce46570 100644 --- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt @@ -24,9 +24,9 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInp import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode import org.onap.ccsdk.apps.controllerblueprints.core.getAsString import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode -import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService import org.slf4j.LoggerFactory @@ -49,36 +49,46 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode = hashMapOf() + override fun getName(): String { + return stepName + } override fun prepareRequest(executionServiceInput: ExecutionServiceInput): ExecutionServiceInput { checkNotNull(bluePrintRuntimeService) { "failed to prepare blueprint runtime" } + check(stepName.isNotEmpty()) { "failed to assign step name" } + this.executionServiceInput = executionServiceInput processId = executionServiceInput.commonHeader.requestId + check(processId.isNotEmpty()) { "couldn't get process id for step($stepName)" } + workflowName = executionServiceInput.actionIdentifiers.actionName + check(workflowName.isNotEmpty()) { "couldn't get action name for step($stepName)" } - val metadata = executionServiceInput.metadata - stepName = metadata.getAsString(BluePrintConstants.PROPERTY_CURRENT_STEP) log.info("preparing request id($processId) for workflow($workflowName) step($stepName)") - val operationInputs = metadata.get("$stepName-step-inputs") ?: JsonNodeFactory.instance.objectNode() + val operationInputs = bluePrintRuntimeService!!.get("$stepName-step-inputs") + ?: JsonNodeFactory.instance.objectNode() operationInputs.fields().forEach { this.operationInputs[it.key] = it.value } nodeTemplateName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE) + check(nodeTemplateName.isNotEmpty()) { "couldn't get NodeTemplate name for step($stepName)" } + interfaceName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_INTERFACE) + check(interfaceName.isNotEmpty()) { "couldn't get Interface name for step($stepName)" } + operationName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION) + check(operationName.isNotEmpty()) { "couldn't get Operation name for step($stepName)" } val operationResolvedProperties = bluePrintRuntimeService!!.resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) this.operationInputs.putAll(operationResolvedProperties) - - return executionServiceInput } @@ -87,12 +97,10 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode = hashMapOf() - stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, nodeTemplateName) - stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, interfaceName) - stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, operationName) + val stepInputs: MutableMap = hashMapOf() + stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, nodeTemplateName) + stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, interfaceName) + stepInputs.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, operationName) + + plugin.bluePrintRuntimeService!!.put("$nodeTemplateName-step-inputs", stepInputs.asJsonNode()) - metaData.putJsonElement("$nodeTemplateName-step-inputs", stepMetaData) // Get the Request from the Context and Set to the Function Input and Invoke the function val executionOutput = plugin.apply(executionInput) -- cgit 1.2.3-korg