package org.onap.ccsdk.cds.controllerblueprints.core.dsl
import com.fasterxml.jackson.databind.JsonNode
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
-import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintTypes
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.data.ArtifactType
import org.onap.ccsdk.cds.controllerblueprints.core.data.DataType
version: String,
author: String,
tags: String,
- block: DSLBluePrintBuilder.() -> Unit
-): DSLBluePrint {
- return DSLBluePrintBuilder(name, version, author, tags).apply(block).build()
+ block: DSLBlueprintBuilder.() -> Unit
+): DSLBlueprint {
+ return DSLBlueprintBuilder(name, version, author, tags).apply(block).build()
}
// TOSCA DSLs
/** Blueprint Type Extensions */
fun ServiceTemplateBuilder.nodeTypeComponent() {
- val nodeType = BluePrintTypes.nodeTypeComponent()
+ val nodeType = BlueprintTypes.nodeTypeComponent()
if (this.nodeTypes == null) this.nodeTypes = hashMapOf()
this.nodeTypes!![nodeType.id!!] = nodeType
}
-fun BluePrintTypes.nodeTypeComponent(): NodeType {
+fun BlueprintTypes.nodeTypeComponent(): NodeType {
return nodeType(
- id = BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ id = BlueprintConstants.MODEL_TYPE_NODE_COMPONENT,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT,
description = "This is default Component Node"
) {
}
}
@Deprecated("CDS won't support, use implerative workflow definitions.")
-fun BluePrintTypes.nodeTypeWorkflow(): NodeType {
+fun BlueprintTypes.nodeTypeWorkflow(): NodeType {
return nodeType(
- id = BluePrintConstants.MODEL_TYPE_NODE_WORKFLOW,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ id = BlueprintConstants.MODEL_TYPE_NODE_WORKFLOW,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT,
description = "This is default Workflow Node"
) {
}
}
fun ServiceTemplateBuilder.nodeTypeVnf() {
- val nodeType = BluePrintTypes.nodeTypeVnf()
+ val nodeType = BlueprintTypes.nodeTypeVnf()
if (this.nodeTypes == null) this.nodeTypes = hashMapOf()
this.nodeTypes!![nodeType.id!!] = nodeType
}
-fun BluePrintTypes.nodeTypeVnf(): NodeType {
+fun BlueprintTypes.nodeTypeVnf(): NodeType {
return nodeType(
- id = BluePrintConstants.MODEL_TYPE_NODE_VNF,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ id = BlueprintConstants.MODEL_TYPE_NODE_VNF,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT,
description = "This is default VNF Node"
) {
}
}
fun ServiceTemplateBuilder.nodeTypeResourceSource() {
- val nodeType = BluePrintTypes.nodeTypeResourceSource()
+ val nodeType = BlueprintTypes.nodeTypeResourceSource()
if (this.nodeTypes == null) this.nodeTypes = hashMapOf()
this.nodeTypes!![nodeType.id!!] = nodeType
}
-fun BluePrintTypes.nodeTypeResourceSource(): NodeType {
+fun BlueprintTypes.nodeTypeResourceSource(): NodeType {
return nodeType(
- id = BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ id = BlueprintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_NODES_ROOT,
description = "This is default Resource Source Node"
) {
}
/** Artifacts */
fun ServiceTemplateBuilder.artifactTypeTemplateVelocity() {
- val artifactType = BluePrintTypes.artifactTypeTemplateVelocity()
+ val artifactType = BlueprintTypes.artifactTypeTemplateVelocity()
if (this.artifactTypes == null) this.artifactTypes = hashMapOf()
this.artifactTypes!![artifactType.id!!] = artifactType
}
-fun BluePrintTypes.artifactTypeTemplateVelocity(): ArtifactType {
+fun BlueprintTypes.artifactTypeTemplateVelocity(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_VELOCITY,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "Velocity Artifact"
) {
fileExt("vtl")
}
fun ServiceTemplateBuilder.artifactTypeTempleJinja() {
- val artifactType = BluePrintTypes.artifactTypeTempleJinja()
+ val artifactType = BlueprintTypes.artifactTypeTempleJinja()
if (this.artifactTypes == null) this.artifactTypes = hashMapOf()
this.artifactTypes!![artifactType.id!!] = artifactType
}
-fun BluePrintTypes.artifactTypeTempleJinja(): ArtifactType {
+fun BlueprintTypes.artifactTypeTempleJinja(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_TEMPLATE_JINJA,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "Jinja Artifact"
) {
fileExt("jinja")
}
fun ServiceTemplateBuilder.artifactTypeMappingResource() {
- val artifactType = BluePrintTypes.artifactTypeMappingResource()
+ val artifactType = BlueprintTypes.artifactTypeMappingResource()
if (this.artifactTypes == null) this.artifactTypes = hashMapOf()
this.artifactTypes!![artifactType.id!!] = artifactType
}
-fun BluePrintTypes.artifactTypeMappingResource(): ArtifactType {
+fun BlueprintTypes.artifactTypeMappingResource(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_MAPPING_RESOURCE,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "Mapping Resource Artifact"
) {
fileExt("json")
}
@Deprecated("CDS won't support", replaceWith = ReplaceWith("artifactTypeScriptKotlin"))
-fun BluePrintTypes.artifactTypeScriptJython(): ArtifactType {
+fun BlueprintTypes.artifactTypeScriptJython(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_JYTHON,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "Jython Script Artifact"
) {
fileExt("py")
}
fun ServiceTemplateBuilder.artifactTypeScriptKotlin() {
- val artifactType = BluePrintTypes.artifactTypeScriptKotlin()
+ val artifactType = BlueprintTypes.artifactTypeScriptKotlin()
if (this.artifactTypes == null) this.artifactTypes = hashMapOf()
this.artifactTypes!![artifactType.id!!] = artifactType
}
-fun BluePrintTypes.artifactTypeScriptKotlin(): ArtifactType {
+fun BlueprintTypes.artifactTypeScriptKotlin(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_SCRIPT_KOTLIN,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "Kotlin Script Artifact"
) {
fileExt("kts")
}
fun ServiceTemplateBuilder.artifactTypeK8sProfileFolder() {
- val artifactType = BluePrintTypes.artifactTypeK8sProfileFolder()
+ val artifactType = BlueprintTypes.artifactTypeK8sProfileFolder()
if (this.artifactTypes == null) this.artifactTypes = hashMapOf()
this.artifactTypes!![artifactType.id!!] = artifactType
}
-fun BluePrintTypes.artifactTypeK8sProfileFolder(): ArtifactType {
+fun BlueprintTypes.artifactTypeK8sProfileFolder(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_K8S_PROFILE,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "K8s Profile Folder Artifact"
) {
}
}
@Deprecated("CDS won't support, use implerative workflow definitions.")
-fun BluePrintTypes.artifactTypeDirectedGraph(): ArtifactType {
+fun BlueprintTypes.artifactTypeDirectedGraph(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_DIRECTED_GRAPH,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "Directed Graph Artifact"
) {
fileExt("xml", "json")
}
fun ServiceTemplateBuilder.artifactTypeComponentJar() {
- val artifactType = BluePrintTypes.artifactTypeComponentJar()
+ val artifactType = BlueprintTypes.artifactTypeComponentJar()
if (this.artifactTypes == null) this.artifactTypes = hashMapOf()
this.artifactTypes!![artifactType.id!!] = artifactType
}
-fun BluePrintTypes.artifactTypeComponentJar(): ArtifactType {
+fun BlueprintTypes.artifactTypeComponentJar(): ArtifactType {
return artifactType(
- id = BluePrintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
+ id = BlueprintConstants.MODEL_TYPE_ARTIFACT_COMPONENT_JAR,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION,
description = "Component Artifact"
) {
fileExt("jar")
/** Relationship Types */
fun ServiceTemplateBuilder.relationshipTypeConnectsTo() {
- val relationshipType = BluePrintTypes.relationshipTypeConnectsTo()
+ val relationshipType = BlueprintTypes.relationshipTypeConnectsTo()
if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf()
this.relationshipTypes!![relationshipType.id!!] = relationshipType
}
-fun BluePrintTypes.relationshipTypeConnectsTo(): RelationshipType {
+fun BlueprintTypes.relationshipTypeConnectsTo(): RelationshipType {
return relationshipType(
- id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ id = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
description = "Relationship connects to"
) {
- validTargetTypes(arrayListOf(BluePrintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT))
+ validTargetTypes(arrayListOf(BlueprintConstants.MODEL_TYPE_CAPABILITY_TYPE_ENDPOINT))
}
}
fun ServiceTemplateBuilder.relationshipTypeDependsOn() {
- val relationshipType = BluePrintTypes.relationshipTypeDependsOn()
+ val relationshipType = BlueprintTypes.relationshipTypeDependsOn()
if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf()
this.relationshipTypes!![relationshipType.id!!] = relationshipType
}
-fun BluePrintTypes.relationshipTypeDependsOn(): RelationshipType {
+fun BlueprintTypes.relationshipTypeDependsOn(): RelationshipType {
return relationshipType(
- id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ id = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
description = "Relationship depends on"
) {
}
}
fun ServiceTemplateBuilder.relationshipTypeHostedOn() {
- val relationshipType = BluePrintTypes.relationshipTypeHostedOn()
+ val relationshipType = BlueprintTypes.relationshipTypeHostedOn()
if (this.relationshipTypes == null) this.relationshipTypes = hashMapOf()
this.relationshipTypes!![relationshipType.id!!] = relationshipType
}
-fun BluePrintTypes.relationshipTypeHostedOn(): RelationshipType {
+fun BlueprintTypes.relationshipTypeHostedOn(): RelationshipType {
return relationshipType(
- id = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
- version = BluePrintConstants.DEFAULT_VERSION_NUMBER,
- derivedFrom = BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ id = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
+ version = BlueprintConstants.DEFAULT_VERSION_NUMBER,
+ derivedFrom = BlueprintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
description = "Relationship hosted on"
) {
}