summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/blueprint-core/src/test
diff options
context:
space:
mode:
authorBrinda Santh <brindasanth@in.ibm.com>2019-06-05 21:24:44 -0400
committerBrinda Santh <brindasanth@in.ibm.com>2019-06-05 21:24:44 -0400
commit07648810cc6a85629b525158fbac029e40df51e4 (patch)
tree015b2b01defec3a2e637ca284e2e8080453982d0 /ms/controllerblueprints/modules/blueprint-core/src/test
parente953ae91f7c74c12aa5770da9e967c03dd21a44c (diff)
Add service template types DSL
Change-Id: I24684a6987150a02334b2b1b026893b240eb17a9 Issue-ID: CCSDK-1380 Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/blueprint-core/src/test')
-rw-r--r--ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt67
1 files changed, 64 insertions, 3 deletions
diff --git a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
index 2c0192534..dff0f943f 100644
--- a/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
+++ b/ms/controllerblueprints/modules/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/dsl/BluePrintDSLTest.kt
@@ -17,17 +17,21 @@
package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import org.junit.Test
+import org.onap.ccsdk.cds.controllerblueprints.core.jsonAsJsonType
import kotlin.test.assertNotNull
class BluePrintDSLTest {
@Test
fun testServiceTemplate() {
val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
- "brindasanth@onap.com", "sample") {
+ "brindasanth@onap.com", "sample, blueprints") {
metadata("release", "1806")
+ import("Definition/data_types.json")
+ dsl("rest-endpoint", """{ "selector" : "odl-selector"}""")
+ dsl("db-endpoint", """{ "selector" : "db-selector"}""")
topologyTemplate {
nodeTemplateOperation(nodeTemplateName = "activate", type = "sample-node-type", interfaceName = "RestconfExecutor",
- operationName = "process", description = "sample activation") {
+ description = "sample activation") {
inputs {
property("json-content", """{ "name" : "cds"}""")
property("array-content", """["controller", "blueprints"]""")
@@ -36,10 +40,47 @@ class BluePrintDSLTest {
property("string-value", "sample")
property("input-expression", getInput("key-1"))
property("self-property-expression", getProperty("key-1"))
- property("self-attribute-expression", getAttribute("key-1"))
property("self-artifact-expression", getArtifact("key-1"))
property("other-artifact-expression", getNodeTemplateArtifact("node-1", "key-1"))
}
+ outputs {
+ property("self-attribute-expression", getAttribute("key-1"))
+ }
+ }
+ // Other way of defining Node Template with artifacts, implementation
+ nodeTemplate("resolve", "sample-resolve-type", "Resource Resolution") {
+ operation("ResourceResolutionExecutor", "") {
+ implementation(180)
+ inputs {
+ property("boolean-value", true)
+ property("string-value", "sample")
+ }
+ outputs {
+ property("resolve-expression", getAttribute("key-1"))
+ }
+ }
+ artifact("sample-template", "artifact-velocity", "Templates/sample-template.vtl")
+ }
+
+ workflow("resource-resolution", "to resolve resources") {
+ step("resource-resolution-call", "resolve", "Resource Resolution component invoke")
+ }
+ // Alternate way to define workflow
+ workflow("activate", "to resolve resources") {
+ // Alternate step definition
+ step("netconf-activate-call", "activate", "call activation component") {
+ success("END")
+ failure("END")
+ }
+ inputs {
+ property("request-content", "json", true)
+ }
+ outputs {
+ property("response-content", "json", true) {
+ value(getAttribute("key-1"))
+ defaultValue("""{ "status" : "success"}""".jsonAsJsonType())
+ }
+ }
}
}
}
@@ -49,4 +90,24 @@ class BluePrintDSLTest {
assertNotNull(serviceTemplate.topologyTemplate?.nodeTemplates!!["activate"], "failed to get nodeTypes(activate)")
//println(JacksonUtils.getJson(serviceTemplate, true))
}
+
+ @Test
+ fun testServiceTemplateWorkflow() {
+ val serviceTemplate = serviceTemplate("sample-bp", "1.0.0",
+ "brindasanth@onap.com", "sample, blueprints") {
+ topologyTemplate {
+ workflowNodeTemplate("activate", "component-resource-resolution", "") {
+ operation("ResourceResolutionExecutor", "") {
+ inputs {
+ property("string-value", "sample")
+ }
+ }
+ }
+ }
+ }
+ assertNotNull(serviceTemplate.topologyTemplate, "failed to get topology template")
+ assertNotNull(serviceTemplate.topologyTemplate?.workflows?.get("activate"), "failed to get workflow(activate)")
+ //println(JacksonUtils.getJson(serviceTemplate, true))
+ }
+
}