aboutsummaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/blueprint-core
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-07-24 22:34:39 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-07-24 22:34:39 -0400
commit88e24883c8e22711062ad451250ff7e3646485b3 (patch)
treedfc52871d9a5884e321ac6e32e239169dfff2603 /ms/controllerblueprints/modules/blueprint-core
parentef03bd490adb4483fc0dd0f8726f33ba6187804a (diff)
Fix attribute validation for complex type.
Change-Id: I7a3365c4c26fd44ed0b54bff115b64c52ee7b81e Issue-ID: CCSDK-1046 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt6
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt24
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt4
3 files changed, 31 insertions, 3 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
index 3415be8f3..c9f7d507c 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintServiceDSLBuilder.kt
@@ -54,14 +54,14 @@ class ServiceTemplateBuilder(private val name: String,
imports.add(importDefinition)
}
- fun dsl(id: String, json: String) {
- dsl(id, json.asJsonType())
+ fun dsl(id: String, content: Any) {
+ dsl(id, content.asJsonType())
}
fun dsl(id: String, json: JsonNode) {
if (dslDefinitions == null)
dslDefinitions = hashMapOf()
- dslDefinitions!![id] = json.asJsonType()
+ dslDefinitions!![id] = json
}
fun dataTypes(dataTypes: MutableMap<String, DataType>) {
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
index fd747f09c..93b6f4e4e 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTemplateDSLBuilder.kt
@@ -32,6 +32,12 @@ class TopologyTemplateBuilder {
nodeTemplates!![id] = NodeTemplateBuilder(id, type, description).apply(block).build()
}
+ fun nodeTemplate(nodeTemplate: NodeTemplate) {
+ if (nodeTemplates == null)
+ nodeTemplates = hashMapOf()
+ nodeTemplates!![nodeTemplate.id!!] = nodeTemplate
+ }
+
fun nodeTemplateOperation(nodeTemplateName: String, type: String, interfaceName: String, description: String,
operationBlock: OperationAssignmentBuilder.() -> Unit) {
if (nodeTemplates == null)
@@ -48,6 +54,12 @@ class TopologyTemplateBuilder {
workflows!![id] = WorkflowBuilder(id, description).apply(block).build()
}
+ fun workflow(workflow: Workflow) {
+ if (workflows == null)
+ workflows = hashMapOf()
+ workflows!![workflow.id!!] = workflow
+ }
+
//TODO("populate inputs, outputs")
fun workflowNodeTemplate(actionName: String,
nodeTemplateType: String, description: String, block: NodeTemplateBuilder.() -> Unit) {
@@ -113,18 +125,30 @@ class NodeTemplateBuilder(private val id: String,
artifacts!![id] = ArtifactDefinitionBuilder(id, type, file).apply(block).build()
}
+ fun artifacts(artifacts: MutableMap<String, ArtifactDefinition>?) {
+ this.artifacts = artifacts
+ }
+
fun capability(id: String, block: CapabilityAssignmentBuilder.() -> Unit) {
if (capabilities == null)
capabilities = hashMapOf()
capabilities!![id] = CapabilityAssignmentBuilder(id).apply(block).build()
}
+ fun capabilities(capabilities: MutableMap<String, CapabilityAssignment>?) {
+ this.capabilities = capabilities
+ }
+
fun requirement(id: String, capability: String, node: String, relationship: String) {
if (requirements == null)
requirements = hashMapOf()
requirements!![id] = RequirementAssignmentBuilder(id, capability, node, relationship).build()
}
+ fun requirements(requirements: MutableMap<String, RequirementAssignment>?) {
+ this.requirements = requirements
+ }
+
fun build(): NodeTemplate {
nodeTemplate.id = id
nodeTemplate.type = type
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
index 8afe695ca..6dc5647da 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintTypeDSLBuilder.kt
@@ -384,6 +384,10 @@ class PropertyDefinitionBuilder(private val id: String,
propertyDefinition.defaultValue = defaultValue
}
+ fun value(value: Any) {
+ value(value.asJsonType())
+ }
+
fun value(value: JsonNode) {
propertyDefinition.value = value
}