aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2018-12-11 14:53:01 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-11 14:53:01 +0000
commitd58f75827760b9bcd9d71342e663817245f57858 (patch)
treeb19857732bf0d9a1f45b1fa8c63a33ad09459d35
parent4d9b6d8ad10c986a6a51e0935531888d75b1a2a4 (diff)
parent04425ebaae2abc1862160acc7674205377078b4f (diff)
Merge "Add Blueprint Runtime Input/Output logic"
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt3
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt20
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt2
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt34
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt3
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt148
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json109
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json69
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json2
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml2
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml)2
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml (renamed from ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml)2
-rw-r--r--components/parent/pom.xml9
-rw-r--r--ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java7
-rw-r--r--ms/blueprintsprocessor/application/src/test/resources/application.properties17
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt11
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.kt3
-rw-r--r--ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt32
-rw-r--r--ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt51
-rw-r--r--ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/interfaces/BluePrintCatalogService.kt24
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/pom.xml14
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt32
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt52
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt50
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/SelfServiceApiMocks.kt46
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json29
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml35
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/execution/AbstractComponentFunction.kt52
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt8
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt19
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt26
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt12
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json23
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json20
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json23
-rw-r--r--ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java1
37 files changed, 830 insertions, 164 deletions
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
index 0517e90b..167496eb 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
@@ -29,6 +29,9 @@ object BluePrintConstants {
const val RESPONSE_HEADER_PATCH_VERSION: String = "X-PatchVersion"
const val RESPONSE_HEADER_LATEST_VERSION: String = "X-LatestVersion"
+ const val STATUS_SUCCESS: String = "success"
+ const val STATUS_FAILURE: String = "failure"
+
const val TYPE_DEFAULT: String = "default"
const val DATA_TYPE_STRING: String = "string"
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
index c32e15f8..2329fc93 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/CustomFunctions.kt
@@ -75,17 +75,17 @@ fun <T : Any> MutableMap<String, *>.castValue(key: String, valueType: KClass<T>)
fun MutableMap<String, JsonNode>.putJsonElement(key: String, value: Any) {
when (value) {
is JsonNode ->
- this.put(key, value)
+ this[key] = value
is String ->
- this.put(key, TextNode(value))
+ this[key] = TextNode(value)
is Boolean ->
- this.put(key, BooleanNode.valueOf(value))
+ this[key] = BooleanNode.valueOf(value)
is Int ->
- this.put(key, IntNode.valueOf(value.toInt()))
+ this[key] = IntNode.valueOf(value.toInt())
is Double ->
- this.put(key, DoubleNode.valueOf(value.toDouble()))
+ this[key] = DoubleNode.valueOf(value.toDouble())
else ->
- this.put(key, JacksonUtils.jsonNodeFromObject(value))
+ this[key] = JacksonUtils.jsonNodeFromObject(value)
}
}
@@ -97,6 +97,14 @@ fun MutableMap<String, JsonNode>.getAsBoolean(key: String): Boolean {
return this[key]?.asBoolean() ?: throw BluePrintException("couldn't find value for key($key)")
}
+fun MutableMap<String, JsonNode>.getAsInt(key: String): Int {
+ return this[key]?.asInt() ?: throw BluePrintException("couldn't find value for key($key)")
+}
+
+fun MutableMap<String, JsonNode>.getAsDouble(key: String): Double {
+ return this[key]?.asDouble() ?: throw BluePrintException("couldn't find value for key($key)")
+}
+
// Checks
fun checkNotEmpty(value: String?): Boolean {
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
index cce6d904..84af3f98 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintContext.kt
@@ -57,6 +57,8 @@ class BluePrintContext(val serviceTemplate: ServiceTemplate) {
fun workflowByName(workFlowName: String): Workflow = workflows?.get(workFlowName)
?: throw BluePrintException("could't get workflow($workFlowName)")
+ fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs
+
fun workflowStepByName(workFlowName: String, stepName: String): Step {
return workflowByName(workFlowName).steps?.get(stepName)
?: throw BluePrintException("could't get step($stepName) for workflow($workFlowName)")
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index 84ba1047..448a06a8 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -25,7 +25,6 @@ import com.fasterxml.jackson.databind.node.NullNode
import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.apps.controllerblueprints.core.data.ArtifactDefinition
import org.onap.ccsdk.apps.controllerblueprints.core.data.NodeTemplate
@@ -211,15 +210,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val propertyAssignments: MutableMap<String, Any> =
bluePrintContext.nodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>
- ?: throw BluePrintException(String.format("failed to get input definitions for node template (%s), " +
- "interface name (%s), operationName(%s)", nodeTemplateName, interfaceName, operationName))
+ ?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
val nodeTypeInterfaceOperationInputs: MutableMap<String, PropertyDefinition> =
bluePrintContext.nodeTypeInterfaceOperationInputs(nodeTypeName, interfaceName, operationName)
- ?: throw BluePrintException(String.format("failed to get input definitions for node type (%s), " +
- "interface name (%s), operationName(%s)", nodeTypeName, interfaceName, operationName))
+ ?: hashMapOf()
log.info("input definition for node template ({}), values ({})", nodeTemplateName, propertyAssignments)
@@ -258,15 +255,13 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
val propertyAssignments: MutableMap<String, Any> =
bluePrintContext.nodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName) as? MutableMap<String, Any>
- ?: throw BluePrintException(String.format("failed to get output definitions for node template (%s), " +
- "interface name (%s), operationName(%s)", nodeTemplateName, interfaceName, operationName))
+ ?: hashMapOf()
val nodeTypeName = bluePrintContext.nodeTemplateByName(nodeTemplateName).type
val nodeTypeInterfaceOperationOutputs: MutableMap<String, PropertyDefinition> =
bluePrintContext.nodeTypeInterfaceOperationOutputs(nodeTypeName, interfaceName, operationName)
- ?: throw BluePrintException(String.format("failed to get input definitions for node type (%s), " +
- "interface name (%s), operationName(%s)", nodeTypeName, interfaceName, operationName))
+ ?: hashMapOf()
// Iterate Node Type Properties
nodeTypeInterfaceOperationOutputs.forEach { nodeTypePropertyName, nodeTypeProperty ->
@@ -435,10 +430,25 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
override fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode) {
log.info("assign workflow {} input value ({})", workflowName, jsonNode.toString())
+ val dynamicInputPropertiesName = "$workflowName-properties"
+
bluePrintContext.workflowByName(workflowName).inputs?.forEach { propertyName, property ->
- val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
- ?: NullNode.getInstance()
- setInputValue(propertyName, property, valueNode)
+ if (propertyName != dynamicInputPropertiesName) {
+ val valueNode: JsonNode = jsonNode.at(BluePrintConstants.PATH_DIVIDER + propertyName)
+ ?: NullNode.getInstance()
+ setInputValue(propertyName, property, valueNode)
+ }
+ }
+
+ val workflowDynamicInputs: JsonNode? = jsonNode.get(dynamicInputPropertiesName)
+
+ workflowDynamicInputs?.let {
+ bluePrintContext.dataTypeByName(dynamicInputPropertiesName)?.properties?.forEach { propertyName, property ->
+ val valueNode: JsonNode = workflowDynamicInputs.at(BluePrintConstants.PATH_DIVIDER + propertyName)
+ ?: NullNode.getInstance()
+ setInputValue(propertyName, property, valueNode)
+
+ }
}
}
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
index 947eb41e..36c141f5 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/PropertyAssignmentService.kt
@@ -197,8 +197,7 @@ If Property Assignment is Expression.
}
fun artifactContent(artifactDefinition: ArtifactDefinition): String {
- val bluePrintBasePath: String = bluePrintRuntimeService.get(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)?.asText()
- ?: throw BluePrintException("failed to get property (${BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH}) from getStore")
+ val bluePrintBasePath: String = bluePrintContext.rootPath
if (artifactDefinition.repository != null) {
TODO()
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
new file mode 100644
index 00000000..f02524ff
--- /dev/null
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintArchiveUtils.kt
@@ -0,0 +1,148 @@
+/*
+ * 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.controllerblueprints.core.utils
+
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry
+import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream
+import org.apache.commons.io.IOUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintProcessorException
+import java.io.*
+import java.nio.charset.Charset
+import java.util.zip.ZipFile
+
+class BluePrintArchiveUtils {
+
+ companion object {
+
+
+ fun compress(source: String, destination: String, absolute: Boolean): Boolean {
+ val rootDir = File(source)
+ val saveFile = File(destination)
+ return compress(rootDir, saveFile, absolute)
+ }
+
+ /**
+ * Create a new Zip from a root directory
+ *
+ * @param directory the base directory
+ * @param filename the output filename
+ * @param absolute store absolute filepath (from directory) or only filename
+ * @return True if OK
+ */
+ fun compress(source: File, destination: File, absolute: Boolean): Boolean {
+ // recursive call
+ val zaos: ZipArchiveOutputStream
+ try {
+ zaos = ZipArchiveOutputStream(FileOutputStream(destination))
+ } catch (e: FileNotFoundException) {
+ return false
+ }
+
+ try {
+ recurseFiles(source, source, zaos, absolute)
+ } catch (e2: IOException) {
+ try {
+ zaos.close()
+ } catch (e: IOException) {
+ // ignore
+ }
+
+ return false
+ }
+
+ try {
+ zaos.finish()
+ } catch (e1: IOException) {
+ // ignore
+ }
+
+ try {
+ zaos.flush()
+ } catch (e: IOException) {
+ // ignore
+ }
+
+ try {
+ zaos.close()
+ } catch (e: IOException) {
+ // ignore
+ }
+
+ return true
+ }
+
+ /**
+ * Recursive traversal to add files
+ *
+ * @param root
+ * @param file
+ * @param zaos
+ * @param absolute
+ * @throws IOException
+ */
+ @Throws(IOException::class)
+ private fun recurseFiles(root: File, file: File, zaos: ZipArchiveOutputStream,
+ absolute: Boolean) {
+ if (file.isDirectory) {
+ // recursive call
+ val files = file.listFiles()
+ for (file2 in files!!) {
+ recurseFiles(root, file2, zaos, absolute)
+ }
+ } else if (!file.name.endsWith(".zip") && !file.name.endsWith(".ZIP")) {
+ var filename: String? = null
+ if (absolute) {
+ filename = file.absolutePath.substring(root.absolutePath.length)
+ } else {
+ filename = file.name
+ }
+ val zae = ZipArchiveEntry(filename)
+ zae.setSize(file.length())
+ zaos.putArchiveEntry(zae)
+ val fis = FileInputStream(file)
+ IOUtils.copy(fis, zaos)
+ zaos.closeArchiveEntry()
+ }
+ }
+
+
+ fun deCompress(zipFile: File, targetPath: String): File {
+ val zip = ZipFile(zipFile, Charset.defaultCharset())
+ val enumeration = zip.entries()
+ while (enumeration.hasMoreElements()) {
+ val entry = enumeration.nextElement()
+ val destFilePath = File(targetPath, entry.name)
+ destFilePath.parentFile.mkdirs()
+ if (entry.isDirectory)
+ continue
+ val bufferedIs = BufferedInputStream(zip.getInputStream(entry))
+ bufferedIs.use {
+ destFilePath.outputStream().buffered(1024).use { bos ->
+ bufferedIs.copyTo(bos)
+ }
+ }
+ }
+
+ val destinationDir = File(targetPath)
+ check(destinationDir.isDirectory && destinationDir.exists()) {
+ throw BluePrintProcessorException("failed to decompress blueprint(${zipFile.absolutePath}) to ($targetPath) ")
+ }
+ return destinationDir
+ }
+ }
+
+} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index 04e0efce..b538f50d 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -38,6 +38,32 @@
}
},
"node_templates": {
+ "resource-assignment-process": {
+ "type": "dg-activate",
+ "properties": {
+ "process-name": {
+ "get_input": "action-name"
+ },
+ "version": {
+ "get_property": [
+ "SELF",
+ "process-name"
+ ]
+ },
+ "content": {
+ "get_artifact": [
+ "SELF",
+ "dg-resource-assignment-process"
+ ]
+ }
+ },
+ "artifacts": {
+ "dg-resource-assignment-process": {
+ "type": "artifact-directed-graph",
+ "file": "Plans/CONFIG_ResourceAssignment_1.0.0.xml"
+ }
+ }
+ },
"activate-process": {
"type": "dg-activate",
"properties": {
@@ -64,6 +90,32 @@
}
}
},
+ "assign-activate-process": {
+ "type": "dg-activate",
+ "properties": {
+ "process-name": {
+ "get_input": "action-name"
+ },
+ "version": {
+ "get_property": [
+ "SELF",
+ "process-name"
+ ]
+ },
+ "content": {
+ "get_artifact": [
+ "SELF",
+ "dg-assign-activate-process"
+ ]
+ }
+ },
+ "artifacts": {
+ "dg-assign-activate-process": {
+ "type": "artifact-directed-graph",
+ "file": "Plans/CONFIG_AssignActivateNetconf_1.0.0.xml"
+ }
+ }
+ },
"resource-assignment": {
"type": "component-resource-assignment",
"properties": {
@@ -181,30 +233,18 @@
"workflows": {
"resource-assignment": {
"inputs": {
- "request-id": {
+ "resource-assignment-properties": {
"required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
+ "type": "resource-assignment-properties"
}
},
"steps": {
"call-resource-assignment": {
"description": "Resource Assignment Workflow",
- "target": "resource-assignment",
+ "target": "resource-assignment-process",
"activities": [
{
- "call_operation": "ResourceAssignmentComponent.process"
+ "call_operation": "CONFIG.ResourceAssignment"
}
]
}
@@ -212,21 +252,9 @@
},
"activate": {
"inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
+ "activate-properties": {
"required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
+ "type": "activate-properties"
}
},
"steps": {
@@ -235,7 +263,26 @@
"target": "activate-process",
"activities": [
{
- "call_operation": "ResourceAssignmentComponent.process"
+ "call_operation": "CONFIG.ActivateProcess"
+ }
+ ]
+ }
+ }
+ },
+ "assign-activate": {
+ "inputs": {
+ "assign-activate-properties": {
+ "required": true,
+ "type": "assign-activate-properties"
+ }
+ },
+ "steps": {
+ "activate-process": {
+ "description": "Resource Assign and Netconf Activation Workflow",
+ "target": "assign-activate-process",
+ "activities": [
+ {
+ "call_operation": "CONFIG.AssignActivateProcess"
}
]
}
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json
index 6ca1ffde..569b668a 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json
@@ -19,6 +19,75 @@
}
},
"derived_from": "tosca.datatypes.Root"
+ },
+ "activate-properties": {
+ "description": "This is Dynamically generated data type for workflow activate",
+ "version": "1.0.0",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "resource-assignment-properties": {
+ "description": "This is Dynamically generated data type for workflow activate",
+ "version": "1.0.0",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "assign-activate-properties": {
+ "description": "This is Dynamically generated data type for workflow assign-activate",
+ "version": "1.0.0",
+ "properties": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
+ "required": true,
+ "type": "string"
+ }
+ },
+ "derived_from": "tosca.datatypes.Root"
}
}
} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
index 139ebb1a..b83fd2a3 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json
@@ -1,7 +1,7 @@
{
"node_types": {
"dg-activate": {
- "description": "This is BPMN Activate node type",
+ "description": "This is Generic Directed Graph Type",
"version": "1.0.0",
"properties": {
"content": {
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml
index d256bbd2..2f6d2eda 100644
--- a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ActivateNetconf_1.0.0.xml
@@ -19,7 +19,7 @@
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">
+ <execute plugin="activate-jython" method="process">
<outcome value='failure'>
<return status="failure">
</return>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml
index 7de61db5..eb41b7df 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/two-component.xml
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_AssignActivateNetconf_1.0.0.xml
@@ -25,7 +25,7 @@
</return>
</outcome>
<outcome value='success'>
- <execute plugin="resource-assignment-py" method="process">
+ <execute plugin="activate-jython" method="process">
<outcome value='failure'>
<return status="failure">
</return>
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml
index 5ff26ad2..a197877f 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/service-logic/one-component.xml
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Plans/CONFIG_ResourceAssignment_1.0.0.xml
@@ -17,7 +17,7 @@
<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'>
+ <method rpc='ResourceAssignment' mode='sync'>
<block atomic="true">
<execute plugin="resource-assignment" method="process">
<outcome value='failure'>
diff --git a/components/parent/pom.xml b/components/parent/pom.xml
index 8a779c1d..5c462088 100644
--- a/components/parent/pom.xml
+++ b/components/parent/pom.xml
@@ -92,6 +92,11 @@
<version>2.6</version>
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ <version>1.15</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
@@ -216,6 +221,10 @@
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-compress</artifactId>
+ </dependency>
+ <dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
</dependency>
diff --git a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
index 3cba1f9e..8a4ebd0a 100644
--- a/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
+++ b/ms/blueprintsprocessor/application/src/test/java/org/onap/ccsdk/apps/blueprintsprocessor/BlueprintProcessorApplicationTest.java
@@ -22,6 +22,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
@@ -35,8 +36,8 @@ import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = BlueprintProcessorApplication.class)
-//@SpringBootTest(classes = BlueprintProcessorApplication.class,
-// webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@SpringBootTest(classes = BlueprintProcessorApplication.class,
+ webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class BlueprintProcessorApplicationTest {
@Autowired
@@ -48,7 +49,7 @@ public class BlueprintProcessorApplicationTest {
}
@Test
- public void testSample(){
+ public void testSample() {
Assert.assertNotNull("Failed to create Application Context ", context);
}
diff --git a/ms/blueprintsprocessor/application/src/test/resources/application.properties b/ms/blueprintsprocessor/application/src/test/resources/application.properties
new file mode 100644
index 00000000..567c2577
--- /dev/null
+++ b/ms/blueprintsprocessor/application/src/test/resources/application.properties
@@ -0,0 +1,17 @@
+#
+# 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.
+#
+blueprintsprocessor.blueprint-deploy-path=/opt
+blueprintsprocessor.blueprint-archive-path=/opt \ No newline at end of file
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
index 1ce8d05b..23da74a8 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/functions/python/executor/ComponentJythonExecutorTest.kt
@@ -64,10 +64,13 @@ class ComponentJythonExecutorTest {
val metaData: MutableMap<String, JsonNode> = hashMapOf()
- metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, "resource-assignment-py")
- metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "resource-assignment-py")
- metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "ResourceAssignmentComponent")
- metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, "activate-jython")
+
+ val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
+ stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, "activate-jython")
+ stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, "JythonExecutorComponent")
+ stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, "process")
+ metaData.putJsonElement("activate-jython-step-inputs", stepMetaData)
executionServiceInput.metadata = metaData
componentJythonExecutor.apply(executionServiceInput)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.kt
index a7d573c6..62adde73 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/resolution/ResourceResolutionServiceTest.kt
@@ -23,7 +23,6 @@ import org.junit.Assert
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ResourceResolutionInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.factory.ResourceAssignmentProcessorFactory
import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.DataBaseResourceAssignmentProcessor
import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.DefaultResourceAssignmentProcessor
import org.onap.ccsdk.apps.blueprintsprocessor.services.resolution.processor.InputResourceAssignmentProcessor
@@ -45,7 +44,7 @@ import kotlin.test.assertTrue
* @author Brinda Santh DATE : 8/15/2018
*/
@RunWith(SpringRunner::class)
-@ContextConfiguration(classes = [ResourceResolutionService::class, ResourceAssignmentProcessorFactory::class,
+@ContextConfiguration(classes = [ResourceResolutionService::class,
InputResourceAssignmentProcessor::class, DefaultResourceAssignmentProcessor::class,
DataBaseResourceAssignmentProcessor::class, SimpleRestResourceAssignmentProcessor::class])
class ResourceResolutionServiceTest {
diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
new file mode 100644
index 00000000..3b5722d5
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/BluePrintCoreConfiguration.kt
@@ -0,0 +1,32 @@
+/*
+ * 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.core
+
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.context.annotation.Configuration
+
+
+@Configuration
+open class BluePrintCoreConfiguration {
+
+ @Value("\${blueprintsprocessor.blueprint-deploy-path}")
+ lateinit var deployPath: String
+
+ @Value("\${blueprintsprocessor.blueprint-archive-path}")
+ lateinit var archivePath: String
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt
deleted file mode 100644
index 80ad0e67..00000000
--- a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/factory/ResourceAssignmentProcessorFactory.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications 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.core.factory
-
-import com.att.eelf.configuration.EELFManager
-import org.onap.ccsdk.apps.controllerblueprints.resource.dict.ResourceAssignmentProcessor
-import org.springframework.context.ApplicationContext
-import org.springframework.context.ApplicationContextAware
-import org.springframework.context.annotation.Configuration
-
-/**
- * ResourceAssignmentProcessorFactory
- *
- * @author Brinda Santh
- */
-@Configuration
-open class ResourceAssignmentProcessorFactory : ApplicationContextAware {
-
- private val log = EELFManager.getInstance().getLogger(ResourceAssignmentProcessorFactory::class.java)
-
- var resourceAssignmentProcessors: MutableMap<String, ResourceAssignmentProcessor> = hashMapOf()
-
- fun getInstance(instanceName: String): ResourceAssignmentProcessor? {
- log.trace("looking for Resource Assignment Processor : {}", instanceName)
- return resourceAssignmentProcessors.get(instanceName)
- }
-
- fun injectInstance(instanceName: String, resourceAssignmentProcessor: ResourceAssignmentProcessor) {
- this.resourceAssignmentProcessors[instanceName] = resourceAssignmentProcessor
- }
-
- override fun setApplicationContext(context: ApplicationContext) {
- resourceAssignmentProcessors = context.getBeansOfType(ResourceAssignmentProcessor::class.java)
- log.info("Injected Resource Assignment Processor : {}", resourceAssignmentProcessors)
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/interfaces/BluePrintCatalogService.kt b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/interfaces/BluePrintCatalogService.kt
new file mode 100644
index 00000000..64847964
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/commons/core/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/core/interfaces/BluePrintCatalogService.kt
@@ -0,0 +1,24 @@
+/*
+ * 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.core.interfaces
+
+interface BluePrintCatalogService {
+ /**
+ * Get the Blueprint from Data Base and Download it under working directory and return the path path
+ */
+ fun prepareBluePrint(name: String, version: String): String
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/pom.xml b/ms/blueprintsprocessor/modules/inbounds/pom.xml
index e26af0f0..91912c83 100644
--- a/ms/blueprintsprocessor/modules/inbounds/pom.xml
+++ b/ms/blueprintsprocessor/modules/inbounds/pom.xml
@@ -45,5 +45,19 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jetbrains.kotlin</groupId>
+ <artifactId>kotlin-test-junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito2</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt
new file mode 100644
index 00000000..8e067873
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/BluePrintCatalogServiceImpl.kt
@@ -0,0 +1,32 @@
+/*
+ * 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.selfservice.api
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.BluePrintCoreConfiguration
+import org.onap.ccsdk.apps.blueprintsprocessor.core.interfaces.BluePrintCatalogService
+import org.springframework.stereotype.Service
+import java.io.File
+
+@Service
+class BluePrintCatalogServiceImpl(private val bluePrintCoreConfiguration: BluePrintCoreConfiguration) : BluePrintCatalogService {
+
+ override fun prepareBluePrint(name: String, version: String): String {
+ //TODO("Get the Blueprint from the DB")
+ return bluePrintCoreConfiguration.deployPath.plus(File.separator).plus(name).plus(File.separator).plus(version)
+
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
new file mode 100644
index 00000000..aa44a060
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.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.selfservice.api
+
+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.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.BlueprintDGExecutionService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.slf4j.LoggerFactory
+import org.springframework.stereotype.Service
+
+@Service
+class ExecutionServiceHandler(private val bluePrintCatalogService: BluePrintCatalogService,
+ private val blueprintDGExecutionService: BlueprintDGExecutionService) {
+
+ private val log = LoggerFactory.getLogger(ExecutionServiceHandler::class.toString())
+
+ fun process(executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+
+ val requestId = executionServiceInput.commonHeader.requestId
+ log.info("processing request id $requestId")
+
+ val actionIdentifiers = executionServiceInput.actionIdentifiers
+
+ val blueprintName = actionIdentifiers.blueprintName
+ val blueprintVersion = actionIdentifiers.blueprintVersion
+
+ val basePath = bluePrintCatalogService.prepareBluePrint(blueprintName, blueprintVersion)
+ log.info("blueprint base path $basePath")
+
+ val blueprintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime(requestId, basePath)
+
+ return blueprintDGExecutionService.executeDirectedGraph(blueprintRuntimeService, executionServiceInput)
+ }
+
+
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
new file mode 100644
index 00000000..e9e10307
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/ExecutionServiceHandlerTest.kt
@@ -0,0 +1,50 @@
+/*
+ * 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.selfservice.api
+
+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.selfservice.api.mock.MockBluePrintCatalogService
+import org.onap.ccsdk.apps.blueprintsprocessor.selfservice.api.mock.MockBlueprintDGExecutionService
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
+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 = [MockBluePrintCatalogService::class,
+ MockBlueprintDGExecutionService::class, ExecutionServiceHandler::class])
+class ExecutionServiceHandlerTest {
+
+ @Autowired
+ lateinit var executionServiceHandler: ExecutionServiceHandler
+
+ @Test
+ fun testProcess() {
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
+ executionServiceHandler.process(executionServiceInput)
+
+ }
+
+}
+
+
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/SelfServiceApiMocks.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/SelfServiceApiMocks.kt
new file mode 100644
index 00000000..bc200f4c
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/selfservice/api/mock/SelfServiceApiMocks.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.selfservice.api.mock
+
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.onap.ccsdk.apps.blueprintsprocessor.core.interfaces.BluePrintCatalogService
+import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.BlueprintDGExecutionService
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
+import org.springframework.stereotype.Service
+import kotlin.test.assertNotNull
+
+@Service
+class MockBlueprintDGExecutionService : BlueprintDGExecutionService {
+ override fun executeDirectedGraph(bluePrintRuntimeService: BluePrintRuntimeService<*>, executionServiceInput: ExecutionServiceInput): ExecutionServiceOutput {
+
+ assertNotNull(executionServiceInput, "failed to get executionServiceInput")
+
+ val executionServiceOutput = ExecutionServiceOutput()
+ executionServiceOutput.commonHeader = executionServiceInput.commonHeader
+ return executionServiceOutput
+ }
+}
+
+@Service
+class MockBluePrintCatalogService : BluePrintCatalogService {
+ override fun prepareBluePrint(name: String, version: String): String {
+ assertNotNull(name, "failed to get blueprint Name")
+ assertNotNull(version, "failed to get blueprint version")
+ return "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration"
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json
new file mode 100644
index 00000000..a6eb7a81
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/execution-input/default-input.json
@@ -0,0 +1,29 @@
+{
+ "commonHeader": {
+ "originatorId": "System",
+ "requestId": "1234",
+ "subRequestId": "1234-12234"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "baseconfiguration",
+ "blueprintVersion": "1.0.0",
+ "actionName": "activate",
+ "mode": "sync"
+ },
+ "payload": {
+ "activate-request": {
+ "activate-properties": {
+ "request-id": "1234",
+ "action-name": "activate",
+ "scope-type": "vnf-type",
+ "hostname": "localhost"
+ }
+ }
+ },
+ "metadata": {
+ "current-node-template": "resource-assignment-py",
+ "current-step": "resource-assignment-py",
+ "current-operation": "process",
+ "current-interface": "ResourceAssignmentComponent"
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml
new file mode 100644
index 00000000..a816a06c
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/test/resources/logback.xml
@@ -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.
+ -->
+
+<configuration>
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} %-5level %logger{100} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+
+ <logger name="org.springframework" level="warn"/>
+ <logger name="org.hibernate" level="info"/>
+ <logger name="org.onap.ccsdk.apps.blueprintsprocessor" level="info"/>
+
+ <root level="warn">
+ <appender-ref ref="STDOUT"/>
+ </root>
+
+</configuration>
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
index dfdf6259..37f14925 100644
--- 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
@@ -17,11 +17,16 @@
package org.onap.ccsdk.apps.blueprintsprocessor.services.execution
+import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.JsonNodeFactory
+import com.fasterxml.jackson.databind.node.NullNode
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.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.getAsString
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BlueprintFunctionNode
+import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
import org.slf4j.LoggerFactory
@@ -30,6 +35,7 @@ import org.slf4j.LoggerFactory
* @author Brinda Santh
*/
abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServiceInput, ExecutionServiceOutput> {
+ @Transient
private val log = LoggerFactory.getLogger(AbstractComponentFunction::class.java)
var executionServiceInput: ExecutionServiceInput? = null
@@ -41,29 +47,59 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
var interfaceName: String = ""
var operationName: String = ""
var nodeTemplateName: String = ""
+ var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
override fun prepareRequest(executionServiceInput: ExecutionServiceInput): ExecutionServiceInput {
+ checkNotNull(bluePrintRuntimeService) { "failed to prepare blueprint runtime" }
- this.executionServiceInput = this.executionServiceInput
+ this.executionServiceInput = executionServiceInput
processId = executionServiceInput.commonHeader.requestId
workflowName = executionServiceInput.actionIdentifiers.actionName
val metadata = executionServiceInput.metadata
stepName = metadata.getAsString(BluePrintConstants.PROPERTY_CURRENT_STEP)
- nodeTemplateName = metadata.getAsString(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE)
- interfaceName = metadata.getAsString(BluePrintConstants.PROPERTY_CURRENT_INTERFACE)
- operationName = metadata.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION)
+ log.info("preparing request id($processId) for workflow($workflowName) step($stepName)")
+
+ val operationInputs = metadata.get("$stepName-step-inputs") ?: JsonNodeFactory.instance.objectNode()
+
+ operationInputs.fields().forEach {
+ this.operationInputs[it.key] = it.value
+ }
+
+ nodeTemplateName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE)
+ interfaceName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_INTERFACE)
+ operationName = this.operationInputs.getAsString(BluePrintConstants.PROPERTY_CURRENT_OPERATION)
+
+
+ val operationResolvedProperties = bluePrintRuntimeService!!.resolveNodeTemplateInterfaceOperationInputs(nodeTemplateName, interfaceName, operationName)
+
+ this.operationInputs.putAll(operationResolvedProperties)
+
- checkNotNull(bluePrintRuntimeService) { "failed to prepare blueprint runtime" }
- log.info("prepareRequest...")
return executionServiceInput
}
override fun prepareResponse(): ExecutionServiceOutput {
log.info("Preparing Response...")
+ executionServiceOutput.commonHeader = executionServiceInput!!.commonHeader
+
+ // Resolve the Output Expression
+ val operationResolvedProperties = bluePrintRuntimeService!!
+ .resolveNodeTemplateInterfaceOperationOutputs(nodeTemplateName, interfaceName, operationName)
+
+ val metadata = executionServiceOutput.metadata
+ metadata.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, stepName)
+ metadata.putJsonElement("$stepName-step-outputs", operationResolvedProperties)
+
+ // Populate Status
+ val status = Status()
+ status.eventType = "EVENT-COMPONENT-EXECUTED"
+ status.code = 200
+ status.message = BluePrintConstants.STATUS_SUCCESS
+ executionServiceOutput.status = status
return this.executionServiceOutput
}
@@ -72,4 +108,8 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
process(executionServiceInput)
return prepareResponse()
}
+
+ fun getOperationInput(key: String): JsonNode {
+ return operationInputs.get(key) ?: NullNode.instance
+ }
} \ 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/BlueprintDGExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt
index 993f10ee..9bb562b7 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionService.kt
@@ -19,7 +19,6 @@ package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.utils.SvcGraphUtils
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
@@ -55,14 +54,17 @@ class DefaultBlueprintDGExecutionService(val blueprintSvcLogicService: Blueprint
WorkflowServiceConstants.ARTIFACT_TYPE_DIRECTED_GRAPH)
// Populate the DG Path
- val dgFilePath = bluePrintRuntimeService.getAsString(BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH)
- .plus(File.separator).plus(artifactDefinition.file)
+ val dgFilePath = bluePrintContext.rootPath.plus(File.separator).plus(artifactDefinition.file)
log.info("Executing directed graph ($dgFilePath)")
// Create DG instance
val graph = SvcGraphUtils.getSvcGraphFromFile(dgFilePath)
+ // Assign Workflow inputs
+ val input = executionServiceInput.payload.get("$workflowName-request")
+ bluePrintRuntimeService.assignWorkflowInputs(workflowName, input)
+
// Execute the DG
return blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput) as ExecutionServiceOutput
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
index ace9f278..87c0c539 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -16,9 +16,12 @@
package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor
+import com.fasterxml.jackson.databind.JsonNode
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.apps.controllerblueprints.core.BluePrintConstants
+import org.onap.ccsdk.apps.controllerblueprints.core.putJsonElement
import org.onap.ccsdk.sli.core.sli.SvcLogicContext
import org.onap.ccsdk.sli.core.sli.SvcLogicException
import org.onap.ccsdk.sli.core.sli.SvcLogicNode
@@ -57,13 +60,27 @@ open class ComponentExecuteNodeExecutor : ExecuteNodeExecutor() {
// 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)")
+ val interfaceName = blueprintContext.nodeTemplateFirstInterfaceName(nodeTemplateName)
+
+ val operationName = blueprintContext.nodeTemplateFirstInterfaceFirstOperationName(nodeTemplateName)
+
+ log.info("executing node template($nodeTemplateName) component($componentName) interface($interfaceName) operation($operationName)")
// Get the Component Instance
val plugin = this.getComponentFunction(componentName)
// Set the Blueprint Service
plugin.bluePrintRuntimeService = ctx.getBluePrintService()
val executionInput = ctx.getRequest() as ExecutionServiceInput
+
+ val metaData = executionInput.metadata
+ metaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_STEP, nodeTemplateName)
+ // Populate Step Meta Data
+ val stepMetaData: MutableMap<String, JsonNode> = hashMapOf()
+ stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_NODE_TEMPLATE, nodeTemplateName)
+ stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_INTERFACE, interfaceName)
+ stepMetaData.putJsonElement(BluePrintConstants.PROPERTY_CURRENT_OPERATION, operationName)
+
+ metaData.putJsonElement("$nodeTemplateName-step-inputs", stepMetaData)
// Get the Request from the Context and Set to the Function Input and Invoke the function
val executionOutput = plugin.apply(executionInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt
index 46bb6f08..2d0dff53 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintDGExecutionServiceTest.kt
@@ -43,7 +43,7 @@ class BlueprintDGExecutionServiceTest {
val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
"./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
index 341b6f84..2c1c40c9 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/BlueprintServiceLogicTest.kt
@@ -20,7 +20,6 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.utils.SvcGraphUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.BluePrintMetadataUtils
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import org.slf4j.LoggerFactory
@@ -34,26 +33,31 @@ class BlueprintServiceLogicTest {
private val log = LoggerFactory.getLogger(BlueprintServiceLogicTest::class.java)
- val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
- "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
-
- val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/default-input.json", ExecutionServiceInput::class.java)!!
-
@Autowired
- lateinit var blueprintSvcLogicService: BlueprintSvcLogicService
+ lateinit var blueprintDGExecutionService: BlueprintDGExecutionService
@Test
fun testExecuteGraphWithSingleComponent() {
- val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/one-component.xml")
- blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput)
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/resource-assignment-input.json", ExecutionServiceInput::class.java)!!
+
+
+ blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput)
}
@Test
fun testExecuteGraphWithMultipleComponents() {
- val graph = SvcGraphUtils.getSvcGraphFromClassPathFile("service-logic/two-component.xml")
- blueprintSvcLogicService.execute(graph, bluePrintRuntimeService, executionServiceInput)
+
+ val bluePrintRuntimeService = BluePrintMetadataUtils.getBluePrintRuntime("1234",
+ "./../../../../../components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration")
+
+ val executionServiceInput = JacksonUtils.readValueFromClassPathFile("execution-input/assign-activate-input.json", ExecutionServiceInput::class.java)!!
+
+ blueprintDGExecutionService.executeDirectedGraph(bluePrintRuntimeService, executionServiceInput)
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
index 747be76c..9f7a9c97 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/apps/blueprintsprocessor/services/workflow/mock/MockComponentFunction.kt
@@ -17,9 +17,8 @@
package org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.mock
import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceInput
-import org.onap.ccsdk.apps.blueprintsprocessor.core.api.data.ExecutionServiceOutput
import org.onap.ccsdk.apps.blueprintsprocessor.services.execution.AbstractComponentFunction
-import org.onap.ccsdk.apps.blueprintsprocessor.services.workflow.executor.ComponentExecuteNodeExecutor
+import org.onap.ccsdk.apps.controllerblueprints.core.asJsonPrimitive
import org.slf4j.LoggerFactory
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@@ -27,7 +26,7 @@ import org.springframework.context.annotation.Configuration
@Configuration
open class MockComponentConfiguration {
- @Bean(name = ["component-resource-assignment", "component-netconf-executor"])
+ @Bean(name = ["component-resource-assignment", "component-netconf-executor", "component-jython-executor"])
open fun createComponentFunction(): AbstractComponentFunction {
return MockComponentFunction()
}
@@ -35,12 +34,13 @@ open class MockComponentConfiguration {
class MockComponentFunction : AbstractComponentFunction() {
- private val log = LoggerFactory.getLogger(ComponentExecuteNodeExecutor::class.java)
+ private val log = LoggerFactory.getLogger(MockComponentFunction::class.java)
override fun process(executionRequest: ExecutionServiceInput) {
- log.info("Processing component..")
+ log.info("Processing component : ${operationInputs}")
- this.executionServiceOutput = ExecutionServiceOutput()
+ bluePrintRuntimeService!!.setNodeTemplateAttributeValue(nodeTemplateName,
+ "assignment-params", "params".asJsonPrimitive())
}
override fun recover(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json
new file mode 100644
index 00000000..d63b1d31
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/assign-activate-input.json
@@ -0,0 +1,23 @@
+{
+ "commonHeader": {
+ "originatorId": "System",
+ "requestId": "1234",
+ "subRequestId": "1234-12234"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "baseconfiguration",
+ "blueprintVersion": "1.0.0",
+ "actionName": "assign-activate",
+ "mode": "sync"
+ },
+ "payload": {
+ "assign-activate-request": {
+ "assign-activate-properties": {
+ "request-id": "1234",
+ "action-name": "assign-activate",
+ "scope-type": "vnf-type",
+ "hostname": "localhost"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json
deleted file mode 100644
index 20401fd1..00000000
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/default-input.json
+++ /dev/null
@@ -1,20 +0,0 @@
-{
- "commonHeader" : {
- "originatorId" : "System",
- "requestId" : "1234",
- "subRequestId" : "1234-12234"
- },
- "actionIdentifiers" : {
- "blueprintName" : "baseconfiguration",
- "blueprintVersion" : "1.0.0",
- "actionName" : "activate",
- "mode" : "sync"
- },
- "payload" : { },
- "metadata" : {
- "current-node-template" : "resource-assignment-py",
- "current-step" : "resource-assignment-py",
- "current-operation" : "process",
- "current-interface" : "ResourceAssignmentComponent"
- }
-} \ No newline at end of file
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json
new file mode 100644
index 00000000..ce7bc8e5
--- /dev/null
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/resources/execution-input/resource-assignment-input.json
@@ -0,0 +1,23 @@
+{
+ "commonHeader": {
+ "originatorId": "System",
+ "requestId": "1234",
+ "subRequestId": "1234-12234"
+ },
+ "actionIdentifiers": {
+ "blueprintName": "baseconfiguration",
+ "blueprintVersion": "1.0.0",
+ "actionName": "resource-assignment",
+ "mode": "sync"
+ },
+ "payload": {
+ "resource-assignment-request": {
+ "resource-assignment-properties": {
+ "request-id": "1234",
+ "action-name": "resource-assignment",
+ "scope-type": "vnf-type",
+ "hostname": "localhost"
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
index 2e58b53e..1ba32574 100644
--- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
+++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceAssignmentEnhancerServiceTest.java
@@ -20,7 +20,6 @@ import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Test;
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException;
import org.onap.ccsdk.apps.controllerblueprints.core.data.ServiceTemplate;
import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonReactorUtils;