From 809ef53debb3fd10de78e640e4a1626626eb8373 Mon Sep 17 00:00:00 2001 From: "Muthuramalingam, Brinda Santh(bs2796)" Date: Tue, 4 Dec 2018 10:25:44 -0500 Subject: Add Blueprint Runtime Input/Output logic Change-Id: I0355e78862096b7b4074faa882d66ce27d6e1844 Issue-ID: CCSDK-670 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) --- .../workflow/BlueprintDGExecutionServiceTest.kt | 2 +- .../services/workflow/BlueprintServiceLogicTest.kt | 26 ++++++++------ .../workflow/mock/MockComponentFunction.kt | 12 +++---- .../execution-input/assign-activate-input.json | 23 ++++++++++++ .../resources/execution-input/default-input.json | 20 ----------- .../execution-input/resource-assignment-input.json | 23 ++++++++++++ .../test/resources/service-logic/one-component.xml | 34 ------------------ .../test/resources/service-logic/two-component.xml | 42 ---------------------- 8 files changed, 68 insertions(+), 114 deletions(-) create mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json delete mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json create mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json delete mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml delete mode 100644 ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml (limited to 'ms/blueprintsprocessor/modules/services/workflow-service/src/test') diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt index 46bb6f087..2d0dff53b 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt @@ -43,7 +43,7 @@ class BlueprintDGExecutionServiceTest { val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration") - val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!! + val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!! blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput) 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 341b6f840..2c1c40c9c 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 @@ -20,7 +20,6 @@ import org.junit.Test import org.junit.runner.RunWith 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.utils.BluePrintMetadataUtils import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils import org.slf4j.LoggerFactory @@ -34,26 +33,31 @@ class BlueprintServiceLogicTest { private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java) - val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", - "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration") - - val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!! - @Autowired - lateinit var blueprintSvcLogicService: BlueprintSvcLogicService + lateinit var blueprintDGExecutionService: BlueprintDGExecutionService @Test fun testExecuteGraphWithSingleComponent() { - val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/one-component.xml") - blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput) + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", + "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration") + + val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!! + + + blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput) } @Test fun testExecuteGraphWithMultipleComponents() { - val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/two-component.xml") - blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput) + + val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234", + "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration") + + val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/assign-activate-input.json", ExecutionServiceInput::class.java)!! + + blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput) } diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt index 747be76c0..9f7a9c974 100644 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt @@ -17,9 +17,8 @@ package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock 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.execution.AbstractComponentFunction -import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor +import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive import org.slf4j.LoggerFactory import org.springframework.context.annotation.Bean import org.springframework.context.annotation.Configuration @@ -27,7 +26,7 @@ import org.springframework.context.annotation.Configuration @Configuration open class MockComponentConfiguration { - @Bean(name = ["component-resource-assignment", "component-netconf-executor"]) + @Bean(name = ["component-resource-assignment", "component-netconf-executor", "component-jython-executor"]) open fun createComponentFunction(): AbstractComponentFunction { return MockComponentFunction() } @@ -35,12 +34,13 @@ open class MockComponentConfiguration { class MockComponentFunction : AbstractComponentFunction() { - private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java) + private val log = LoggerFactory.getLogger(MockComponentFunction::class.java) override fun process(executionRequest: ExecutionServiceInput) { - log.info("Processing component..") + log.info("Processing component : ${operationInputs}") - this.executionServiceOutput = ExecutionServiceOutput() + bluePrintRuntimeService!!.setNodeTemplateAttributeValue(nodeTemplateName, + "assignment-params", "params".asJsonPrimitive()) } override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json new file mode 100644 index 000000000..d63b1d318 --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json @@ -0,0 +1,23 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "1234", + "subRequestId": "1234-12234" + }, + "actionIdentifiers": { + "blueprintName": "baseconfiguration", + "blueprintVersion": "1.0.0", + "actionName": "assign-activate", + "mode": "sync" + }, + "payload": { + "assign-activate-request": { + "assign-activate-properties": { + "request-id": "1234", + "action-name": "assign-activate", + "scope-type": "vnf-type", + "hostname": "localhost" + } + } + } +} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json deleted file mode 100644 index 20401fd1c..000000000 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "commonHeader" : { - "originatorId" : "System", - "requestId" : "1234", - "subRequestId" : "1234-12234" - }, - "actionIdentifiers" : { - "blueprintName" : "baseconfiguration", - "blueprintVersion" : "1.0.0", - "actionName" : "activate", - "mode" : "sync" - }, - "payload" : { }, - "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/workflow-service/src/test/resources/execution-input/resource-assignment-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json new file mode 100644 index 000000000..ce7bc8e5a --- /dev/null +++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json @@ -0,0 +1,23 @@ +{ + "commonHeader": { + "originatorId": "System", + "requestId": "1234", + "subRequestId": "1234-12234" + }, + "actionIdentifiers": { + "blueprintName": "baseconfiguration", + "blueprintVersion": "1.0.0", + "actionName": "resource-assignment", + "mode": "sync" + }, + "payload": { + "resource-assignment-request": { + "resource-assignment-properties": { + "request-id": "1234", + "action-name": "resource-assignment", + "scope-type": "vnf-type", + "hostname": "localhost" + } + } + } +} \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml deleted file mode 100644 index 5ff26ad2c..000000000 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml deleted file mode 100644 index 7de61db57..000000000 --- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file -- cgit 1.2.3-korg