summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json51
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/relationship_types.json23
-rw-r--r--components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt89
-rw-r--r--components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.SshClient.json15
4 files changed, 123 insertions, 55 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json
index df50fea44..e73f96ded 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json
@@ -1,12 +1,13 @@
{
"tosca_definitions_version": "controller_blueprint_1_0_0",
"metadata": {
- "template_author": "Brinda Santh Muthuramalingam",
+ "template_author": "Brinda Santh",
"author-email": "brindasanth@in.ibm.com",
"user-groups": "ADMIN, OPERATION",
"template_name": "capability-cli",
"template_version": "1.0.0",
- "template_tags": "brinda, tosca"
+ "template_tags": "capability-cli-blueprint",
+ "template_type": "DEFAULT"
},
"imports": [
{
@@ -47,6 +48,17 @@
"topology_template": {
"workflows": {
"check": {
+ "steps": {
+ "activate-process": {
+ "description": "Check CLI",
+ "target": "check",
+ "activities": [
+ {
+ "call_operation": "ComponentScriptExecutor.process"
+ }
+ ]
+ }
+ },
"inputs": {
"hostname": {
"required": true,
@@ -64,17 +76,6 @@
"required": true,
"type": "json"
}
- },
- "steps": {
- "activate-process": {
- "description": "Check CLI",
- "target": "check",
- "activities": [
- {
- "call_operation": "ComponentScriptExecutor.process"
- }
- ]
- }
}
}
},
@@ -86,7 +87,9 @@
"operations": {
"process": {
"implementation": {
- "primary": "component-script"
+ "primary": "component-script",
+ "timeout": 180,
+ "operation_host": "SELF"
},
"inputs": {
"script-type": "kotlin",
@@ -107,6 +110,26 @@
}
}
}
+ },
+ "relationship_templates": {
+ "ssh-connection-config": {
+ "type": "tosca.relationships.ConnectsTo.SshClient",
+ "description": "Device connection config",
+ "properties": {
+ "connection-config": {
+ "password": {
+ "get_input": "password"
+ },
+ "host": {
+ "get_input": "hostname"
+ },
+ "type": "basic-auth",
+ "username": {
+ "get_input": "username"
+ }
+ }
+ }
+ }
}
}
} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/relationship_types.json
index 4ddd7a57c..b56c77a80 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/relationship_types.json
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/relationship_types.json
@@ -1,3 +1,24 @@
{
- "relationship_types" : { }
+ "relationship_types": {
+ "tosca.relationships.ConnectsTo": {
+ "description": "Relationship tosca.relationships.ConnectsTo",
+ "version": "1.0.0",
+ "derived_from": "tosca.relationships.Root"
+ },
+ "tosca.relationships.ConnectsTo.SshClient": {
+ "description": "Relationship connects to through SSH Client.",
+ "version": "1.0.0",
+ "properties": {
+ "connection-config": {
+ "description": "Connection Config details.",
+ "required": true,
+ "type": "map"
+ }
+ },
+ "derived_from": "tosca.relationships.ConnectsTo",
+ "valid_target_types": [
+ "tosca.capabilities.Endpoint"
+ ]
+ }
+ }
} \ No newline at end of file
diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt
index 2d35e262c..3700a0bad 100644
--- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt
+++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCliDefinitions.kt
@@ -18,11 +18,14 @@ package cba.capability.cli
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTemplateComponentScriptExecutor
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor
+import org.onap.ccsdk.cds.blueprintsprocessor.ssh.basicAuthSshProperties
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.data.ServiceTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.artifactTypeTemplateVelocity
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getAttribute
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.getInput
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.nodeTypeComponent
+import org.onap.ccsdk.cds.controllerblueprints.core.dsl.relationshipTypeConnectsTo
import org.onap.ccsdk.cds.controllerblueprints.core.dsl.serviceTemplate
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.AbstractBluePrintDefinitions
@@ -34,54 +37,60 @@ class CapabilityCliDefinitions : AbstractBluePrintDefinitions() {
}
fun CapabilityCliDefinitions.defaultServiceTemplate() =
- serviceTemplate(name = "capability-cli",
- version = "1.0.0",
- author = "Brinda Santh Muthuramalingam",
- tags = "brinda, tosca") {
+ serviceTemplate(
+ name = "capability-cli",
+ version = "1.0.0",
+ author = "Brinda Santh Muthuramalingam",
+ tags = "brinda, tosca"
+ ) {
- dsl("device-properties", """{
- "type": "basic-auth",
- "host": { "get_input": "hostname" },
- "username": { "get_input": "username" },
- "password": { "get_input": "password" }
- }""".trimIndent())
+ dsl("device-properties", BluePrintTypes.basicAuthSshProperties {
+ host(getInput("hostname"))
+ password(getInput("password"))
+ username(getInput("username"))
+ })
- topologyTemplate {
+ topologyTemplate {
+ workflow(id = "check", description = "CLI Check Workflow") {
+ inputs {
+ property(id = "hostname", type = "string", required = true, description = "")
+ property(id = "username", type = "string", required = true, description = "")
+ property(id = "password", type = "string", required = true, description = "")
+ property(id = "data", type = "json", required = true, description = "")
+ }
+ outputs {
+ property(id = "status", required = true, type = "string", description = "") {
+ value("success")
+ }
+ }
+ step(id = "check", target = "check", description = "Calling check script node")
+ }
- workflow(id = "check", description = "CLI Check Workflow") {
+ val checkComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(id = "check", description = "") {
+ definedOperation(description = "") {
inputs {
- property(id = "hostname", type = "string", required = true, description = "")
- property(id = "username", type = "string", required = true, description = "")
- property(id = "password", type = "string", required = true, description = "")
- property(id = "data", type = "json", required = true, description = "")
+ type("kotlin")
+ scriptClassReference("cba.capability.cli.Check")
}
outputs {
- property(id = "status", required = true, type = "string", description = "") {
- value("success")
- }
+ status(getAttribute("status"))
+ responseData("""{ "data" : "Here I am "}""")
}
- step(id = "check", target = "check", description = "Calling check script node")
}
-
- val checkComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(id = "check", description = "") {
- definedOperation(description = "") {
- inputs {
- type("kotlin")
- scriptClassReference("cba.capability.cli.Check")
- }
- outputs {
- status(getAttribute("status"))
- responseData("""{ "data" : "Here I am "}""")
- }
- }
- artifact(id = "command-template", type = "artifact-template-velocity",
- file = "Templates/check-command-template.vtl")
- }
- nodeTemplate(checkComponent)
+ artifact(
+ id = "command-template", type = "artifact-template-velocity",
+ file = "Templates/check-command-template.vtl"
+ )
}
+ nodeTemplate(checkComponent)
+ }
- artifactType(BluePrintTypes.artifactTypeTemplateVelocity())
- nodeType(BluePrintTypes.nodeTypeComponent())
- nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor())
+ /** Artifact Types */
+ artifactType(BluePrintTypes.artifactTypeTemplateVelocity())
+ /** Node Types */
+ nodeType(BluePrintTypes.nodeTypeComponent())
+ nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor())
+ /** Relationship Types */
+ relationshipType(BluePrintTypes.relationshipTypeConnectsTo())
- } \ No newline at end of file
+ }
diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.SshClient.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.SshClient.json
new file mode 100644
index 000000000..11d0d18f1
--- /dev/null
+++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.SshClient.json
@@ -0,0 +1,15 @@
+{
+ "description": "Relationship connects to through SSH Client.",
+ "version": "1.0.0",
+ "properties": {
+ "connection-config": {
+ "description": "Connection Config details.",
+ "required": true,
+ "type": "map"
+ }
+ },
+ "derived_from": "tosca.relationships.ConnectsTo",
+ "valid_target_types": [
+ "tosca.capabilities.Endpoint"
+ ]
+} \ No newline at end of file