summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json15
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json12
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt44
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt16
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt2
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt14
-rw-r--r--ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt2
9 files changed, 100 insertions, 17 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
index 7a923981..a8329b83 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json
@@ -318,6 +318,21 @@
}
]
}
+ },
+ "outputs": {
+ "response-property": {
+ "type": "string",
+ "value": "executed"
+ },
+ "template-properties": {
+ "type": "json",
+ "value": {
+ "get_attribute": [
+ "resource-assignment",
+ "assignment-params"
+ ]
+ }
+ }
}
},
"activate": {
diff --git a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json
index eeb9815f..9e040b85 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/component_invoke/Definitions/component_invoke.json
@@ -54,6 +54,18 @@
"required": true,
"type": "string"
}
+ },
+ "outputs": {
+ "response-property1": {
+ "type": "string",
+ "value": "executed"
+ },
+ "response-property2": {
+ "type": "string",
+ "value": {
+ "get_input": "action-name"
+ }
+ }
}
}
},
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt
index 11553ba6..ff896ba9 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/FileExtensionFunctions.kt
@@ -65,8 +65,8 @@ fun File.deCompress(targetFile: File): File {
return targetFile
}
-fun deleteDir(path: String) {
- normalizedFile(path).deleteRecursively()
+fun deleteDir(path: String, vararg more: String?) {
+ normalizedFile(path, *more).deleteRecursively()
}
fun normalizedFile(path: String, vararg more: String?): File {
@@ -78,6 +78,6 @@ fun normalizedPath(path: String, vararg more: String?): Path {
}
fun normalizedPathName(path: String, vararg more: String?): String {
- return normalizedPath(path, *more).toUri().path
+ return normalizedPath(path, *more).toString()
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
index aab4e7c7..56acf612 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/data/BluePrintModel.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Modifications Copyright © 2018-2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -163,7 +163,8 @@ class PropertyDefinition {
var constraints: MutableList<ConstraintClause>? = null
@get:JsonProperty("entry_schema")
var entrySchema: EntrySchema? = null
- @get:ApiModelProperty(notes = "Property Value, It may be raw JSON or primitive data type values")
+ // Mainly used in Workflow Outputs
+ @get:ApiModelProperty(notes = "Property Value, It may be Expression or Json type values")
var value: JsonNode? = null
}
@@ -565,6 +566,7 @@ class Workflow {
var steps: MutableMap<String, Step>? = null
var preconditions: ArrayList<PreConditionDefinition>? = null
var inputs: MutableMap<String, PropertyDefinition>? = null
+ var outputs: MutableMap<String, PropertyDefinition>? = null
}
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
index c16d1ecc..7958adf7 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Modifications Copyright © 2018-2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -67,6 +67,12 @@ interface BluePrintRuntimeService<T> {
propertyDefinitions: MutableMap<String, PropertyDefinition>,
propertyAssignments: MutableMap<String, JsonNode>): MutableMap<String, JsonNode>
+ fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
+ : MutableMap<String, JsonNode>
+
+ fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
+ : MutableMap<String, JsonNode>
+
fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode>
fun resolveNodeTemplateCapabilityProperties(nodeTemplateName: String, capabilityName: String): MutableMap<String,
@@ -114,6 +120,8 @@ interface BluePrintRuntimeService<T> {
fun assignWorkflowInputs(workflowName: String, jsonNode: JsonNode)
+ fun resolveWorkflowOutputs(workflowName: String): MutableMap<String, JsonNode>
+
fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode
}
@@ -242,6 +250,34 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return propertyAssignmentValue
}
+ override fun resolvePropertyDefinitions(name: String, propertyDefinitions: MutableMap<String, PropertyDefinition>)
+ : MutableMap<String, JsonNode> {
+ val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+
+ propertyDefinitions.forEach { propertyName, propertyDefinition ->
+ val propertyAssignmentExpression = PropertyAssignmentService(this)
+ val expression = propertyDefinition.value ?: propertyDefinition.defaultValue
+ if (expression != null) {
+ propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
+ propertyName, expression)
+ }
+ }
+ return propertyAssignmentValue
+ }
+
+ override fun resolvePropertyAssignments(name: String, propertyAssignments: MutableMap<String, JsonNode>)
+ : MutableMap<String, JsonNode> {
+
+ val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
+
+ propertyAssignments.forEach { propertyName, propertyExpression ->
+ val propertyAssignmentExpression = PropertyAssignmentService(this)
+ propertyAssignmentValue[propertyName] = propertyAssignmentExpression.resolveAssignmentExpression(name,
+ propertyName, propertyExpression)
+ }
+ return propertyAssignmentValue
+ }
+
override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
@@ -520,6 +556,12 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
}
}
+ override fun resolveWorkflowOutputs(workflowName: String): MutableMap<String, JsonNode> {
+ log.info("resolveWorkflowOutputs for workflow($workflowName)")
+ val outputs = bluePrintContext.workflowByName(workflowName).outputs ?: mutableMapOf()
+ return resolvePropertyDefinitions("WORKFLOW", outputs)
+ }
+
override fun getJsonForNodeTemplateAttributeProperties(nodeTemplateName: String, keys: List<String>): JsonNode {
val jsonNode: ObjectNode = jacksonObjectMapper().createObjectNode()
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
index c0bfd0f5..dc56b520 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt
@@ -1,6 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Modifications Copyright © 2018-2019 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -153,6 +153,20 @@ class BluePrintRuntimeServiceTest {
assertNotNull(resolvedJsonNode, "Failed to populate dsl property values")
}
+ @Test
+ fun `test Resolve Workflow Outputs`() {
+ log.info("************************ resolvePropertyAssignments **********************")
+ val bluePrintRuntimeService = getBluePrintRuntimeService()
+
+ val assignmentParams = "{\"ipAddress\": \"127.0.0.1\", \"hostName\": \"vnf-host\"}"
+
+ bluePrintRuntimeService.setNodeTemplateAttributeValue("resource-assignment", "assignment-params",
+ JacksonUtils.jsonNode(assignmentParams))
+
+ val resolvedJsonNode = bluePrintRuntimeService.resolveWorkflowOutputs("resource-assignment")
+ assertNotNull(resolvedJsonNode, "Failed to populate workflow output property values")
+ }
+
private fun getBluePrintRuntimeService(): BluePrintRuntimeService<MutableMap<String, JsonNode>> {
val blueprintBasePath: String = ("./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
val blueprintRuntime = BluePrintMetadataUtils.getBluePrintRuntime("1234", blueprintBasePath)
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
index cf1bfb57..41a7bf8a 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtils.kt
@@ -103,7 +103,7 @@ class BluePrintEnhancerUtils {
suspend fun decompressFilePart(filePart: FilePart, archiveDir: String, enhanceDir: String): File {
val filePartFile = extractCompressFilePart(filePart, archiveDir, enhanceDir)
- val deCompressFileName = Paths.get(enhanceDir).toUri().path
+ val deCompressFileName = normalizedPathName(enhanceDir)
return filePartFile.deCompress(deCompressFileName)
}
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
index 74f225a5..62a37bef 100644
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintEnhancerServiceImplTest.kt
@@ -23,16 +23,16 @@ import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
import org.onap.ccsdk.apps.controllerblueprints.TestApplication
+import org.onap.ccsdk.apps.controllerblueprints.core.deleteDir
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintEnhancerService
import org.onap.ccsdk.apps.controllerblueprints.core.interfaces.BluePrintValidatorService
+import org.onap.ccsdk.apps.controllerblueprints.core.normalizedPathName
import org.onap.ccsdk.apps.controllerblueprints.service.load.ModelTypeLoadService
import org.onap.ccsdk.apps.controllerblueprints.service.load.ResourceDictionaryLoadService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.test.context.ContextConfiguration
import org.springframework.test.context.TestPropertySource
import org.springframework.test.context.junit4.SpringRunner
-import java.io.File
-import java.nio.file.Paths
@RunWith(SpringRunner::class)
@ContextConfiguration(classes = arrayOf(TestApplication::class))
@@ -92,9 +92,9 @@ class BluePrintEnhancerServiceImplTest {
private fun testComponentInvokeEnhancementAndValidation(basePath: String, targetDirName: String) {
runBlocking {
- val targetPath = Paths.get("target", targetDirName).toUri().path
+ val targetPath = normalizedPathName("target/blueprints/enrichment", targetDirName)
- deleteTargetDirectory(targetPath)
+ deleteDir(targetPath)
val bluePrintContext = bluePrintEnhancerService.enhance(basePath, targetPath)
Assert.assertNotNull("failed to get blueprintContext ", bluePrintContext)
@@ -102,12 +102,10 @@ class BluePrintEnhancerServiceImplTest {
// Validate the Generated BluePrints
val valid = bluePrintValidatorService.validateBluePrints(targetPath)
Assert.assertTrue("blueprint($basePath) validation failed ", valid)
+
+ deleteDir(targetPath)
}
}
- private fun deleteTargetDirectory(targetPath: String) {
- val targetDirectory = File(targetPath)
- targetDirectory.deleteRecursively()
- }
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt
index 026561e1..6bd10525 100644
--- a/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt
+++ b/ms/controllerblueprints/modules/service/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/utils/BluePrintEnhancerUtilsTest.kt
@@ -31,7 +31,7 @@ class BluePrintEnhancerUtilsTest {
private val blueprintDir = "./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration"
private val blueprintArchivePath: String = "./target/blueprints/archive"
private val blueprintEnrichmentPath: String = "./target/blueprints/enrichment"
- private var zipBlueprintFileName = Paths.get(blueprintArchivePath, "test.zip").normalize().toUri().path
+ private var zipBlueprintFileName = normalizedPathName(blueprintArchivePath, "test.zip")
@Before
fun setUp() {