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
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)
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
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)
@Service("resource-assignment-processor-db")
open class DataBaseResourceAssignmentProcessor : ResourceAssignmentProcessor(){
+ override fun getName(): String {
+ return "resource-assignment-processor-db"
+ }
+
override fun process(executionRequest: ResourceAssignment) {
}
@Service("resource-assignment-processor-default")\r
open class DefaultResourceAssignmentProcessor : ResourceAssignmentProcessor() {\r
\r
+ override fun getName(): String {\r
+ return "resource-assignment-processor-default"\r
+ }\r
+\r
override fun process(executionRequest: ResourceAssignment) {\r
}\r
\r
@Service("resource-assignment-processor-input")\r
open class InputResourceAssignmentProcessor : ResourceAssignmentProcessor() {\r
\r
+ override fun getName(): String {\r
+ return "resource-assignment-processor-input"\r
+ }\r
+\r
override fun process(executionRequest: ResourceAssignment) {\r
}\r
\r
@Service("resource-assignment-processor-mdsal")
open class SimpleRestResourceAssignmentProcessor : ResourceAssignmentProcessor() {
+ override fun getName(): String {
+ return "resource-assignment-processor-mdsal"
+ }
+
override fun process(executionRequest: ResourceAssignment) {
}
package org.onap.ccsdk.apps.blueprintsprocessor.core.api.data\r
\r
import com.fasterxml.jackson.annotation.JsonFormat\r
-import com.fasterxml.jackson.databind.JsonNode\r
import com.fasterxml.jackson.databind.node.ObjectNode\r
import io.swagger.annotations.ApiModelProperty\r
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
lateinit var actionIdentifiers: ActionIdentifiers\r
@get:ApiModelProperty(required = true)\r
lateinit var payload: ObjectNode\r
- var metadata: MutableMap<String, JsonNode> = hashMapOf()\r
}\r
\r
open class ExecutionServiceOutput {\r
var status: Status = Status()\r
@get:ApiModelProperty(required = true)\r
lateinit var payload: ObjectNode\r
- var metadata: MutableMap<String, JsonNode> = hashMapOf()\r
}\r
\r
open class ActionIdentifiers {\r
"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
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput\r
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status\r
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants\r
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonNode\r
import org.onap.ccsdk.apps.controllerblueprints.core.getAsString\r
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode\r
-import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement\r
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService\r
import org.slf4j.LoggerFactory\r
\r
var nodeTemplateName: String = ""\r
var operationInputs: MutableMap<String, JsonNode> = hashMapOf()\r
\r
+ override fun getName(): String {\r
+ return stepName\r
+ }\r
\r
override fun prepareRequest(executionServiceInput: ExecutionServiceInput): ExecutionServiceInput {\r
checkNotNull(bluePrintRuntimeService) { "failed to prepare blueprint runtime" }\r
\r
+ check(stepName.isNotEmpty()) { "failed to assign step name" }\r
+\r
this.executionServiceInput = executionServiceInput\r
\r
processId = executionServiceInput.commonHeader.requestId\r
+ check(processId.isNotEmpty()) { "couldn't get process id for step($stepName)" }\r
+\r
workflowName = executionServiceInput.actionIdentifiers.actionName\r
+ check(workflowName.isNotEmpty()) { "couldn't get action name for step($stepName)" }\r
\r
- val metadata = executionServiceInput.metadata\r
- stepName = metadata.getAsString(BluePrintConstants.PROPERTY_CURRENT_STEP)\r
log.info("preparing request id($processId) for workflow($workflowName) step($stepName)")\r
\r
- val operationInputs = metadata.get("$stepName-step-inputs") ?: JsonNodeFactory.instance.objectNode()\r
+ val operationInputs = bluePrintRuntimeService!!.get("$stepName-step-inputs")\r
+ ?: JsonNodeFactory.instance.objectNode()\r
\r
operationInputs.fields().forEach {\r
this.operationInputs[it.key] = it.value\r
}\r
\r
nodeTemplateName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE)\r
+ check(nodeTemplateName.isNotEmpty()) { "couldn't get NodeTemplate name for step($stepName)" }\r
+\r
interfaceName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_INTERFACE)\r
+ check(interfaceName.isNotEmpty()) { "couldn't get Interface name for step($stepName)" }\r
+\r
operationName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION)\r
+ check(operationName.isNotEmpty()) { "couldn't get Operation name for step($stepName)" }\r
\r
\r
val operationResolvedProperties = bluePrintRuntimeService!!.resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)\r
\r
this.operationInputs.putAll(operationResolvedProperties)\r
\r
-\r
-\r
return executionServiceInput\r
}\r
\r
executionServiceOutput.commonHeader = executionServiceInput!!.commonHeader\r
\r
// Resolve the Output Expression\r
- val operationResolvedProperties = bluePrintRuntimeService!!\r
+ val stepOutputs = bluePrintRuntimeService!!\r
.resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)\r
\r
- val metadata = executionServiceOutput.metadata\r
- metadata.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, stepName)\r
- metadata.putJsonElement("$stepName-step-outputs", operationResolvedProperties)\r
+ bluePrintRuntimeService!!.put("$stepName-step-outputs", stepOutputs.asJsonNode())\r
\r
// Populate Status\r
val status = Status()\r
}\r
\r
fun getOperationInput(key: String): JsonNode {\r
- return operationInputs.get(key) ?: NullNode.instance\r
+ return operationInputs[key] ?: NullNode.instance\r
}\r
}
\ No newline at end of file
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
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)