summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/services
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-13 16:47:33 -0500
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-11-13 16:47:33 -0500
commitcbbe0eac48b8df6e616f56a8ef51fbc7c955d171 (patch)
treee9a5b4a4bfc2da3e97bfb32094ae8af1bd973c24 /ms/blueprintsprocessor/modules/services
parentb0c989325aff489c06c32fad3aa1c996d5a4b7d6 (diff)
Blueprints Processor Microservice
Implement basic blueprint service logic workflow execution engine. Change-Id: Ifbbad70f2bdc4ba879b07d972083a411c7cc02f1 Issue-ID: CCSDK-672 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'ms/blueprintsprocessor/modules/services')
-rw-r--r--ms/blueprintsprocessor/modules/services/db-service/pom.xml33
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt55
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt46
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/JavaScriptExecuteComponent.kt45
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/PythonExecuteComponent.kt44
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java70
-rw-r--r--ms/blueprintsprocessor/modules/services/pom.xml4
-rw-r--r--ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt35
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml44
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt52
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt152
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt26
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt81
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt35
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt62
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt46
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml34
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml42
18 files changed, 648 insertions, 258 deletions
diff --git a/ms/blueprintsprocessor/modules/services/db-service/pom.xml b/ms/blueprintsprocessor/modules/services/db-service/pom.xml
deleted file mode 100644
index 4ff4d8c07..000000000
--- a/ms/blueprintsprocessor/modules/services/db-service/pom.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright © 2017-2018 AT&T Intellectual Property.
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
- <artifactId>services</artifactId>
- <version>0.4.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>db-service</artifactId>
- <packaging>jar</packaging>
- <name>Blueprints Processor DB Service</name>
- <description>Blueprints Processor DB Service</description>
-
- <dependencies>
- </dependencies>
-</project>
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
new file mode 100644
index 000000000..0e70e490a
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -0,0 +1,55 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
+
+
+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.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.slf4j.LoggerFactory
+
+/**
+ * AbstractComponentFunction
+ * @author Brinda Santh
+ */
+abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServiceInput, ExecutionServiceOutput> {
+ private val log = LoggerFactory.getLogger(AbstractComponentFunction::class.java)
+
+ override fun prepareRequest(executionRequest: ExecutionServiceInput): ExecutionServiceInput {
+ log.info("prepareRequest...")
+ return executionRequest
+ }
+
+ override fun process(executionRequest: ExecutionServiceInput) {
+ log.info("Processing...")
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ log.info("Recovering...")
+ }
+
+ override fun prepareResponse(): ExecutionServiceOutput {
+ log.info("Preparing Response...")
+ return ExecutionServiceOutput()
+ }
+
+ override fun apply(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+ prepareRequest(executionServiceInput)
+ process(executionServiceInput)
+ return prepareResponse()
+ }
+} \ 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/ExecutionService.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt
deleted file mode 100644
index 75b26bb55..000000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
-
-
-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.core.api.data.Status
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
-import org.springframework.stereotype.Service
-import com.fasterxml.jackson.databind.node.ObjectNode
-
-/**
- * ExecutionService
- * @author Brinda Santh
- * 8/14/2018
- */
-@Service
-class ExecutionService {
-
- fun process(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
- val executionServiceOutput = ExecutionServiceOutput()
- executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers
- executionServiceOutput.commonHeader = executionServiceInput.commonHeader
- executionServiceOutput.payload = JacksonUtils.jsonNode("{}") as ObjectNode
- val status = Status()
- status.code = 200
- status.message = "Success"
- executionServiceOutput.status = status
- return executionServiceOutput
- }
-} \ 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/JavaScriptExecuteComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/JavaScriptExecuteComponent.kt
deleted file mode 100644
index 427dc873a..000000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/JavaScriptExecuteComponent.kt
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ComponentNode
-import org.springframework.stereotype.Component
-
-/**
- * JavaScriptExecuteComponent
- *
- * @author Brinda Santh
- */
-@Component("component-javascript-executor")
-class JavaScriptExecuteComponent : ComponentNode {
-
- override fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-} \ 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/PythonExecuteComponent.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/PythonExecuteComponent.kt
deleted file mode 100644
index 59be1f517..000000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/PythonExecuteComponent.kt
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright © 2018 IBM.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
-
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ComponentNode
-import org.springframework.stereotype.Component
-
-/**
- * PythonExecuteComponent
- *
- * @author Brinda Santh
- */
-@Component("component-python-executor")
-class PythonExecuteComponent : ComponentNode {
- override fun validate(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun process(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun errorHandle(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-
- override fun reTrigger(context: MutableMap<String, Any>, componentContext: MutableMap<String, Any?>) {
- TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java b/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java
deleted file mode 100644
index 0df95d2d3..000000000
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.commons.io.FileUtils;
-import org.junit.Assert;
-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.core.api.data.ExecutionServiceOutput;
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import java.io.File;
-import java.nio.charset.Charset;
-
-
-/**
- * ExecutionServiceTest
- *
- * @author Brinda Santh
- * DATE : 8/15/2018
- */
-@RunWith(SpringRunner.class)
-@ContextConfiguration(classes = ExecutionService.class)
-public class ExecutionServiceTest {
- private static Logger log = LoggerFactory.getLogger(ExecutionServiceTest.class);
-
- @Autowired
- private ExecutionService executionService;
-
- @Test
- public void testExecutionService() throws Exception {
-
- Assert.assertNotNull("failed to create ResourceResolutionService", executionService);
-
- String resourceResolutionInputContent = FileUtils.readFileToString(
- new File("src/test/resources/payload/requests/sample-execution-request.json"), Charset.defaultCharset());
-
- ExecutionServiceInput executionServiceInput = JacksonUtils.readValue(resourceResolutionInputContent, ExecutionServiceInput.class );
- Assert.assertNotNull("failed to populate executionServiceInput request ",executionServiceInput);
-
- ObjectNode inputContent = (ObjectNode)JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");
- Assert.assertNotNull("failed to populate input payload ",inputContent);
- executionServiceInput.setPayload(inputContent);
-
- ExecutionServiceOutput executionServiceOutput = executionService.process(executionServiceInput);
- Assert.assertNotNull("failed to populate output",executionServiceOutput);
-
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/pom.xml b/ms/blueprintsprocessor/modules/services/pom.xml
index eb3bda08d..d175f129f 100644
--- a/ms/blueprintsprocessor/modules/services/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/pom.xml
@@ -29,9 +29,9 @@
<packaging>pom</packaging>
<modules>
- <module>db-service</module>
- <module>resolution-service</module>
<module>execution-service</module>
+ <module>resolution-service</module>
+ <module>workflow-service</module>
</modules>
<dependencies>
diff --git a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt
index d442c96be..3ee7e41ff 100644
--- a/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt
@@ -17,12 +17,11 @@
package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.BlueprintProcessorException
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status
-import org.onap.ccsdk.apps.controllerblueprints.core.format
+import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment
import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.BulkResourceSequencingUtils
import org.springframework.stereotype.Service
@@ -59,22 +58,22 @@ class ResourceResolutionService(private val resourceAssignmentProcessorFactory:
val bulkSequenced = BulkResourceSequencingUtils.process(resourceAssignments)
bulkSequenced.map { batchResourceAssignments ->
- batchResourceAssignments.filter { it.name != "*" && it.name != "start"}
- .map { resourceAssignment ->
- val dictionarySource = resourceAssignment.dictionarySource
- val processorInstanceName = "resource-assignment-processor-".plus(dictionarySource)
- val resourceAssignmentProcessor = resourceAssignmentProcessorFactory.getInstance(processorInstanceName)
- ?: throw BlueprintProcessorException(format("failed to get resource processor for instance name({}) " +
- "for resource assignment({})", processorInstanceName, resourceAssignment.name))
- try {
- resourceAssignmentProcessor.validate(resourceAssignment, context)
- resourceAssignmentProcessor.process(resourceAssignment, context)
- } catch (e: Exception) {
- resourceAssignmentProcessor.errorHandle(resourceAssignment, context)
- throw BlueprintProcessorException(e)
- }
+ batchResourceAssignments.filter { it.name != "*" && it.name != "start" }
+ .map { resourceAssignment ->
+ val dictionarySource = resourceAssignment.dictionarySource
+ val processorInstanceName = "resource-assignment-processor-".plus(dictionarySource)
+ val resourceAssignmentProcessor = resourceAssignmentProcessorFactory.getInstance(processorInstanceName)
+ ?: throw BluePrintProcessorException("failed to get resource processor for instance name($processorInstanceName) " +
+ "for resource assignment(${resourceAssignment.name})")
+ try {
+ resourceAssignmentProcessor.validate(resourceAssignment, context)
+ resourceAssignmentProcessor.process(resourceAssignment, context)
+ } catch (e: Exception) {
+ resourceAssignmentProcessor.errorHandle(resourceAssignment, context)
+ throw BluePrintProcessorException(e)
+ }
- }
+ }
}
}
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
new file mode 100644
index 000000000..5809c06d5
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>services</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>workflow-service</artifactId>
+ <name>Blueprints Processor Workflow Service</name>
+ <description>Blueprints Processor Workflow Service</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+ <artifactId>execution-service</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ </dependency>
+ </dependencies>
+
+
+</project> \ 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/BlueprintSvcLogicContext.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
new file mode 100644
index 000000000..d2648c079
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
+
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext
+
+class BlueprintSvcLogicContext : SvcLogicContext() {
+
+ private var bluePrintRuntimeService: BluePrintRuntimeService<*>? = null
+ private var request: Any? = null
+ private var response: Any? = null
+
+ fun getBluePrintService(): BluePrintRuntimeService<*> {
+ return this.bluePrintRuntimeService!!
+ }
+
+ fun setBluePrintRuntimeService(bluePrintRuntimeService: BluePrintRuntimeService<*>) {
+ this.bluePrintRuntimeService = bluePrintRuntimeService
+ }
+
+ fun setRequest(request: Any) {
+ this.request = request
+ }
+
+ fun getRequest(): Any {
+ return this.request!!
+ }
+
+ fun setResponse(response: Any) {
+ this.response = response
+ }
+
+ fun getResponse(): Any {
+ return this.response!!
+ }
+
+} \ 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/BlueprintSvcLogicService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
new file mode 100644
index 000000000..8750d98b3
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt
@@ -0,0 +1,152 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
+
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
+import org.onap.ccsdk.sli.core.sli.*
+import org.onap.ccsdk.sli.core.sli.provider.*
+import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker
+import org.slf4j.LoggerFactory
+import org.slf4j.MDC
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.stereotype.Service
+import java.util.*
+import javax.annotation.PostConstruct
+
+interface BlueprintSvcLogicService : SvcLogicService {
+
+ fun registerDefaultExecutors()
+
+ fun registerExecutors(name: String, svcLogicNodeExecutor: SvcLogicNodeExecutor)
+
+ fun unRegisterExecutors(name: String)
+
+ fun execute(graph: SvcLogicGraph, bluePrintRuntimeService: BluePrintRuntimeService<*>): Any
+
+ @Deprecated("Populate Graph Dynamically from Blueprints, No need to get from Database Store ")
+ override fun getStore(): SvcLogicStore {
+ TODO("not implemented")
+ }
+
+ @Deprecated("Not used in Micro service Implementation")
+ override fun hasGraph(module: String, rpc: String, version: String?, mode: String): Boolean {
+ TODO("not implemented")
+ }
+
+ @Deprecated("Not used in Micro service Implementation")
+ override fun execute(p0: String?, p1: String?, p2: String?, p3: String?, p4: Properties?): Properties {
+ TODO("not implemented")
+ }
+
+ @Deprecated("Not used in Micro service Implementation")
+ override fun execute(p0: String?, p1: String?, p2: String?, p3: String?, p4: Properties?, p5: DOMDataBroker?): Properties {
+ TODO("not implemented")
+ }
+}
+
+
+@Service
+class DefaultBlueprintSvcLogicService : BlueprintSvcLogicService {
+
+ private val log = LoggerFactory.getLogger(DefaultBlueprintSvcLogicService::class.java)
+
+ private val nodeExecutors: MutableMap<String, SvcLogicNodeExecutor> = hashMapOf()
+
+ @Autowired
+ private lateinit var context: ApplicationContext
+
+ @PostConstruct
+ override fun registerDefaultExecutors() {
+
+ val executeNodeExecutor = context.getBean(ExecuteNodeExecutor::class.java)
+ registerExecutors("execute", executeNodeExecutor)
+ registerExecutors("block", BlockNodeExecutor())
+ registerExecutors("return", ReturnNodeExecutor())
+ registerExecutors("break", BreakNodeExecutor())
+ registerExecutors("exit", ExitNodeExecutor())
+ }
+
+ override fun registerExecutors(name: String, svcLogicNodeExecutor: SvcLogicNodeExecutor) {
+ log.info("Registering executors($name) with type(${svcLogicNodeExecutor.javaClass}")
+ nodeExecutors.put(name, svcLogicNodeExecutor)
+ }
+
+ override fun unRegisterExecutors(name: String) {
+ if (nodeExecutors.containsKey(name)) {
+ log.info("UnRegistering executors($name)")
+ nodeExecutors.remove(name)
+ }
+ }
+
+ override fun execute(graph: SvcLogicGraph, bluePrintRuntimeService: BluePrintRuntimeService<*>): Any {
+ //Initialise BlueprintSvcLogic Context
+ val blueprintSvcLogicContext = BlueprintSvcLogicContext()
+ blueprintSvcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
+ // Execute the Graph
+ execute(graph, blueprintSvcLogicContext)
+ // Get the Response
+ return blueprintSvcLogicContext.getResponse()
+ }
+
+ override fun executeNode(node: SvcLogicNode?, ctx: SvcLogicContext): SvcLogicNode? {
+ if (node == null) {
+ return null
+ } else {
+ if (log.isDebugEnabled()) {
+ log.debug("Executing node {}", node.getNodeId())
+ }
+
+ val executor = this.nodeExecutors[node.getNodeType()]
+
+ if (executor != null) {
+ log.debug("Executing node executor for node type {} - {}", node.getNodeType(), executor.javaClass.name)
+ return executor.execute(this, node, ctx)
+ } else {
+ throw SvcLogicException("Attempted to execute a node of type " + node.getNodeType() + ", but no executor was registered for this type")
+ }
+ }
+ }
+
+ 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())
+
+ try {
+ 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)
+ curNode = nextNode
+ }
+ } catch (var5: ExitNodeException) {
+ log.debug("SvcLogicServiceImpl caught ExitNodeException")
+ }
+
+ MDC.remove("nodeId")
+ MDC.remove("currentGraph")
+ return ctx
+ }
+} \ 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/WorkflowServiceConfiguration.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
new file mode 100644
index 000000000..b9c041e9c
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt
@@ -0,0 +1,26 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
+
+import org.springframework.context.annotation.ComponentScan
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+@ComponentScan
+open class WorkflowServiceConfiguration {
+
+} \ 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
new file mode 100644
index 000000000..125a1ff6f
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.BlueprintSvcLogicContext
+import org.onap.ccsdk.sli.core.sli.SvcLogicContext
+import org.onap.ccsdk.sli.core.sli.SvcLogicException
+import org.onap.ccsdk.sli.core.sli.SvcLogicNode
+import org.onap.ccsdk.sli.core.sli.provider.ExecuteNodeExecutor
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicExpressionResolver
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService
+import org.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.context.ApplicationContext
+import org.springframework.stereotype.Service
+
+@Service
+open class ComponentExecuteNodeExecutor : ExecuteNodeExecutor() {
+
+ private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
+
+ @Autowired
+ private lateinit var context: ApplicationContext
+
+ fun getComponentFunction(pluginName: String): AbstractComponentFunction {
+ return context.getBean(pluginName, AbstractComponentFunction::class.java)
+ }
+
+ @Throws(SvcLogicException::class)
+ override fun execute(svc: SvcLogicService, node: SvcLogicNode, svcLogicContext: SvcLogicContext): SvcLogicNode {
+
+ var outValue: String
+
+ val ctx = svcLogicContext as BlueprintSvcLogicContext
+
+ val nodeTemplateName = SvcLogicExpressionResolver.evaluate(node.getAttribute("plugin"), node, ctx)
+
+ try {
+ // Get the Blueprint Context
+ val blueprintContext = ctx.getBluePrintService().bluePrintContext()
+ // Get the Component Name, NodeTemplate type is mapped to Component Name
+ val componentName = blueprintContext.nodeTemplateByName(nodeTemplateName).type
+
+ log.info("executing node template($nodeTemplateName) component($componentName)")
+ // Get the Component Instance
+ val plugin = this.getComponentFunction(componentName)
+
+ val executionInput = ctx.getRequest() as ExecutionServiceInput
+ // Get the Request from the Context and Set to the Function Input and Invoke the function
+ val executionOutput = plugin.apply(executionInput)
+
+ ctx.setResponse(executionOutput)
+
+ outValue = executionOutput.status.message
+ ctx.status = executionOutput.status.message
+
+ } catch (e: Exception) {
+ this.log.error("Could not execute plugin($nodeTemplateName) : ", e)
+ outValue = "failure"
+ ctx.status = "failure"
+ }
+
+ return this.getNextNode(node, outValue)
+ }
+} \ 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/utils/SvcGraphUtils.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
new file mode 100644
index 000000000..ada36ac0b
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.utils
+
+import org.onap.ccsdk.sli.core.sli.SvcLogicGraph
+import org.onap.ccsdk.sli.core.sli.SvcLogicParser
+
+object SvcGraphUtils {
+
+ @JvmStatic
+ fun getSvcGraphFromClassPathFile(fileName: String): SvcLogicGraph {
+ val url = SvcGraphUtils::class.java.classLoader.getResource(fileName)
+ return getSvcGraphFromFile(url.path)
+ }
+
+ @JvmStatic
+ fun getSvcGraphFromFile(fileName: String): SvcLogicGraph {
+ val svcLogicParser = SvcLogicParser()
+ return svcLogicParser.parse(fileName).first
+ }
+} \ No newline at end of file
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
new file mode 100644
index 000000000..5c90852ee
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
@@ -0,0 +1,62 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
+
+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.slf4j.LoggerFactory
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.junit4.SpringRunner
+
+@RunWith(SpringRunner::class)
+@ContextConfiguration(classes = [WorkflowServiceConfiguration::class, ComponentExecuteNodeExecutor::class])
+class BlueprintServiceLogicTest {
+
+ private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java)
+
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+
+ @Autowired
+ lateinit var blueprintSvcLogicService: BlueprintSvcLogicService
+
+ @Test
+ fun testExecuteGraphWithSingleComponent() {
+
+ val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/one-component.xml")
+ val svcLogicContext = BlueprintSvcLogicContext()
+ svcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
+ svcLogicContext.setRequest(ExecutionServiceInput())
+ blueprintSvcLogicService.execute(graph, svcLogicContext)
+
+ }
+
+ @Test
+ fun testExecuteGraphWithMultipleComponents() {
+ val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/two-component.xml")
+ val svcLogicContext = BlueprintSvcLogicContext()
+ svcLogicContext.setBluePrintRuntimeService(bluePrintRuntimeService)
+ svcLogicContext.setRequest(ExecutionServiceInput())
+ blueprintSvcLogicService.execute(graph, svcLogicContext)
+
+ }
+} \ No newline at end of file
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
new file mode 100644
index 000000000..5787721ca
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
@@ -0,0 +1,46 @@
+/*
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+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.services.execution.AbstractComponentFunction
+import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
+import org.slf4j.LoggerFactory
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+
+@Configuration
+open class MockComponentConfiguration {
+
+ @Bean(name = ["component-resource-assignment", "component-netconf-executor"])
+ open fun createComponentFunction(): AbstractComponentFunction {
+ return MockComponentFunction()
+ }
+}
+
+class MockComponentFunction : AbstractComponentFunction() {
+
+ private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
+
+ override fun process(executionRequest: ExecutionServiceInput) {
+ super.process(executionRequest)
+ }
+
+ override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
+ super.recover(runtimeException, executionRequest)
+ }
+} \ 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
new file mode 100644
index 000000000..5ff26ad2c
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml
@@ -0,0 +1,34 @@
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'>
+ <method rpc='ActivateNetconf' mode='sync'>
+ <block atomic="true">
+ <execute plugin="resource-assignment" method="process">
+ <outcome value='failure'>
+ <return status="failure">
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <return status='success'>
+ </return>
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic> \ 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
new file mode 100644
index 000000000..7de61db57
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml
@@ -0,0 +1,42 @@
+<!--
+ ~ Copyright © 2017-2018 AT&T Intellectual Property.
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<service-logic
+ xmlns='http://www.onap.org/sdnc/svclogic'
+ xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='CONFIG' version='1.0.0'>
+ <method rpc='ResourceAssignAndActivate' mode='sync'>
+ <block atomic="true">
+ <execute plugin="resource-assignment" method="process">
+ <outcome value='failure'>
+ <return status="failure">
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <execute plugin="resource-assignment-py" method="process">
+ <outcome value='failure'>
+ <return status="failure">
+ </return>
+ </outcome>
+ <outcome value='success'>
+ <return status='success'>
+ </return>
+ </outcome>
+ </execute>
+ </outcome>
+ </execute>
+ </block>
+ </method>
+</service-logic> \ No newline at end of file