summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services/workflow-service
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-19 12:48:31 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-28 19:46:23 -0500
commitd2ec19b59ee0bdc1ba3a22baff5d0d30bd8a9e19 (patch)
treed0ddce3aee20da3f8ea6376b4201d13e5ed1cd83 /ms/blueprintsprocessor/modules/services/workflow-service
parent3f83c10aa60ccecd020b06917de694ec11f544b0 (diff)
Implement Base Jython Executor function.
Change-Id: I3fb066a021de4a7b3aa1fce7f6c191bc3944fb51 Issue-ID: CCSDK-696 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services/workflow-service')
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt10
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt31
3 files changed, 33 insertions, 10 deletions
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
index 8750d98b3..0600f62d2 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
@@ -125,12 +125,6 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
override fun execute(graph: SvcLogicGraph, svcLogicContext: SvcLogicContext): SvcLogicContext {
MDC.put("currentGraph", graph.toString())
- val ctx = svcLogicContext as BlueprintSvcLogicContext
-
- val blueprintRuntimeService = ctx.getBluePrintService()
-
- log.info("Blueprint Runtime Service : ${blueprintRuntimeService}")
-
var curNode: SvcLogicNode? = graph.getRootNode()
log.info("About to execute graph {}", graph.toString())
@@ -138,7 +132,7 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
while (curNode != null) {
MDC.put("nodeId", curNode.nodeId.toString() + " (" + curNode.nodeType + ")")
log.info("About to execute node # {} ({})", curNode.nodeId, curNode.nodeType)
- val nextNode = this.executeNode(curNode, ctx)
+ val nextNode = this.executeNode(curNode, svcLogicContext)
curNode = nextNode
}
} catch (var5: ExitNodeException) {
@@ -147,6 +141,6 @@ class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
MDC.remove("nodeId")
MDC.remove("currentGraph")
- return ctx
+ return svcLogicContext
}
} \ 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 125a1ff6f..ace9f2787 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
@@ -60,6 +60,8 @@ open class ComponentExecuteNodeExecutor : ExecuteNodeExecutor() {
log.info("executing node template($nodeTemplateName) component($componentName)")
// Get the Component Instance
val plugin = this.getComponentFunction(componentName)
+ // Set the Blueprint Service
+ plugin.bluePrintRuntimeService = ctx.getBluePrintService()
val executionInput = ctx.getRequest() as ExecutionServiceInput
// Get the Request from the Context and Set to the Function Input and Invoke the function
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
index 5c90852ee..6fe767ce2 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
@@ -16,11 +16,16 @@
package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
+import com.fasterxml.jackson.databind.JsonNode
import org.junit.Test
import org.junit.runner.RunWith
+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.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
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.putJsonElement
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
@@ -45,7 +50,7 @@ class BlueprintServiceLogicTest {
val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/one-component.xml")
val svcLogicContext = BlueprintSvcLogicContext()
svcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
- svcLogicContext.setRequest(ExecutionServiceInput())
+ svcLogicContext.setRequest(getDefaultExecutionServiceInput())
blueprintSvcLogicService.execute(graph, svcLogicContext)
}
@@ -55,8 +60,30 @@ class BlueprintServiceLogicTest {
val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/two-component.xml")
val svcLogicContext = BlueprintSvcLogicContext()
svcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
- svcLogicContext.setRequest(ExecutionServiceInput())
+ svcLogicContext.setRequest(getDefaultExecutionServiceInput())
blueprintSvcLogicService.execute(graph, svcLogicContext)
}
+
+ private fun getDefaultExecutionServiceInput(): ExecutionServiceInput {
+ val executionServiceInput = ExecutionServiceInput()
+ val commonHeader = CommonHeader()
+ commonHeader.requestId = "1234"
+ executionServiceInput.commonHeader = commonHeader
+
+ val actionIdentifiers = ActionIdentifiers()
+ actionIdentifiers.blueprintName = "baseconfiguration"
+ actionIdentifiers.blueprintVersion = "1.0.0"
+ actionIdentifiers.actionName = "activate"
+ executionServiceInput.actionIdentifiers = actionIdentifiers
+
+ val metaData: MutableMap<String, JsonNode> = hashMapOf()
+ metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP,"resource-assignment-py")
+ metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "resource-assignment-py")
+ metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "DefaultComponentNode")
+ metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ executionServiceInput.metadata = metaData
+
+ return executionServiceInput
+ }
} \ No newline at end of file