diff options
author | Dan Timoney <dtimoney@att.com> | 2018-12-11 15:18:55 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-12-11 15:18:55 +0000 |
commit | 39e274ebb8e37b968c89403a32c7d6ee3f0fb880 (patch) | |
tree | 9213264799c92025be753b3c013fb5794bea9fec | |
parent | 1328bf9eb2c5270ac5f6aa336c0661eff4f1a7f1 (diff) | |
parent | 2ee4376dafa2bf4b887c86a0c4d95a37fd630080 (diff) |
Merge "Store step inputs to blueprint runtime service."
10 files changed, 54 insertions, 40 deletions
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt index 90a5ea0b7..05f6a2db6 100644 --- a/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/netconf-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutorTest.kt @@ -24,6 +24,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput import org.onap.ccsdk.apps.blueprintsprocessor.functions.python.executor.PythonExecutorProperty 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.apps.controllerblueprints.core.utils.BluePrintMetadataUtils import org.springframework.beans.factory.annotation.Autowired @@ -62,15 +63,15 @@ class ComponentNetconfExecutorTest { componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService - val metaData: MutableMap<String, JsonNode> = hashMapOf() - metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, "activate-jython") - val stepMetaData: MutableMap<String, JsonNode> = hashMapOf() stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython") stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "JythonExecutorComponent") stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process") - metaData.putJsonElement("activate-jython-step-inputs", stepMetaData) - executionServiceInput.metadata = metaData + // Set Step Inputs in Blueprint Runtime Service + bluePrintRuntimeService.put("activate-jython-step-inputs", stepMetaData.asJsonNode()) + + componentNetconfExecutor.bluePrintRuntimeService = bluePrintRuntimeService + componentNetconfExecutor.stepName = "activate-jython" componentNetconfExecutor.apply(executionServiceInput) diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt index 708797484..07591a502 100644 --- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt +++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt @@ -23,6 +23,7 @@ import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ActionIdentifiers import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.CommonHeader import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput 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.apps.controllerblueprints.core.utils.BluePrintMetadataUtils import org.springframework.beans.factory.annotation.Autowired @@ -58,18 +59,14 @@ class ComponentJythonExecutorTest { val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(commonHeader.requestId, "./../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration") - componentJythonExecutor.bluePrintRuntimeService = bluePrintRuntimeService - - - val metaData: MutableMap<String, JsonNode> = hashMapOf() - metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, "activate-jython") - val stepMetaData: MutableMap<String, JsonNode> = hashMapOf() stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython") stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "JythonExecutorComponent") stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process") - metaData.putJsonElement("activate-jython-step-inputs", stepMetaData) - executionServiceInput.metadata = metaData + bluePrintRuntimeService.put("activate-jython-step-inputs", stepMetaData.asJsonNode()) + + componentJythonExecutor.bluePrintRuntimeService = bluePrintRuntimeService + componentJythonExecutor.stepName = "activate-jython" componentJythonExecutor.apply(executionServiceInput) diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DataBaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DataBaseResourceAssignmentProcessor.kt index 80b2d0b79..bdb79d305 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DataBaseResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DataBaseResourceAssignmentProcessor.kt @@ -29,6 +29,10 @@ import org.springframework.stereotype.Service @Service("resource-assignment-processor-db") open class DataBaseResourceAssignmentProcessor : ResourceAssignmentProcessor(){ + override fun getName(): String { + return "resource-assignment-processor-db" + } + override fun process(executionRequest: ResourceAssignment) { } diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DefaultResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DefaultResourceAssignmentProcessor.kt index 055292549..5419c0f65 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DefaultResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/DefaultResourceAssignmentProcessor.kt @@ -29,6 +29,10 @@ import org.springframework.stereotype.Service @Service("resource-assignment-processor-default")
open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+ override fun getName(): String {
+ return "resource-assignment-processor-default"
+ }
+
override fun process(executionRequest: ResourceAssignment) {
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/InputResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/InputResourceAssignmentProcessor.kt index 73fd3a1f8..2b36add0c 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/InputResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/InputResourceAssignmentProcessor.kt @@ -29,6 +29,10 @@ import org.springframework.stereotype.Service @Service("resource-assignment-processor-input")
open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+ override fun getName(): String {
+ return "resource-assignment-processor-input"
+ }
+
override fun process(executionRequest: ResourceAssignment) {
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/SimpleRestResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/SimpleRestResourceAssignmentProcessor.kt index 64c8a1d3b..d778c232d 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/SimpleRestResourceAssignmentProcessor.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/resource/resolutionprocessor/SimpleRestResourceAssignmentProcessor.kt @@ -29,6 +29,10 @@ import org.springframework.stereotype.Service @Service("resource-assignment-processor-mdsal") open class SimpleRestResourceAssignmentProcessor : ResourceAssignmentProcessor() { + override fun getName(): String { + return "resource-assignment-processor-mdsal" + } + override fun process(executionRequest: ResourceAssignment) { } 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<String, JsonNode> = 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<String, JsonNode> = 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<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) |