Blueprints Processor Microservice
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Tue, 13 Nov 2018 21:47:33 +0000 (16:47 -0500)
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Tue, 13 Nov 2018 21:47:33 +0000 (16:47 -0500)
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>
26 files changed:
ms/blueprintsprocessor/modules/commons/adaptors/pom.xml [deleted file]
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorData.kt
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorException.kt [deleted file]
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ComponentNodeFactory.kt
ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt
ms/blueprintsprocessor/modules/commons/pom.xml
ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/java/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceController.java
ms/blueprintsprocessor/modules/services/db-service/pom.xml [deleted file]
ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionService.kt [deleted file]
ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/JavaScriptExecuteComponent.kt [deleted file]
ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/PythonExecuteComponent.kt [deleted file]
ms/blueprintsprocessor/modules/services/execution-service/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/ExecutionServiceTest.java [deleted file]
ms/blueprintsprocessor/modules/services/pom.xml
ms/blueprintsprocessor/modules/services/resolution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionService.kt
ms/blueprintsprocessor/modules/services/workflow-service/pom.xml [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicContext.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintSvcLogicService.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/WorkflowServiceConfiguration.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/utils/SvcGraphUtils.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml [new file with mode: 0644]
ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml [new file with mode: 0644]
ms/blueprintsprocessor/parent/pom.xml

diff --git a/ms/blueprintsprocessor/modules/commons/adaptors/pom.xml b/ms/blueprintsprocessor/modules/commons/adaptors/pom.xml
deleted file mode 100644 (file)
index 410111b..0000000
+++ /dev/null
@@ -1,34 +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>commons</artifactId>
-               <version>0.4.0-SNAPSHOT</version>
-       </parent>
-
-       <artifactId>adaptors</artifactId>
-       <packaging>pom</packaging>
-       <name>Blueprints Processor Adaptors POM</name>
-       <description>Blueprints Processor Adaptors</description>
-       <modules>
-
-       </modules>
-
-</project>
index dc93825..45f684f 100644 (file)
@@ -67,7 +67,7 @@ open class ExecutionServiceOutput {
     @get:ApiModelProperty(required = true)\r
     lateinit var actionIdentifiers: ActionIdentifiers\r
     @get:ApiModelProperty(required = true)\r
-    lateinit var status: Status\r
+    var status: Status = Status()\r
     @get:ApiModelProperty(required = true)\r
     lateinit var payload: ObjectNode\r
     var metadata: MutableMap<String, JsonNode> = hashMapOf()\r
@@ -110,7 +110,7 @@ open class Status {
     @get:ApiModelProperty(required = false)\r
     var errorMessage: String? = null\r
     @get:ApiModelProperty(required = true)\r
-    lateinit var message: String\r
+    var message: String = "success"\r
 }\r
 \r
 \r
diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorException.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/api/data/BlueprintProcessorException.kt
deleted file mode 100644 (file)
index df4d670..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*\r
- *  Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.blueprintsprocessor.core.api.data\r
-\r
-/**\r
- * BlueprintProcessorException\r
- * @author Brinda Santh\r
- * DATE : 8/15/2018\r
- */\r
-open class BlueprintProcessorException : Exception {\r
-    var code: Int = 100\r
-\r
-    constructor(cause: Throwable) : super(cause)\r
-    constructor(message: String) : super(message)\r
-    constructor(message: String, cause: Throwable) : super(message, cause)\r
-    constructor(cause: Throwable, message: String, vararg args: Any?) : super(String.format(message, *args), cause)\r
-\r
-    constructor(code: Int, cause: Throwable) : super(cause) {\r
-        this.code = code\r
-    }\r
-\r
-    constructor(code: Int, message: String) : super(message) {\r
-        this.code = code\r
-    }\r
-\r
-    constructor(code: Int, message: String, cause: Throwable) : super(message, cause) {\r
-        this.code = code\r
-    }\r
-\r
-    constructor(code: Int, cause: Throwable, message: String, vararg args: Any?)\r
-            : super(String.format(message, *args), cause) {\r
-        this.code = code\r
-    }\r
-}
\ No newline at end of file
index feacbca..66643ee 100644 (file)
@@ -21,7 +21,6 @@ import com.att.eelf.configuration.EELFManager
 import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException\r
 import org.springframework.context.ApplicationContext\r
 import org.springframework.context.ApplicationContextAware\r
-import org.springframework.stereotype.Service\r
 \r
 /**\r
  * ComponentNode\r
@@ -48,7 +47,6 @@ interface ComponentNode {
  *\r
  * @author Brinda Santh\r
  */\r
-@Service\r
 open class ComponentNodeFactory : ApplicationContextAware {\r
     private val log = EELFManager.getInstance().getLogger(ComponentNodeFactory::class.java)\r
 \r
index 01a110d..80ad0e6 100644 (file)
@@ -21,14 +21,14 @@ import com.att.eelf.configuration.EELFManager
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor\r
 import org.springframework.context.ApplicationContext\r
 import org.springframework.context.ApplicationContextAware\r
-import org.springframework.stereotype.Service\r
+import org.springframework.context.annotation.Configuration\r
 \r
 /**\r
  * ResourceAssignmentProcessorFactory\r
  *\r
  * @author Brinda Santh\r
  */\r
-@Service\r
+@Configuration\r
 open class ResourceAssignmentProcessorFactory : ApplicationContextAware {\r
 \r
     private val log = EELFManager.getInstance().getLogger(ResourceAssignmentProcessorFactory::class.java)\r
index 299a87d..c080f81 100644 (file)
@@ -31,7 +31,6 @@
     <modules>
         <module>db-lib</module>
         <module>rest-lib</module>
-        <module>adaptors</module>
         <module>core</module>
     </modules>
     <dependencies>
index 75407c5..3b5dfab 100644 (file)
@@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api;
 import io.swagger.annotations.ApiOperation;\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput;\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput;\r
-import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.ExecutionService;\r
 import org.springframework.http.MediaType;\r
 import org.springframework.web.bind.annotation.*;\r
 import reactor.core.publisher.Mono;\r
@@ -33,11 +32,6 @@ import reactor.core.publisher.Mono;
 @RequestMapping("/api/v1/execution-service")\r
 public class ExecutionServiceController {\r
 \r
-    private ExecutionService executionService;\r
-\r
-    public ExecutionServiceController(ExecutionService executionService) {\r
-        this.executionService = executionService;\r
-    }\r
 \r
     @RequestMapping(path = "/ping", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)\r
     public @ResponseBody\r
@@ -50,6 +44,6 @@ public class ExecutionServiceController {
             notes = "Takes the blueprint information and process as per the payload")\r
     public @ResponseBody\r
     Mono<ExecutionServiceOutput> process(@RequestBody ExecutionServiceInput executionServiceInput) {\r
-        return Mono.just(executionService.process(executionServiceInput));\r
+        return Mono.just(new ExecutionServiceOutput());\r
     }\r
 }\r
diff --git a/ms/blueprintsprocessor/modules/services/db-service/pom.xml b/ms/blueprintsprocessor/modules/services/db-service/pom.xml
deleted file mode 100644 (file)
index 4ff4d8c..0000000
+++ /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 (file)
index 0000000..0e70e49
--- /dev/null
@@ -0,0 +1,55 @@
+/*\r
+ *  Copyright © 2017-2018 AT&T Intellectual Property.\r
+ *\r
+ *  Licensed under the Apache License, Version 2.0 (the "License");\r
+ *  you may not use this file except in compliance with the License.\r
+ *  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ *  Unless required by applicable law or agreed to in writing, software\r
+ *  distributed under the License is distributed on an "AS IS" BASIS,\r
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ *  See the License for the specific language governing permissions and\r
+ *  limitations under the License.\r
+ */\r
+\r
+package org.onap.ccsdk.apps.blueprintsprocessor.services.execution\r
+\r
+\r
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput\r
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput\r
+import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode\r
+import org.slf4j.LoggerFactory\r
+\r
+/**\r
+ * AbstractComponentFunction\r
+ * @author Brinda Santh\r
+ */\r
+abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServiceInput, ExecutionServiceOutput> {\r
+    private val log = LoggerFactory.getLogger(AbstractComponentFunction::class.java)\r
+\r
+    override fun prepareRequest(executionRequest: ExecutionServiceInput): ExecutionServiceInput {\r
+        log.info("prepareRequest...")\r
+        return executionRequest\r
+    }\r
+\r
+    override fun process(executionRequest: ExecutionServiceInput) {\r
+        log.info("Processing...")\r
+    }\r
+\r
+    override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {\r
+        log.info("Recovering...")\r
+    }\r
+\r
+    override fun prepareResponse(): ExecutionServiceOutput {\r
+        log.info("Preparing Response...")\r
+        return ExecutionServiceOutput()\r
+    }\r
+\r
+    override fun apply(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {\r
+        prepareRequest(executionServiceInput)\r
+        process(executionServiceInput)\r
+        return prepareResponse()\r
+    }\r
+}
\ 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 (file)
index 75b26bb..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*\r
- *  Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution\r
-\r
-\r
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput\r
-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.utils.JacksonUtils\r
-import org.springframework.stereotype.Service\r
-import com.fasterxml.jackson.databind.node.ObjectNode\r
-\r
-/**\r
- * ExecutionService\r
- * @author Brinda Santh\r
- * 8/14/2018\r
- */\r
-@Service\r
-class ExecutionService {\r
-\r
-    fun process(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {\r
-        val executionServiceOutput = ExecutionServiceOutput()\r
-        executionServiceOutput.actionIdentifiers = executionServiceInput.actionIdentifiers\r
-        executionServiceOutput.commonHeader = executionServiceInput.commonHeader\r
-        executionServiceOutput.payload = JacksonUtils.jsonNode("{}") as ObjectNode\r
-        val status = Status()\r
-        status.code = 200\r
-        status.message = "Success"\r
-        executionServiceOutput.status = status\r
-        return executionServiceOutput\r
-    }\r
-}
\ 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 (file)
index 427dc87..0000000
+++ /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 (file)
index 59be1f5..0000000
+++ /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 (file)
index 0df95d2..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*\r
- *  Copyright © 2017-2018 AT&T Intellectual Property.\r
- *\r
- *  Licensed under the Apache License, Version 2.0 (the "License");\r
- *  you may not use this file except in compliance with the License.\r
- *  You may obtain a copy of the License at\r
- *\r
- *      http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- *  Unless required by applicable law or agreed to in writing, software\r
- *  distributed under the License is distributed on an "AS IS" BASIS,\r
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- *  See the License for the specific language governing permissions and\r
- *  limitations under the License.\r
- */\r
-\r
-package org.onap.ccsdk.apps.blueprintsprocessor.services.execution;\r
-\r
-import com.fasterxml.jackson.databind.node.ObjectNode;\r
-import org.apache.commons.io.FileUtils;\r
-import org.junit.Assert;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput;\r
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput;\r
-import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.test.context.ContextConfiguration;\r
-import org.springframework.test.context.junit4.SpringRunner;\r
-\r
-import java.io.File;\r
-import java.nio.charset.Charset;\r
-\r
-\r
-/**\r
- * ExecutionServiceTest\r
- *\r
- * @author Brinda Santh\r
- * DATE : 8/15/2018\r
- */\r
-@RunWith(SpringRunner.class)\r
-@ContextConfiguration(classes = ExecutionService.class)\r
-public class ExecutionServiceTest {\r
-    private static Logger log = LoggerFactory.getLogger(ExecutionServiceTest.class);\r
-\r
-    @Autowired\r
-    private ExecutionService executionService;\r
-\r
-    @Test\r
-    public void testExecutionService() throws Exception {\r
-\r
-        Assert.assertNotNull("failed to create ResourceResolutionService", executionService);\r
-\r
-        String resourceResolutionInputContent = FileUtils.readFileToString(\r
-                new File("src/test/resources/payload/requests/sample-execution-request.json"), Charset.defaultCharset());\r
-\r
-        ExecutionServiceInput executionServiceInput = JacksonUtils.readValue(resourceResolutionInputContent, ExecutionServiceInput.class );\r
-        Assert.assertNotNull("failed to populate executionServiceInput request ",executionServiceInput);\r
-\r
-        ObjectNode inputContent = (ObjectNode)JacksonUtils.jsonNodeFromFile("src/test/resources/payload/inputs/input.json");\r
-        Assert.assertNotNull("failed to populate input payload ",inputContent);\r
-        executionServiceInput.setPayload(inputContent);\r
-\r
-        ExecutionServiceOutput executionServiceOutput = executionService.process(executionServiceInput);\r
-        Assert.assertNotNull("failed to populate output",executionServiceOutput);\r
-\r
-    }\r
-}
\ No newline at end of file
index eb3bda0..d175f12 100644 (file)
@@ -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>
index d442c96..3ee7e41 100644 (file)
 \r
 package org.onap.ccsdk.apps.blueprintsprocessor.services.resolution\r
 \r
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.BlueprintProcessorException\r
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionOutput\r
 import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.Status\r
-import org.onap.ccsdk.apps.controllerblueprints.core.format\r
+import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory\r
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignment\r
 import org.onap.ccsdk.apps.controllerblueprints.resource.dict.utils.BulkResourceSequencingUtils\r
 import org.springframework.stereotype.Service\r
@@ -59,22 +58,22 @@ class ResourceResolutionService(private val resourceAssignmentProcessorFactory:
         val bulkSequenced = BulkResourceSequencingUtils.process(resourceAssignments)\r
 \r
         bulkSequenced.map { batchResourceAssignments ->\r
-            batchResourceAssignments.filter { it.name != "*" && it.name != "start"}\r
-            .map { resourceAssignment ->\r
-                val dictionarySource = resourceAssignment.dictionarySource\r
-                val processorInstanceName = "resource-assignment-processor-".plus(dictionarySource)\r
-                val resourceAssignmentProcessor = resourceAssignmentProcessorFactory.getInstance(processorInstanceName)\r
-                        ?: throw BlueprintProcessorException(format("failed to get resource processor for instance name({}) " +\r
-                                "for resource assignment({})", processorInstanceName, resourceAssignment.name))\r
-                try {\r
-                    resourceAssignmentProcessor.validate(resourceAssignment, context)\r
-                    resourceAssignmentProcessor.process(resourceAssignment, context)\r
-                } catch (e: Exception) {\r
-                    resourceAssignmentProcessor.errorHandle(resourceAssignment, context)\r
-                    throw BlueprintProcessorException(e)\r
-                }\r
+            batchResourceAssignments.filter { it.name != "*" && it.name != "start" }\r
+                    .map { resourceAssignment ->\r
+                        val dictionarySource = resourceAssignment.dictionarySource\r
+                        val processorInstanceName = "resource-assignment-processor-".plus(dictionarySource)\r
+                        val resourceAssignmentProcessor = resourceAssignmentProcessorFactory.getInstance(processorInstanceName)\r
+                                ?: throw BluePrintProcessorException("failed to get resource processor for instance name($processorInstanceName) " +\r
+                                        "for resource assignment(${resourceAssignment.name})")\r
+                        try {\r
+                            resourceAssignmentProcessor.validate(resourceAssignment, context)\r
+                            resourceAssignmentProcessor.process(resourceAssignment, context)\r
+                        } catch (e: Exception) {\r
+                            resourceAssignmentProcessor.errorHandle(resourceAssignment, context)\r
+                            throw BluePrintProcessorException(e)\r
+                        }\r
 \r
-            }\r
+                    }\r
         }\r
     }\r
 }\r
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
new file mode 100644 (file)
index 0000000..5809c06
--- /dev/null
@@ -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 (file)
index 0000000..d2648c0
--- /dev/null
@@ -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 (file)
index 0000000..8750d98
--- /dev/null
@@ -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 (file)
index 0000000..b9c041e
--- /dev/null
@@ -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 (file)
index 0000000..125a1ff
--- /dev/null
@@ -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 (file)
index 0000000..ada36ac
--- /dev/null
@@ -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 (file)
index 0000000..5c90852
--- /dev/null
@@ -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 (file)
index 0000000..5787721
--- /dev/null
@@ -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 (file)
index 0000000..5ff26ad
--- /dev/null
@@ -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 (file)
index 0000000..7de61db
--- /dev/null
@@ -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
index fd32ae1..a53ea2d 100644 (file)
@@ -16,7 +16,8 @@
   ~  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">
+<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</groupId>
@@ -34,6 +35,7 @@
         <kotlin.version>1.3.0</kotlin.version>
         <kotlin.couroutines.version>1.0.1</kotlin.couroutines.version>
         <eelf.version>1.0.0</eelf.version>
+        <sli.version>0.3.1</sli.version>
         <guava.version>26.0-jre</guava.version>
         <springfox.swagger2.version>2.9.2</springfox.swagger2.version>
         <h2database.version>1.4.197</h2database.version>
                 <version>${kotlin.version}</version>
             </dependency>
 
+            <!-- SLI Version -->
+            <dependency>
+                <groupId>org.onap.ccsdk.sli.core</groupId>
+                <artifactId>sli-provider</artifactId>
+                <version>${sli.version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>commons-lang</groupId>
+                        <artifactId>commons-lang</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.apache.commons</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.slf4j</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.opendaylight.mdsal.model</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                    <!--<exclusion>-->
+                    <!--<groupId>org.opendaylight.controller</groupId>-->
+                    <!--<artifactId>*</artifactId>-->
+                    <!--</exclusion>-->
+                    <exclusion>
+                        <groupId>org.apache.tomcat</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.apache.karaf.shell</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>org.mariadb.jdbc</groupId>
+                        <artifactId>*</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
 
             <!-- Application Module Dependencies -->
             <dependency>
                 <artifactId>execution-service</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
+                <artifactId>workflow-service</artifactId>
+                <version>${project.version}</version>
+            </dependency>
             <dependency>
                 <groupId>org.onap.ccsdk.apps.blueprintsprocessor</groupId>
                 <artifactId>resolution-service</artifactId>
                 <executions>
                     <execution>
                         <id>compile</id>
-                          <goals>
+                        <goals>
                             <goal>compile</goal>
                         </goals>
                         <configuration>