summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/modules/services')
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt30
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt15
2 files changed, 27 insertions, 18 deletions
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<ExecutionServic
var nodeTemplateName: String = ""
var operationInputs: MutableMap<String, JsonNode> = 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<ExecutionServic
executionServiceOutput.commonHeader = executionServiceInput!!.commonHeader
// Resolve the Output Expression
- val operationResolvedProperties = bluePrintRuntimeService!!
+ val stepOutputs = bluePrintRuntimeService!!
.resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
- val metadata = executionServiceOutput.metadata
- metadata.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, stepName)
- metadata.putJsonElement("$stepName-step-outputs", operationResolvedProperties)
+ bluePrintRuntimeService!!.put("$stepName-step-outputs", stepOutputs.asJsonNode())
// Populate Status
val status = Status()
@@ -110,6 +118,6 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
}
fun getOperationInput(key: String): JsonNode {
- return operationInputs.get(key) ?: NullNode.instance
+ return operationInputs[key] ?: NullNode.instance
}
} \ No newline at end of file
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 87c0c539e..e514a1fbb 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
@@ -21,6 +21,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInp
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.asJsonNode
import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
import org.onap.ccsdk.sli.core.sli.SvcLogicContext
import org.onap.ccsdk.sli.core.sli.SvcLogicException
@@ -69,18 +70,18 @@ open class ComponentExecuteNodeExecutor : ExecuteNodeExecutor() {
val plugin = this.getComponentFunction(componentName)
// Set the Blueprint Service
plugin.bluePrintRuntimeService = ctx.getBluePrintService()
+ plugin.stepName = nodeTemplateName
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)
+ val stepInputs: MutableMap<String, JsonNode> = 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)