aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src
diff options
context:
space:
mode:
authorBrinda Santh <bs2796@att.com>2019-12-31 10:53:59 -0500
committerBrinda Santh <bs2796@att.com>2019-12-31 10:53:59 -0500
commitba75d2fad2b0111a510f4ee4cc87e658fb32ac4b (patch)
tree92c50b5bea79bb6c424aab6b0ac2e805a9e36e07 /ms/blueprintsprocessor/functions/resource-resolution/src
parent1fdaf4953daf15970afe6ee10491dfa2d0a76753 (diff)
Flexible DSL Types and Templates definition.
Easy search definitions Types and Templates inside ServiceTemplate DSL builder. Unit test modifications to support this change. Issue-ID: CCSDK-1054 Signed-off-by: Brinda Santh <bs2796@att.com> Change-Id: Ie944ff5f75f80c852555306e1a4e0fa7f5b803d7
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt28
1 files changed, 24 insertions, 4 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
index 25338c6ca..6573d0e9a 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
@@ -26,10 +26,18 @@ import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.data.NodeType
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.AbstractNodeTemplateOperationImplBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.PropertiesAssignmentBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.ServiceTemplateBuilder
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.TopologyTemplateBuilder
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeType
import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
/** Component Extensions **/
+fun ServiceTemplateBuilder.nodeTypeComponentResourceResolution() {
+ val nodeType = BluePrintTypes.nodeTypeComponentResourceResolution()
+ if (this.nodeTypes == null) this.nodeTypes = hashMapOf()
+ this.nodeTypes!![nodeType.id!!] = nodeType
+}
+
fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
return nodeType(
id = "component-resource-resolution", version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
@@ -112,19 +120,31 @@ fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
}
/** Component Builder */
+fun TopologyTemplateBuilder.nodeTemplateComponentResourceResolution(
+ id: String,
+ description: String,
+ block: ComponentResourceResolutionNodeTemplateBuilder.() -> Unit
+) {
+ val nodeTemplate = BluePrintTypes.nodeTemplateComponentResourceResolution(
+ id, description,
+ block
+ )
+ if (nodeTemplates == null) nodeTemplates = hashMapOf()
+ nodeTemplates!![nodeTemplate.id!!] = nodeTemplate
+}
+
fun BluePrintTypes.nodeTemplateComponentResourceResolution(
id: String,
description: String,
block: ComponentResourceResolutionNodeTemplateBuilder.() -> Unit
-):
- NodeTemplate {
+): NodeTemplate {
return ComponentResourceResolutionNodeTemplateBuilder(id, description).apply(block).build()
}
class ComponentResourceResolutionNodeTemplateBuilder(id: String, description: String) :
AbstractNodeTemplateOperationImplBuilder<PropertiesAssignmentBuilder,
- ComponentResourceResolutionNodeTemplateBuilder.InputsBuilder,
- ComponentResourceResolutionNodeTemplateBuilder.OutputsBuilder>(
+ ComponentResourceResolutionNodeTemplateBuilder.InputsBuilder,
+ ComponentResourceResolutionNodeTemplateBuilder.OutputsBuilder>(
id, "component-script-executor",
"ComponentResourceResolution",
description