diff options
author | Brinda Santh <bs2796@att.com> | 2019-12-27 15:43:53 -0500 |
---|---|---|
committer | KAPIL SINGAL <ks220y@att.com> | 2019-12-30 18:18:57 +0000 |
commit | 1fdaf4953daf15970afe6ee10491dfa2d0a76753 (patch) | |
tree | a820366a5de5ac7f44492a11f88de7f4f24350f7 /components/model-catalog | |
parent | 41712e142c8d2b2bff9bc9e094f45306a60d7cb9 (diff) |
Runtime services for Relationship Type and Templates
Added and improved blueprint runtime service property resolution api.
Relationship template CBA sample
Performance improvement on Artifact resolutions.
Added connection config DSL for DB, GRPC connections.
Added starter relationship connection config models.
Issue-ID: CCSDK-1054
Signed-off-by: Brinda Santh <bs2796@att.com>
Change-Id: I73e1deed708dc924352867ddd1d1b2271c8ea106
Diffstat (limited to 'components/model-catalog')
12 files changed, 156 insertions, 35 deletions
diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json index 70c1bc3c6..639c21490 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/activation-blueprint.json @@ -352,6 +352,23 @@ } } }, + "relationship_templates": { + "cli-device-properties": { + "type": "tosca.relationships.ConnectsTo.SshClient", + "description": "SSH Connection", + "properties": { + "connection-config": { + "password": "sample-password", + "host": { + "get_input": "hostname" + }, + "type": "basic-auth", + "connectionTimeOut": 30, + "username": "sample-user" + } + } + } + }, "workflows": { "resource-assignment": { "inputs": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json index 87d2dc586..b56c77a80 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json +++ b/components/model-catalog/blueprint-model/test-blueprint/baseconfiguration/Definitions/relationship_types.json @@ -4,6 +4,21 @@ "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/Definitions/capability-cli-blueprint.json b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Definitions/capability-cli-blueprint.json index e73f96ded..04d0752fd 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 @@ -26,25 +26,6 @@ "file": "Definitions/policy_types.json" } ], - "dsl_definitions": { - "config-deploy-properties": { - "resolution-key": { - "get_input": "resolution-key" - } - }, - "device-properties": { - "type": "basic-auth", - "host": { - "get_input": "hostname" - }, - "username": { - "get_input": "username" - }, - "password": { - "get_input": "password" - } - } - }, "topology_template": { "workflows": { "check": { diff --git a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt index 7bda62810..e29055634 100644 --- a/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt +++ b/components/model-catalog/blueprint-model/test-blueprint/capability_cli/Scripts/kotlin/cba/capability/cli/CapabilityCli.kt @@ -24,7 +24,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString import org.onap.ccsdk.cds.controllerblueprints.core.logger import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintDependencyService - open class Check : AbstractScriptComponentFunction() { private val log = logger(Check::class) @@ -45,8 +44,8 @@ open class Check : AbstractScriptComponentFunction() { log.info("Check Commands :$checkCommands") - // Get the Device Information from the DSL Model - val deviceInformation = bluePrintRuntimeService.resolveDSLExpression("device-properties") + // Get the Device Information from the Relationship Model + val deviceInformation = relationshipProperty("ssh-connection-config", "connection-config") log.info("Device Info :$deviceInformation") @@ -54,10 +53,9 @@ open class Check : AbstractScriptComponentFunction() { val sshClientService = BluePrintDependencyService.sshClientService(deviceInformation) log.info("Client service is ready") - } override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) { log.info("Executing Recovery") } -}
\ 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 3700a0bad..a4a2ccf61 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,8 +18,11 @@ 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.blueprintsprocessor.ssh.relationshipTemplateSshClient +import org.onap.ccsdk.cds.blueprintsprocessor.ssh.relationshipTypeConnectsToSshClient +import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes +import org.onap.ccsdk.cds.controllerblueprints.core.asJsonString 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 @@ -43,13 +46,6 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() = author = "Brinda Santh Muthuramalingam", tags = "brinda, tosca" ) { - - dsl("device-properties", BluePrintTypes.basicAuthSshProperties { - host(getInput("hostname")) - password(getInput("password")) - username(getInput("username")) - }) - topologyTemplate { workflow(id = "check", description = "CLI Check Workflow") { inputs { @@ -69,8 +65,8 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() = val checkComponent = BluePrintTypes.nodeTemplateComponentScriptExecutor(id = "check", description = "") { definedOperation(description = "") { inputs { - type("kotlin") - scriptClassReference("cba.capability.cli.Check") + type(BluePrintConstants.SCRIPT_KOTLIN) + scriptClassReference(Check::class) } outputs { status(getAttribute("status")) @@ -83,6 +79,15 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() = ) } nodeTemplate(checkComponent) + + /** Connection Configuration through Relationship **/ + relationshipTemplateSshClient("ssh-connection-config", "Device connection config") { + basicAuth { + host(getInput("hostname")) + password(getInput("password")) + username(getInput("username")) + } + } } /** Artifact Types */ @@ -91,6 +96,6 @@ fun CapabilityCliDefinitions.defaultServiceTemplate() = nodeType(BluePrintTypes.nodeTypeComponent()) nodeType(BluePrintTypes.nodeTypeComponentScriptExecutor()) /** Relationship Types */ + relationshipType(BluePrintTypes.relationshipTypeConnectsToSshClient()) relationshipType(BluePrintTypes.relationshipTypeConnectsTo()) - } diff --git a/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.Db.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.Db.json new file mode 100644 index 000000000..01e87d58a --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.Db.json @@ -0,0 +1,15 @@ +{ + "description": "Relationship connects to through Database.", + "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/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.GrpcClient.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.GrpcClient.json new file mode 100644 index 000000000..eea7a0d29 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.GrpcClient.json @@ -0,0 +1,15 @@ +{ + "description": "Relationship connects to through GRPC 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/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.GrpcServer.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.GrpcServer.json new file mode 100644 index 000000000..d98114350 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.GrpcServer.json @@ -0,0 +1,15 @@ +{ + "description": "Relationship connects to through GRPC Server.", + "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/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.MessageConsumer.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.MessageConsumer.json new file mode 100644 index 000000000..7de2fc286 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.MessageConsumer.json @@ -0,0 +1,15 @@ +{ + "description": "Relationship type connects to message consumer.", + "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/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.MessageProducer.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.MessageProducer.json new file mode 100644 index 000000000..d3c3580bc --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.MessageProducer.json @@ -0,0 +1,15 @@ +{ + "description": "Relationship connects to through message producer.", + "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/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.Nats.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.Nats.json new file mode 100644 index 000000000..be03484e0 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.Nats.json @@ -0,0 +1,15 @@ +{ + "description": "Relationship connects to through NATS 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/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.RestClient.json b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.RestClient.json new file mode 100644 index 000000000..9182dbfe5 --- /dev/null +++ b/components/model-catalog/definition-type/starter-type/relationship_type/tosca.relationships.ConnectsTo.RestClient.json @@ -0,0 +1,15 @@ +{ + "description": "Relationship connects to through", + "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 |