aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt1
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt51
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeService.kt23
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt32
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/activation-blueprint.json41
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/data_types.json27
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/node_types.json8
-rw-r--r--components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json4
-rw-r--r--components/model-catalog/definition-type/starter-type/node_type/dg-generic.json8
9 files changed, 121 insertions, 74 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 167496ebc..fd6a8db10 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
@@ -55,6 +55,7 @@ object BluePrintConstants {
const val PATH_TOPOLOGY_TEMPLATE: String = "topology_template"
const val PATH_METADATA: String = "metadata"
const val PATH_NODE_TYPES: String = "node_types"
+ const val PATH_POLICY_TYPES: String = "policy_types"
const val PATH_ARTIFACT_TYPES: String = "artifact_types"
const val PATH_DATA_TYPES: String = "data_types"
const val PATH_INPUTS: String = "inputs"
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
index cb835d736..f6659e7db 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/interfaces/BluePrintEnhancer.kt
@@ -16,13 +16,13 @@
package org.onap.ccsdk.apps.controllerblueprints.core.interfaces
-import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintError
import org.onap.ccsdk.apps.controllerblueprints.core.BluePrintException
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintContext
+import org.onap.ccsdk.apps.controllerblueprints.core.service.BluePrintRuntimeService
interface BluePrintEnhancer<T> {
- fun enhance(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, type: T)
+ fun enhance(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, type: T)
}
interface BluePrintServiceTemplateEnhancer : BluePrintEnhancer<ServiceTemplate>
@@ -49,9 +49,6 @@ interface BluePrintEnhancerService {
@Throws(BluePrintException::class)
fun enhance(basePath: String): BluePrintContext
-
- @Throws(BluePrintException::class)
- fun enhance(serviceTemplate: ServiceTemplate): ServiceTemplate
}
interface BluePrintTypeEnhancerService {
@@ -72,63 +69,63 @@ interface BluePrintTypeEnhancerService {
fun getAttributeDefinitionEnhancers(): List<BluePrintAttributeDefinitionEnhancer>
- fun enhanceServiceTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, serviceTemplate: ServiceTemplate) {
+ fun enhanceServiceTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, serviceTemplate: ServiceTemplate) {
val enhancers = getServiceTemplateEnhancers()
- doEnhancement(bluePrintContext, error, name, serviceTemplate, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, serviceTemplate, enhancers)
}
- fun enhanceTopologyTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, topologyTemplate: TopologyTemplate) {
+ fun enhanceTopologyTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, topologyTemplate: TopologyTemplate) {
val enhancers = getTopologyTemplateEnhancers()
- doEnhancement(bluePrintContext, error, name, topologyTemplate, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, topologyTemplate, enhancers)
}
- fun enhanceWorkflow(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, workflow: Workflow) {
+ fun enhanceWorkflow(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, workflow: Workflow) {
val enhancers = getWorkflowEnhancers()
- doEnhancement(bluePrintContext, error, name, workflow, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, workflow, enhancers)
}
- fun enhanceNodeTemplate(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeTemplate: NodeTemplate) {
+ fun enhanceNodeTemplate(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeTemplate: NodeTemplate) {
val enhancers = getNodeTemplateEnhancers()
- doEnhancement(bluePrintContext, error, name, nodeTemplate, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, nodeTemplate, enhancers)
}
- fun enhanceNodeType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, nodeType: NodeType) {
+ fun enhanceNodeType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, nodeType: NodeType) {
val enhancers = getNodeTypeEnhancers()
- doEnhancement(bluePrintContext, error, name, nodeType, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, nodeType, enhancers)
}
- fun enhancePolicyType(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, policyType: PolicyType) {
+ fun enhancePolicyType(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, policyType: PolicyType) {
val enhancers = getPolicyTypeEnhancers()
- doEnhancement(bluePrintContext, error, name, policyType, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, policyType, enhancers)
}
- fun enhancePropertyDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, properties: MutableMap<String, PropertyDefinition>) {
+ fun enhancePropertyDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, properties: MutableMap<String, PropertyDefinition>) {
properties.forEach { propertyName, propertyDefinition ->
- enhancePropertyDefinition(bluePrintContext, error, propertyName, propertyDefinition)
+ enhancePropertyDefinition(bluePrintRuntimeService, propertyName, propertyDefinition)
}
}
- fun enhancePropertyDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, propertyDefinition: PropertyDefinition) {
+ fun enhancePropertyDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, propertyDefinition: PropertyDefinition) {
val enhancers = getPropertyDefinitionEnhancers()
- doEnhancement(bluePrintContext, error, name, propertyDefinition, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, propertyDefinition, enhancers)
}
- fun enhanceAttributeDefinitions(bluePrintContext: BluePrintContext, error: BluePrintError, attributes: MutableMap<String, AttributeDefinition>) {
+ fun enhanceAttributeDefinitions(bluePrintRuntimeService: BluePrintRuntimeService<*>, attributes: MutableMap<String, AttributeDefinition>) {
attributes.forEach { attributeName, attributeDefinition ->
- enhanceAttributeDefinition(bluePrintContext, error, attributeName, attributeDefinition)
+ enhanceAttributeDefinition(bluePrintRuntimeService, attributeName, attributeDefinition)
}
}
- fun enhanceAttributeDefinition(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, attributeDefinition: AttributeDefinition) {
+ fun enhanceAttributeDefinition(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, attributeDefinition: AttributeDefinition) {
val enhancers = getAttributeDefinitionEnhancers()
- doEnhancement(bluePrintContext, error, name, attributeDefinition, enhancers)
+ doEnhancement(bluePrintRuntimeService, name, attributeDefinition, enhancers)
}
@Suppress("UNCHECKED_CAST")
- private fun <T> doEnhancement(bluePrintContext: BluePrintContext, error: BluePrintError, name: String, definition: Any, enhancers: List<BluePrintEnhancer<T>>) {
+ private fun <T> doEnhancement(bluePrintRuntimeService: BluePrintRuntimeService<*>, name: String, definition: Any, enhancers: List<BluePrintEnhancer<T>>) {
if (enhancers.isNotEmpty()) {
enhancers.forEach {
- it.enhance(bluePrintContext, error, name, definition as T)
+ it.enhance(bluePrintRuntimeService, name, definition as T)
}
}
}
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 448a06a86..cf518bd14 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,6 +25,7 @@ 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.BluePrintError
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
@@ -55,6 +56,10 @@ interface BluePrintRuntimeService<T> {
fun getAsDouble(key: String): Double?
+ fun getBluePrintError(): BluePrintError
+
+ fun setBluePrintError(bluePrintError: BluePrintError)
+
/*
Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
*/
@@ -113,6 +118,8 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
private var store: MutableMap<String, JsonNode> = hashMapOf()
+ private var bluePrintError = BluePrintError()
+
override fun id(): String {
return id
}
@@ -162,9 +169,17 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
return get(key).asDouble()
}
+ override fun getBluePrintError(): BluePrintError {
+ return this.bluePrintError
+ }
+
+ override fun setBluePrintError(bluePrintError: BluePrintError) {
+ this.bluePrintError = bluePrintError
+ }
+
/*
- Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
- */
+ Get the Node Type Definition for the Node Template, Then iterate Node Type Properties and resolve the expressing
+ */
override fun resolveNodeTemplateProperties(nodeTemplateName: String): MutableMap<String, JsonNode> {
log.info("resolveNodeTemplatePropertyValues for node template ({})", nodeTemplateName)
val propertyAssignmentValue: MutableMap<String, JsonNode> = hashMapOf()
@@ -439,11 +454,11 @@ open class DefaultBluePrintRuntimeService(private var id: String, private var bl
setInputValue(propertyName, property, valueNode)
}
}
-
+ // Load Dynamic data Types
val workflowDynamicInputs: JsonNode? = jsonNode.get(dynamicInputPropertiesName)
workflowDynamicInputs?.let {
- bluePrintContext.dataTypeByName(dynamicInputPropertiesName)?.properties?.forEach { propertyName, property ->
+ bluePrintContext.dataTypeByName("dt-$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/utils/BluePrintFileUtils.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
index d9222d754..4cb247b5d 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/utils/BluePrintFileUtils.kt
@@ -89,25 +89,37 @@ class BluePrintFileUtils {
throw BluePrintException("couldn't get definition file under path(${definitionDir.absolutePath})")
}
- blueprintContext.dataTypes.let {
- val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, blueprintContext.dataTypes!!, true)
- writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent)
+ blueprintContext.serviceTemplate.dataTypes?.let {
+ val dataTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_DATA_TYPES, it, true)
+ writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_DATA_TYPES, dataTypesContent)
+ }
+ blueprintContext.serviceTemplate.artifactTypes?.let {
+ val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, it, true)
+ writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent)
}
- blueprintContext.artifactTypes.let {
- val artifactTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_ARTIFACT_TYPES, blueprintContext.artifactTypes!!, true)
- writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_ARTIFACT_TYPES, artifactTypesContent)
+ blueprintContext.serviceTemplate.nodeTypes?.let {
+ val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, it, true)
+ writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent)
}
- blueprintContext.nodeTypes.let {
- val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_NODE_TYPES, blueprintContext.nodeTypes!!, true)
- writeFile(definitionDir.absolutePath, BluePrintConstants.PATH_NODE_TYPES, nodeTypesContent)
+ blueprintContext.serviceTemplate.policyTypes?.let {
+ val nodeTypesContent = JacksonUtils.getWrappedJson(BluePrintConstants.PATH_POLICY_TYPES, it, true)
+ writeTypeFile(definitionDir.absolutePath, BluePrintConstants.PATH_POLICY_TYPES, nodeTypesContent)
}
+ }
+ fun writeDefinitionFile(definitionFile: String, content: String) = runBlocking {
+ val definitionFile = File(definitionFile)
+
+ Files.write(definitionFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE)
+ check(definitionFile.exists()) {
+ throw BluePrintException("couldn't write definition file under path(${definitionFile.absolutePath})")
+ }
}
- private fun writeFile(definitionPath: String, type: String, content: String) = runBlocking {
+ private fun writeTypeFile(definitionPath: String, type: String, content: String) = runBlocking {
val typeFile = File(definitionPath.plus(File.separator).plus("$type.json"))
Files.write(typeFile.toPath(), content.toByteArray(), StandardOpenOption.CREATE_NEW)
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 f756ef7ed..ec229df2d 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
@@ -12,10 +12,13 @@
"file": "Definitions/data_types.json"
},
{
+ "file": "Definitions/artifact_types.json"
+ },
+ {
"file": "Definitions/node_types.json"
},
{
- "file": "Definitions/artifact_types.json"
+ "file": "Definitions/policy_types.json"
}
],
"topology_template": {
@@ -46,7 +49,10 @@
"SELF",
"dg-resource-assignment-process"
]
- }
+ },
+ "dependency-node-templates": [
+ "resource-assignment"
+ ]
},
"artifacts": {
"dg-resource-assignment-process": {
@@ -63,7 +69,10 @@
"SELF",
"dg-activate-process"
]
- }
+ },
+ "dependency-node-templates": [
+ "activate-jython"
+ ]
},
"artifacts": {
"dg-activate-process": {
@@ -80,7 +89,11 @@
"SELF",
"dg-assign-activate-process"
]
- }
+ },
+ "dependency-node-templates": [
+ "resource-assignment",
+ "activate-jython"
+ ]
},
"artifacts": {
"dg-assign-activate-process": {
@@ -217,7 +230,7 @@
"inputs": {
"resource-assignment-properties": {
"required": true,
- "type": "resource-assignment-properties"
+ "type": "dt-resource-assignment-properties"
}
},
"steps": {
@@ -234,9 +247,21 @@
},
"activate": {
"inputs": {
- "activate-properties": {
+ "request-id": {
+ "required": true,
+ "type": "string"
+ },
+ "action-name": {
+ "required": true,
+ "type": "string"
+ },
+ "scope-type": {
+ "required": true,
+ "type": "string"
+ },
+ "hostname": {
"required": true,
- "type": "activate-properties"
+ "type": "string"
}
},
"steps": {
@@ -255,7 +280,7 @@
"inputs": {
"assign-activate-properties": {
"required": true,
- "type": "assign-activate-properties"
+ "type": "dt-assign-activate-properties"
}
},
"steps": {
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 3ea494ac4..7d850f200 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
@@ -20,7 +20,7 @@
},
"derived_from": "tosca.datatypes.Root"
},
- "activate-properties": {
+ "dt-resource-assignment-properties": {
"description": "This is Dynamically generated data type for workflow activate",
"version": "1.0.0",
"properties": {
@@ -43,30 +43,7 @@
},
"derived_from": "tosca.datatypes.Dynamic"
},
- "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.Dynamic"
- },
- "assign-activate-properties": {
+ "dt-assign-activate-properties": {
"description": "This is Dynamically generated data type for workflow assign-activate",
"version": "1.0.0",
"properties": {
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 8227b82f7..8f242efb1 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
@@ -7,6 +7,14 @@
"content": {
"required": true,
"type": "string"
+ },
+ "dependency-node-templates": {
+ "required": true,
+ "description": "Dependent Step Components",
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
}
},
"derived_from": "tosca.nodes.DG"
diff --git a/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json
new file mode 100644
index 000000000..0c9b99252
--- /dev/null
+++ b/components/model-catalog/blueprint-model/starter-blueprint/baseconfiguration/Definitions/policy_types.json
@@ -0,0 +1,4 @@
+{
+ "policy_types": {
+ }
+} \ No newline at end of file
diff --git a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json
index 6274445ca..ec9904bf5 100644
--- a/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json
+++ b/components/model-catalog/definition-type/starter-type/node_type/dg-generic.json
@@ -5,6 +5,14 @@
"content": {
"required": true,
"type": "string"
+ },
+ "dependency-node-templates": {
+ "required": true,
+ "description": "Dependent Step Components NodeTemplate name.",
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
}
},
"derived_from": "tosca.nodes.DG"