diff options
author | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-12-04 10:25:44 -0500 |
---|---|---|
committer | Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com> | 2018-12-04 10:31:15 -0500 |
commit | 809ef53debb3fd10de78e640e4a1626626eb8373 (patch) | |
tree | c6867fc2138fff65ea38a6a12855e77a85a4718b /ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin | |
parent | 43aeebfba2e83b5a10b1988074f15e677db23f9d (diff) |
Add Blueprint Runtime Input/Output logic
Change-Id: I0355e78862096b7b4074faa882d66ce27d6e1844
Issue-ID: CCSDK-670
Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin')
2 files changed, 23 insertions, 4 deletions
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt index 993f10eef..9bb562b76 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt @@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.utils.SvcGraphUtils -import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService import org.slf4j.LoggerFactory import org.springframework.stereotype.Service @@ -55,14 +54,17 @@ class DefaultBlueprintDGExecutionService(val blueprintSvcLogicService: Blueprint WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH) // Populate the DG Path - val dgFilePath = bluePrintRuntimeService.getAsString(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH) - .plus(File.separator).plus(artifactDefinition.file) + val dgFilePath = bluePrintContext.rootPath.plus(File.separator).plus(artifactDefinition.file) log.info("Executing directed graph ($dgFilePath)") // Create DG instance val graph = SvcGraphUtils.getSvcGraphFromFile(dgFilePath) + // Assign Workflow inputs + val input = executionServiceInput.payload.get("$workflowName-request") + bluePrintRuntimeService.assignWorkflowInputs(workflowName, input) + // Execute the DG return blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput) as ExecutionServiceOutput diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt index ace9f2787..87c0c539e 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt @@ -16,9 +16,12 @@ package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor +import com.fasterxml.jackson.databind.JsonNode import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.BlueprintSvcLogicContext +import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants +import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement import org.onap.ccsdk.sli.core.sli.SvcLogicContext import org.onap.ccsdk.sli.core.sli.SvcLogicException import org.onap.ccsdk.sli.core.sli.SvcLogicNode @@ -57,13 +60,27 @@ open class ComponentExecuteNodeExecutor : ExecuteNodeExecutor() { // Get the Component Name, NodeTemplate type is mapped to Component Name val componentName = blueprintContext.nodeTemplateByName(nodeTemplateName).type - log.info("executing node template($nodeTemplateName) component($componentName)") + val interfaceName = blueprintContext.nodeTemplateFirstInterfaceName(nodeTemplateName) + + val operationName = blueprintContext.nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName) + + log.info("executing node template($nodeTemplateName) component($componentName) interface($interfaceName) operation($operationName)") // Get the Component Instance val plugin = this.getComponentFunction(componentName) // Set the Blueprint Service plugin.bluePrintRuntimeService = ctx.getBluePrintService() val executionInput = ctx.getRequest() as ExecutionServiceInput + + val metaData = executionInput.metadata + metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, nodeTemplateName) + // Populate Step Meta Data + val stepMetaData: MutableMap<String, JsonNode> = hashMapOf() + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, nodeTemplateName) + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, interfaceName) + stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, operationName) + + 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) |