diff options
20 files changed, 439 insertions, 724 deletions
diff --git a/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json index 7b9b7dd7..3eb4fedc 100644 --- a/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ b/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json @@ -2,7 +2,7 @@ "metadata": {
"template_author": "Brinda Santh Muthuramalingam",
"author-email": "brindasanth@gmail.com",
- "user-groups" : "ADMIN, OPERATION",
+ "user-groups": "ADMIN, OPERATION",
"template_name": "baseconfiguration",
"template_version": "1.0.0",
"template_tags": "brinda, tosca"
@@ -24,121 +24,125 @@ "hostname": {
"required": true,
"type": "string"
+ },
+ "template_name": {
+ "required": true,
+ "type": "string"
+ },
+ "template_version": {
+ "required": true,
+ "type": "string"
}
},
"node_templates": {
- "activate-process": {
- "type": "bpmn-activate",
- "properties": {
- "process-name": { "get_input" : "action-name" },
- "version" : { "get_property" : ["SELF", "process-name"] },
- "content": { "get_artifact" : ["SELF", "activate-process"] }
- },
- "artifacts": {
- "activate-process": {
- "type": "artifact-bpmn-camunda",
- "file": "Plans/ActivateProcess.bpmn"
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "properties":{
- "request-id": "1234"
+ "resource-assignment-ra-component": {
+ "capabilities": {
+ "component-node": {}
},
"interfaces": {
- "DefaultComponentNode": {
+ "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
- "action-name": { "get_input" : "action-name" },
+ "template-names": [
+ "base-config-template",
+ "licence-template"
+ ],
+ "action-name": {
+ "get_input": "action-name"
+ },
+ "template-name": {
+ "get_input": "template_name"
+ },
+ "template-version": {
+ "get_input": "template_version"
+ },
"resource-type": "vnf-type",
- "request-id": { "get_input" : "request-id" },
- "resource-id": { "get_input" : "hostname" },
- "template-content": { "get_artifact" : ["SELF", "baseconfig-template"] },
- "mapping-content": { "get_artifact" : ["SELF", "baseconfig-mapping"] }
+ "request-id": {
+ "get_input": "request-id"
+ },
+ "resource-id": {
+ "get_input": "hostname"
+ }
},
"outputs": {
- "resource-assignment-params": "",
- "status": ""
+ "resource-assignment-params": "success",
+ "status": "status"
}
}
}
}
},
- "artifacts": {
- "baseconfig-template": {
- "type": "artifact-template-velocity",
- "file": "Templates/baseconfig-template.vtl"
+ "type": "component-resource-assignment"
+ },
+ "resource-assignment-action": {
+ "properties": {
+ "mode": "sync",
+ "version": {
+ "get_input": "template_version"
},
- "baseconfig-mapping": {
- "type": "artifact-mapping-resource",
- "file": "Mappings/baseconfig-mapping.json"
+ "is-start-flow": false
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "resource-assignment-ra-component",
+ "relationship": "tosca.relationships.DependsOn"
+ }
+ },
+ "capabilities": {
+ "dg-node": {},
+ "content": {
+ "properties": {
+ "type": "json"
+ }
}
- }
- },
- "resource-assignment-py": {
- "type": "component-resource-assignment",
- "properties":{
- "request-id": "1234"
},
"interfaces": {
- "DefaultComponentNode": {
+ "CONFIG": {
"operations": {
- "process": {
- "implementation" :{
- "primary" : "component-script"
- },
+ "ResourceAssignment": {
"inputs": {
- "action-name": { "get_input" : "action-name" }
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
+ "params": []
}
}
}
}
},
- "artifacts": {
- "component-script": {
- "type": "artifact-script-python",
- "file": "Scripts/baseconfig-template.vtl"
- }
- }
+ "type": "dg-resource-assignment"
}
},
- "workflows":{
- "activate-process":{
- "steps" : {
- "call-resource-assignment" : {
- "description" : "Invoke Resource Assignment Component",
- "target" : "resource-assignment",
- "activities" : [
- {
- "call_operation": "ResourceAssignmentNode.process"
- }
- ],
- "on_success" : [
- "download-baseconfig"
- ]
- },
- "download-baseconfig" : {
- "description" : "Call Download Base Config Component",
- "target" : "activate-netconf",
- "activities" : [
+ "workflows": {
+ "activate-process": {
+ "steps": {
+ "call-resource-assignment": {
+ "description": "Invoke Resource Assignment Component",
+ "target": "resource-assignment",
+ "activities": [
+ {
+ "call_operation": "ResourceAssignmentNode.process"
+ }
+ ],
+ "on_success": [
+ "download-baseconfig"
+ ]
+ },
+ "download-baseconfig": {
+ "description": "Call Download Base Config Component",
+ "target": "activate-netconf",
+ "activities": [
{
"call_operation": "NetconfTransactionNode.process"
}
],
- "on_success" : [
+ "on_success": [
"download-licence"
]
},
- "download-licence" : {
- "description" : "Call Download Licence Component",
- "target" : "activate-netconf",
- "activities" : [
+ "download-licence": {
+ "description": "Call Download Licence Component",
+ "target": "activate-netconf",
+ "activities": [
{
"call_operation": "NetconfTransactionNode.process"
}
@@ -199,106 +203,119 @@ }
},
"node_types": {
- "bpmn-activate": {
- "description": "This is BPMN Activate node type",
+ "dg-resource-assignment": {
+ "description": "This is Resource Assignment Directed Graph",
"version": "1.0.0",
"properties": {
- "content": {
+ "mode": {
"required": false,
- "type": "string"
- },
- "process-name": {
- "required": false,
- "type": "string"
+ "type": "string",
+ "default": "sync"
},
"version": {
"required": false,
"type": "string",
- "default" : "LATEST"
+ "default": "LATEST"
+ },
+ "is-start-flow": {
+ "required": false,
+ "type": "boolean",
+ "default": false
}
},
- "derived_from": "tosca.nodes.Component"
- },
- "tosca.nodes.Component": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
+ "capabilities": {
+ "dg-node": {
+ "type": "tosca.capabilities.Node"
+ },
+ "content": {
+ "type": "tosca.capability.Content",
+ "properties": {
+ "type": {
+ "required": false,
+ "type": "string",
+ "default": "json"
+ },
+ "content": {
+ "required": false,
+ "type": "string"
+ }
+ }
+ }
+ },
+ "requirements": {
+ "component-dependency": {
+ "capability": "component-node",
+ "node": "component-resource-assignment",
+ "relationship": "tosca.relationships.DependsOn"
}
},
"interfaces": {
- "DefaultOperation": {
+ "CONFIG": {
"operations": {
- "validate": {
+ "ResourceAssignment": {
"inputs": {
- "action-name": {
- "description": "validate for action",
+ "params": {
"required": false,
- "type": "string"
+ "type": "list",
+ "entry_schema": {
+ "type": "datatype-property"
+ }
}
}
}
}
}
},
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
- "derived_from": "tosca.nodes.Root"
- },
- "tosca.nodes.component.Python": {
- "description": "This is Resource Assignment Python Component API",
- "version": "1.0.0",
- "derived_from": "tosca.nodes.Root"
+ "derived_from": "tosca.nodes.DG"
},
"component-resource-assignment": {
"description": "This is Resource Assignment Component API",
"version": "1.0.0",
- "properties": {
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
+ "capabilities": {
+ "component-node": {
+ "type": "tosca.capabilities.Node"
}
},
"interfaces": {
- "DefaultComponentNode": {
+ "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
"action-name": {
- "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
+ "description": "Action Name of the process",
+ "required": true,
"type": "string"
},
- "resource-type": {
- "required": false,
+ "template-name": {
+ "description": "Service Template Name.",
+ "required": true,
"type": "string"
},
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "template-version": {
+ "description": "Service Template Version.",
"required": true,
"type": "string"
},
- "resource-id": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "resource-type": {
+ "description": "Request type.",
"required": true,
"type": "string"
},
- "template-content": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "template-names": {
+ "description": "Name of the artifact Node Templates, to get the template Content.",
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
+ }
+ },
+ "request-id": {
+ "description": "Request Id, Unique Id for the request.",
"required": true,
"type": "string"
},
- "mapping-content": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
+ "resource-id": {
+ "description": "Resource Id.",
"required": true,
"type": "string"
}
@@ -319,64 +336,95 @@ },
"derived_from": "tosca.nodes.Component"
},
- "component-resource-assignment-python": {
+ "tosca.nodes.DG": {
+ "description": "This is Resource Assignment Component API",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+ },
+ "tosca.nodes.Component": {
"description": "This is Resource Assignment Component API",
"version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+ },
+ "tosca.nodes.component.Python": {
+ "description": "This is Resource Assignment Python Component API",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+ }
+ },
+ "data_types": {
+ "datatype-resource-assignment": {
+ "version": "1.0.0",
+ "description": "This is Resource Assignment Data Type",
"properties": {
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
+ "property": {
"required": true,
+ "type": "datatype-property"
+ },
+ "input-param": {
+ "required": true,
+ "type": "boolean"
+ },
+ "dictionary-name": {
+ "required": false,
"type": "string"
- }
- },
- "interfaces": {
- "DefaultComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
+ },
+ "dictionary-source": {
+ "required": false,
+ "type": "string"
+ },
+ "dependencies": {
+ "required": true,
+ "type": "list",
+ "entry_schema": {
+ "type": "string"
}
+ },
+ "status": {
+ "required": false,
+ "type": "string"
+ },
+ "message": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-date": {
+ "required": false,
+ "type": "string"
+ },
+ "updated-by": {
+ "required": false,
+ "type": "string"
}
},
- "derived_from": "tosca.nodes.component.Python"
- }
- },
- "data_types": {
- "sample-property" : {
- "description": "This is sample data type",
+ "derived_from": "tosca.datatypes.Root"
+ },
+ "datatype-property": {
"version": "1.0.0",
+ "description": "This is Entry point Input Data Type, which is dynamic datatype, The parameter names will be populated during the Design time for each inputs",
"properties": {
- "content": {
+ "type": {
+ "required": true,
+ "type": "string"
+ },
+ "description": {
"required": false,
"type": "string"
},
- "process-name": {
+ "required": {
+ "required": false,
+ "type": "boolean"
+ },
+ "default": {
"required": false,
"type": "string"
},
- "version": {
+ "entry_schema": {
"required": false,
- "type": "string",
- "default" : "LATEST"
+ "type": "string"
}
},
- "derived_from" : "tosca.datatypes.Root"
+ "derived_from": "tosca.datatypes.Root"
}
}
}
\ No newline at end of file diff --git a/components/core/load/model_type/node_type/tosca.nodes.Artifact.json b/components/core/load/model_type/node_type/tosca.nodes.Artifact.json new file mode 100644 index 00000000..81410527 --- /dev/null +++ b/components/core/load/model_type/node_type/tosca.nodes.Artifact.json @@ -0,0 +1,5 @@ +{
+ "description": "This is Deprecated Artifact Node Type.",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+}
\ No newline at end of file diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt index af3966aa..24514db5 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt @@ -51,6 +51,16 @@ object BluePrintTypes { )
@JvmStatic
+ val validRelationShipDerivedFroms: MutableList<String> = arrayListOf(
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROOT,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_DEPENDS_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_HOSTED_ON,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_CONNECTS_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ATTACH_TO,
+ BluePrintConstants.MODEL_TYPE_RELATIONSHIPS_ROUTES_TO
+ )
+
+ @JvmStatic
fun validModelTypes(): List<String> {
val validTypes: MutableList<String> = arrayListOf()
validTypes.add(BluePrintConstants.MODEL_DEFINITION_TYPE_DATA_TYPE)
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt index f38c317e..b125c594 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt @@ -130,6 +130,14 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe @Throws(BluePrintException::class)
override fun enrichNodeType(nodeTypeName: String, nodeType: NodeType) {
+ log.debug("Enriching NodeType({})", nodeTypeName)
+ val derivedFrom = nodeType.derivedFrom
+
+ if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
+ val derivedFromNodeType = populateNodeType(nodeTypeName)
+ // Enrich NodeType
+ enrichNodeType(derivedFrom, derivedFromNodeType)
+ }
// NodeType Property Definitions
enrichNodeTypeProperties(nodeTypeName, nodeType)
@@ -172,7 +180,7 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe open fun enrichNodeTypeInterfaces(nodeTypeName: String, nodeType: NodeType) {
nodeType.interfaces?.forEach { interfaceName, interfaceObj ->
// Populate Node type Interface Operation
- log.info("*** ** Enriching NodeType: {} Interface {}", nodeTypeName, interfaceName)
+ log.debug("Enriching NodeType({}) Interface({})", nodeTypeName, interfaceName)
populateNodeTypeInterfaceOperation(nodeTypeName, interfaceName, interfaceObj)
}
@@ -235,21 +243,25 @@ open class BluePrintEnhancerDefaultService(val bluePrintRepoService: BluePrintRe }
open fun populateNodeType(nodeTypeName: String): NodeType {
- val nodeType = bluePrintRepoService.getNodeType(nodeTypeName)?.block()
+
+ val nodeType = serviceTemplate.nodeTypes?.get(nodeTypeName)
+ ?: bluePrintRepoService.getNodeType(nodeTypeName)?.block()
?: throw BluePrintException(format("Couldn't get NodeType({}) from repo.", nodeTypeName))
serviceTemplate.nodeTypes?.put(nodeTypeName, nodeType)
return nodeType
}
open fun populateArtifactType(artifactTypeName: String): ArtifactType {
- val artifactType = bluePrintRepoService.getArtifactType(artifactTypeName)?.block()
+ val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
+ ?: bluePrintRepoService.getArtifactType(artifactTypeName)?.block()
?: throw BluePrintException(format("Couldn't get ArtifactType({}) from repo.", artifactTypeName))
serviceTemplate.artifactTypes?.put(artifactTypeName, artifactType)
return artifactType
}
open fun populateDataTypes(dataTypeName: String): DataType {
- val dataType = bluePrintRepoService.getDataType(dataTypeName)?.block()
+ val dataType = serviceTemplate.dataTypes?.get(dataTypeName)
+ ?: bluePrintRepoService.getDataType(dataTypeName)?.block()
?: throw BluePrintException(format("Couldn't get DataType({}) from repo.", dataTypeName))
serviceTemplate.dataTypes?.put(dataTypeName, dataType)
return dataType
diff --git a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt index a60f532e..2b11589d 100644 --- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt +++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt @@ -111,7 +111,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.add("dataTypes")
dataTypes.forEach { dataTypeName, dataType ->
paths.add(dataTypeName)
- message.appendln("--> Data Type :" + paths.joinToString(separator))
+ message.appendln("--> DataType :" + paths.joinToString(separator))
dataType.properties?.let { validatePropertyDefinitions(dataType.properties!!) }
paths.removeAt(paths.lastIndex)
}
@@ -136,7 +136,14 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { //Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
+ if(!BluePrintTypes.rootNodeTypes().contains(derivedFrom)){
+ serviceTemplate.nodeTypes?.get(derivedFrom)
+ ?: throw BluePrintException(format("Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
+ derivedFrom, nodeTypeName))
+ }
+
nodeType.properties?.let { validatePropertyDefinitions(nodeType.properties!!) }
+ nodeType.requirements?.let { validateRequirementDefinitions(nodeTypeName, nodeType) }
nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) }
paths.removeAt(paths.lastIndex)
}
@@ -144,7 +151,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { @Throws(BluePrintException::class)
open fun checkValidNodeTypesDerivedFrom(nodeTypeName: String, derivedFrom: String) {
check(BluePrintTypes.validNodeTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get node type ({})'s derived from({}) definition ", nodeTypeName, derivedFrom))
+ throw BluePrintException(format("Failed to get node type ({})'s derivedFrom({}) definition ", nodeTypeName, derivedFrom))
}
}
@@ -178,16 +185,16 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { @Throws(BluePrintException::class)
open fun validateNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
paths.add(nodeTemplateName)
- message.appendln("---> Node Template :" + paths.joinToString(separator))
+ message.appendln("---> NodeTemplate :" + paths.joinToString(separator))
val type: String = nodeTemplate.type
val nodeType: NodeType = serviceTemplate.nodeTypes?.get(type)
- ?: throw BluePrintException(format("Failed to get node type definition for node template : {}", nodeTemplateName))
+ ?: throw BluePrintException(format("Failed to get NodeType({}) definition for NodeTemplate({})", type, nodeTemplateName))
nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeTemplate.capabilities!!) }
- nodeTemplate.requirements?.let { validateRequirementAssignments(nodeTemplate.requirements!!) }
+ nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, nodeTemplateName, nodeTemplate) }
nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeType, nodeTemplateName, nodeTemplate) }
paths.removeAt(paths.lastIndex)
}
@@ -199,12 +206,12 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { paths.add(artifactDefinitionName)
message.appendln("Validating artifact " + paths.joinToString(separator))
val type: String = artifactDefinition.type
- ?: throw BluePrintException("type is missing for artifact definition :" + artifactDefinitionName)
+ ?: throw BluePrintException(format("type is missing for ArtifactDefinition({})", artifactDefinitionName))
// Check Artifact Type
checkValidArtifactType(artifactDefinitionName, type)
val file: String = artifactDefinition.file
- ?: throw BluePrintException(format("file is missing for artifact definition : {}", artifactDefinitionName))
+ ?: throw BluePrintException(format("file is missing for ArtifactDefinition({})", artifactDefinitionName))
paths.removeAt(paths.lastIndex)
}
@@ -250,7 +257,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { }
BluePrintTypes.validCollectionTypes().contains(dataType) -> {
val entrySchemaType: String = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Entry schema for data type ({}) for the property ({}) not found", dataType, propertyName))
+ ?: throw BluePrintException(format("Entry schema for DataType ({}) for the property ({}) not found", dataType, propertyName))
checkPrimitiveOrComplex(entrySchemaType, propertyName)
}
else -> checkPropertyDataType(dataType, propertyName)
@@ -289,7 +296,43 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { }
@Throws(BluePrintException::class)
- open fun validateRequirementAssignments(requirements: MutableMap<String, RequirementAssignment>) {
+ open fun validateRequirementAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+ val requirements = nodeTemplate.requirements
+ paths.add("requirements")
+ requirements?.forEach { requirementName, requirementAssignment ->
+ paths.add(requirementName)
+ val requirementDefinition = nodeType.requirements?.get(requirementName)
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) requirement definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, requirementName, nodeTemplate.type))
+ // Validate Requirement Assignment
+ validateRequirementAssignment(nodeTemplateName, requirementName, requirementDefinition, requirementAssignment)
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateRequirementAssignment(nodeTemplateName: String, requirementAssignmentName: String,
+ requirementDefinition: RequirementDefinition, requirementAssignment: RequirementAssignment) {
+ log.info("Validating NodeTemplate({}) requirement assignment ({}) ", nodeTemplateName, requirementAssignmentName)
+ val requirementNodeTemplateName = requirementAssignment.node!!
+ val capabilityName = requirementAssignment.capability
+ val relationship = requirementAssignment.relationship!!
+
+ check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
+ throw BluePrintException(format("Failed to get relationship type ({}) for NodeTemplate({})'s requirement({}) ",
+ relationship, nodeTemplateName, requirementAssignmentName))
+ }
+
+ val relationShipNodeTemplate = serviceTemplate.topologyTemplate?.nodeTemplates?.get(requirementNodeTemplateName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s for NodeTemplate({}) requirement({}) ",
+ requirementNodeTemplateName, nodeTemplateName, requirementAssignmentName))
+
+ relationShipNodeTemplate.capabilities?.get(capabilityName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeTemplate({})'s capability({}) for NodeTemplate ({})'s requirement({}) ",
+ requirementNodeTemplateName, capabilityName, nodeTemplateName, requirementAssignmentName))
+
}
@@ -301,8 +344,8 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { interfaces?.forEach { interfaceAssignmentName, interfaceAssignment ->
paths.add(interfaceAssignmentName)
val interfaceDefinition = nodeType.interfaces?.get(interfaceAssignmentName)
- ?: throw BluePrintException(format("Failed to get nodeTemplate({}) interface definition ({}) from" +
- " node type ({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type))
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) interface definition ({}) from" +
+ " NodeType({}) ", nodeTemplateName, interfaceAssignmentName, nodeTemplate.type))
validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
interfaceAssignment)
@@ -336,10 +379,10 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { it.forEach { operationAssignmentName, operationAssignments ->
val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
- ?: throw BluePrintException(format("Failed to get nodeTemplate({}) operation definition ({}) ",
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) ",
nodeTemplateName, operationAssignmentName))
- log.info("Validation Node Template({}) Interface({}) Operation ({})", nodeTemplateName,
+ log.info("Validation NodeTemplate({}) Interface({}) Operation ({})", nodeTemplateName,
interfaceAssignmentName, operationAssignmentName)
val inputs = operationAssignments.inputs
@@ -347,7 +390,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { inputs?.forEach { propertyName, propertyAssignment ->
val propertyDefinition = operationDefinition.inputs?.get(propertyName)
- ?: throw BluePrintException(format("Failed to get nodeTemplate({}) operation definition ({}) " +
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
"property definition({})", nodeTemplateName, operationAssignmentName, propertyName))
// Check the property values with property definition
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
@@ -358,6 +401,44 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { }
+ @Throws(BluePrintException::class)
+ open fun validateRequirementDefinitions(nodeName: String, nodeType: NodeType) {
+ paths.add("requirements")
+ val requirements = nodeType.requirements
+
+ requirements?.forEach { requirementDefinitionName, requirementDefinition ->
+ paths.add(requirementDefinitionName)
+ message.appendln("Validating : " + paths.joinToString(separator))
+ validateRequirementDefinition(nodeName, nodeType, requirementDefinitionName, requirementDefinition)
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateRequirementDefinition(nodeTypeName: String, nodeType: NodeType, requirementDefinitionName: String,
+ requirementDefinition: RequirementDefinition) {
+
+ log.info("Validating NodeType({}) RequirementDefinition ({}) ", nodeTypeName, requirementDefinitionName)
+ val requirementNodeTypeName = requirementDefinition.node!!
+ val capabilityName = requirementDefinition.capability
+ val relationship = requirementDefinition.relationship!!
+
+ check(BluePrintTypes.validRelationShipDerivedFroms.contains(relationship)) {
+ throw BluePrintException(format("Failed to get relationship({}) for NodeType({})'s requirement({}) ",
+ relationship, nodeTypeName, requirementDefinitionName))
+ }
+
+ val relationShipNodeType = serviceTemplate.nodeTypes?.get(requirementNodeTypeName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s for requirement({}) ",
+ requirementNodeTypeName, requirementDefinitionName))
+
+ relationShipNodeType.capabilities?.get(capabilityName)
+ ?: throw BluePrintException(format("Failed to get requirement NodeType({})'s capability({}) for NodeType ({})'s requirement({}) ",
+ requirementNodeTypeName, capabilityName, nodeTypeName, requirementDefinitionName))
+
+ }
+
@Throws(BluePrintException::class)
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
@@ -394,7 +475,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
- ?: throw BluePrintException(format("Failed to artifact type for artifact definition : {}", artifactDefinitionName))
+ ?: throw BluePrintException(format("Failed to ArtifactType for ArtifactDefinition : {}", artifactDefinitionName))
checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@@ -402,14 +483,21 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { @Throws(BluePrintException::class)
open fun checkValidArtifactTypeDerivedFrom(artifactTypeName: String, derivedFrom: String) {
check(BluePrintTypes.validArtifactTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get artifact type ({})'s derived from({}) definition ", artifactTypeName, derivedFrom))
+ throw BluePrintException(format("Failed to get ArtifactType ({})'s derivedFrom({}) definition ", artifactTypeName, derivedFrom))
}
}
@Throws(BluePrintException::class)
open fun checkValidDataTypeDerivedFrom(dataTypeName: String, derivedFrom: String) {
check(BluePrintTypes.validDataTypeDerivedFroms.contains(derivedFrom)) {
- throw BluePrintException(format("Failed to get data type ({})'s derived from({}) definition ", dataTypeName, derivedFrom))
+ throw BluePrintException(format("Failed to get DataType ({})'s derivedFrom({}) definition ", dataTypeName, derivedFrom))
+ }
+ }
+
+ @Throws(BluePrintException::class)
+ open fun checkValidRelationshipTypeDerivedFrom(relationshipTypeName: String, derivedFrom: String) {
+ check(BluePrintTypes.validRelationShipDerivedFroms.contains(derivedFrom)) {
+ throw BluePrintException(format("Failed to get relationship type ({})'s derivedFrom({}) definition ", relationshipTypeName, derivedFrom))
}
}
@@ -423,7 +511,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
val entrySchemaType = propertyDefinition.entrySchema?.type
- ?: throw BluePrintException(format("Failed to get Entry Schema type for the collection property ({})", propertyName))
+ ?: throw BluePrintException(format("Failed to get EntrySchema type for the collection property ({})", propertyName))
if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
checkPropertyDataType(entrySchemaType, propertyName)
@@ -435,7 +523,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { }
check(isValid) {
- throw BluePrintException(format("property({}) defined of type({}) is not compatable with the value ({})",
+ throw BluePrintException(format("property({}) defined of type({}) is not comptable with the value ({})",
propertyName, propertyType, propertyAssignment))
}
}
@@ -443,7 +531,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { private fun checkPropertyDataType(dataType: String, propertyName: String) {
val dataType = serviceTemplate.dataTypes?.get(dataType)
- ?: throw BluePrintException(format("Data type ({}) for the property ({}) not found", dataType, propertyName))
+ ?: throw BluePrintException(format("DataType ({}) for the property ({}) not found", dataType, propertyName))
checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
@@ -453,7 +541,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService { if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
return true
} else {
- throw BluePrintException(format("Data type ({}) for the property ({}) is not valid", dataType))
+ throw BluePrintException(format("DataType ({}) for the property ({}) is not valid", dataType))
}
}
diff --git a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt index 5d24b072..919dc564 100644 --- a/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt +++ b/components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt @@ -55,17 +55,17 @@ class BluePrintRuntimeServiceTest { context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
- val inputDataPath = "src/test/resources/data/default-context.json"
+ val inputDataPath = "src/test/resources/data/default-context.json"
val inputNode: JsonNode = jsonNodeFromFile(inputDataPath)
bluePrintRuntimeService.assignInputs(inputNode)
- val propContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateProperties("activate-process")
- log.info("Context {}" ,bluePrintRuntimeService.context)
+ val propContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateProperties("resource-assignment-action")
+ log.info("Context {}", bluePrintRuntimeService.context)
assertNotNull(propContext, "Failed to populate interface property values")
- assertEquals(propContext.get("process-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter process-name")
- assertEquals(propContext.get("version"), jsonNodeFromObject("sample-action"), "Failed to populate parameter version")
+ assertEquals(propContext.get("mode"), jsonNodeFromObject("sync"), "Failed to populate parameter process-name")
+ assertEquals(propContext.get("version"), jsonNodeFromObject("1.0.0"), "Failed to populate parameter version")
}
@Test
@@ -78,24 +78,22 @@ class BluePrintRuntimeServiceTest { val context: MutableMap<String, Any> = hashMapOf()
context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
- val inputDataPath = "src/test/resources/data/default-context.json"
+ val inputDataPath = "src/test/resources/data/default-context.json"
BluePrintRuntimeUtils.assignInputsFromFile(bluePrintContext, inputDataPath, context)
val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
- log.info("Prepared Context {}" ,context)
+ log.info("Prepared Context {}", context)
- val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment",
- "DefaultComponentNode", "process")
+ val inContext: MutableMap<String, Any?> = bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationInputs("resource-assignment-ra-component",
+ "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process")
- log.trace("In Context {}" ,inContext)
+ log.info("In Context {}", inContext)
assertNotNull(inContext, "Failed to populate interface input property values")
assertEquals(inContext.get("action-name"), jsonNodeFromObject("sample-action"), "Failed to populate parameter action-name")
assertEquals(inContext.get("request-id"), jsonNodeFromObject("12345"), "Failed to populate parameter action-name")
- assertEquals(inContext.get("template-content"), jsonNodeFromObject("This is Sample Velocity Template"), "Failed to populate parameter action-name")
-
}
@Test
@@ -106,24 +104,24 @@ class BluePrintRuntimeServiceTest { assertNotNull(bluePrintContext, "Failed to populate Blueprint context")
val context: MutableMap<String, Any> = hashMapOf()
- context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
+ context[BluePrintConstants.PROPERTY_BLUEPRINT_BASE_PATH] = basepath.plus("/simple-baseconfig")
val bluePrintRuntimeService = BluePrintRuntimeService(bluePrintContext, context)
val componentContext: MutableMap<String, Any?> = hashMapOf()
- val successValue : JsonNode= jsonNodeFromObject("Success")
- componentContext["resource-assignment.DefaultComponentNode.process.status"] = successValue
- componentContext["resource-assignment.DefaultComponentNode.process.resource-assignment-params"] = null
+ val successValue: JsonNode = jsonNodeFromObject("Success")
+ componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.status"] = successValue
+ componentContext["resource-assignment-ra-component.org-onap-sdnc-config-assignment-service-ConfigAssignmentNode.process.resource-assignment-params"] = null
- bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment",
- "DefaultComponentNode", "process", componentContext)
+ bluePrintRuntimeService.resolveNodeTemplateInterfaceOperationOutputs("resource-assignment-ra-component",
+ "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode", "process", componentContext)
assertEquals(NullNode.instance,
- context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/resource-assignment-params"),
+ context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/resource-assignment-params"),
"Failed to get operation property resource-assignment-params")
assertEquals(successValue,
- context.get("node_templates/resource-assignment/interfaces/DefaultComponentNode/operations/process/properties/status"),
+ context.get("node_templates/resource-assignment-ra-component/interfaces/org-onap-sdnc-config-assignment-service-ConfigAssignmentNode/operations/process/properties/status"),
"Failed to get operation property status")
diff --git a/components/core/src/test/resources/data/default-context.json b/components/core/src/test/resources/data/default-context.json index fcd4cbe2..e033f6f5 100644 --- a/components/core/src/test/resources/data/default-context.json +++ b/components/core/src/test/resources/data/default-context.json @@ -1,5 +1,7 @@ {
"request-id" : "12345",
"hostname" : "localhost",
+ "template_name": "baseconfiguration",
+ "template_version": "1.0.0",
"action-name" : "sample-action"
}
\ No newline at end of file diff --git a/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json index 851ded2c..d4fbf5cf 100644 --- a/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ b/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json @@ -217,7 +217,7 @@ "default" : "LATEST"
}
},
- "derived_from": "tosca.nodes.Component"
+ "derived_from": "tosca.nodes.DG"
},
"tosca.nodes.Component": {
"description": "This is Resource Assignment Component API",
@@ -253,6 +253,11 @@ },
"derived_from": "tosca.nodes.Root"
},
+ "tosca.nodes.DG" : {
+ "description" : "This is Directed Graph Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"tosca.nodes.component.Python": {
"description": "This is Resource Assignment Python Component API",
"version": "1.0.0",
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json new file mode 100644 index 00000000..81410527 --- /dev/null +++ b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Artifact.json @@ -0,0 +1,5 @@ +{
+ "description": "This is Deprecated Artifact Node Type.",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json deleted file mode 100644 index 851ded2c..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json +++ /dev/null @@ -1,411 +0,0 @@ -{
- "metadata": {
- "template_author": "Brinda Santh Muthuramalingam",
- "author-email": "brindasanth@gmail.com",
- "user-groups" : "ADMIN, OPERATION",
- "template_name": "baseconfiguration",
- "template_version": "1.0.0",
- "template_tags": "brinda, tosca"
- },
- "topology_template": {
- "inputs": {
- "request-id": {
- "required": true,
- "type": "string"
- },
- "action-name": {
- "required": true,
- "type": "string"
- },
- "scope-type": {
- "required": true,
- "type": "string"
- },
- "hostname": {
- "required": true,
- "type": "string"
- }
- },
- "node_templates": {
- "activate-process": {
- "type": "bpmn-activate",
- "properties": {
- "process-name": { "get_input" : "action-name" },
- "version" : { "get_property" : ["SELF", "process-name"] },
- "content": { "get_artifact" : ["SELF", "activate-process"] }
- },
- "artifacts": {
- "activate-process": {
- "type": "artifact-bpmn-camunda",
- "file": "Plans/ActivateProcess.bpmn"
- }
- }
- },
- "resource-assignment": {
- "type": "component-resource-assignment",
- "properties":{
- "request-id": "1234"
- },
- "interfaces": {
- "DefaultComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": { "get_input" : "action-name" },
- "resource-type": "vnf-type",
- "request-id": { "get_input" : "request-id" },
- "resource-id": { "get_input" : "hostname" },
- "template-content": { "get_artifact" : ["SELF", "baseconfig-template"] },
- "mapping-content": { "get_artifact" : ["SELF", "baseconfig-mapping"] }
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "artifacts": {
- "baseconfig-template": {
- "type": "artifact-template-velocity",
- "file": "Templates/baseconfig-template.vtl"
- },
- "baseconfig-mapping": {
- "type": "artifact-mapping-resource",
- "file": "Mappings/baseconfig-mapping.json"
- }
- }
- },
- "resource-assignment-py": {
- "type": "component-resource-assignment",
- "properties":{
- "request-id": "1234"
- },
- "interfaces": {
- "DefaultComponentNode": {
- "operations": {
- "process": {
- "implementation" :{
- "primary" : "component-script"
- },
- "inputs": {
- "action-name": { "get_input" : "action-name" }
- },
- "outputs": {
- "resource-assignment-params": "",
- "status": ""
- }
- }
- }
- }
- },
- "artifacts": {
- "component-script": {
- "type": "artifact-script-python",
- "file": "Scripts/baseconfig-template.vtl"
- }
- }
- }
- },
- "workflows":{
- "activate-process":{
- "steps" : {
- "call-resource-assignment" : {
- "description" : "Invoke Resource Assignment Component",
- "target" : "resource-assignment",
- "activities" : [
- {
- "call_operation": "ResourceAssignmentNode.process"
- }
- ],
- "on_success" : [
- "download-baseconfig"
- ]
- },
- "download-baseconfig" : {
- "description" : "Call Download Base Config Component",
- "target" : "activate-netconf",
- "activities" : [
- {
- "call_operation": "NetconfTransactionNode.process"
- }
- ],
- "on_success" : [
- "download-licence"
- ]
- },
- "download-licence" : {
- "description" : "Call Download Licence Component",
- "target" : "activate-netconf",
- "activities" : [
- {
- "call_operation": "NetconfTransactionNode.process"
- }
- ]
- }
- }
- }
- }
- },
- "artifact_types": {
- "artifact-template-velocity": {
- "description": " Velocity Template used for Configuration",
- "version": "1.0.0",
- "file_ext": [
- "vtl"
- ],
- "derived_from": "tosca.artifacts.Implementation"
- },
- "artifact-mapping-resource": {
- "description": " Velocity Template Resource Mapping File used along with Configuration template",
- "version": "1.0.0",
- "file_ext": [
- "json"
- ],
- "derived_from": "tosca.artifacts.Implementation"
- },
- "artifact-script-kotlin": {
- "description": " Kotlin Script Template used for Configuration",
- "version": "1.0.0",
- "file_ext": [
- "kt"
- ],
- "derived_from": "tosca.artifacts.Implementation"
- },
- "artifact-script-python": {
- "description": " Kotlin Script Template used for Configuration",
- "version": "1.0.0",
- "file_ext": [
- "py"
- ],
- "derived_from": "tosca.artifacts.Implementation"
- },
- "artifact-bpmn-camunda": {
- "description": " Camunda BPM File",
- "version": "1.0.0",
- "file_ext": [
- "bpmn"
- ],
- "derived_from": "tosca.artifacts.Implementation"
- },
- "artifact-component-jar": {
- "description": "Component Jar",
- "version": "1.0.0",
- "file_ext": [
- "jar"
- ],
- "derived_from": "tosca.artifacts.Implementation"
- }
- },
- "node_types": {
- "bpmn-activate": {
- "description": "This is BPMN Activate node type",
- "version": "1.0.0",
- "properties": {
- "content": {
- "required": false,
- "type": "string"
- },
- "process-name": {
- "required": false,
- "type": "string"
- },
- "version": {
- "required": false,
- "type": "string",
- "default" : "LATEST"
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "tosca.nodes.Component": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultOperation": {
- "operations": {
- "validate": {
- "inputs": {
- "action-name": {
- "description": "validate for action",
- "required": false,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
- "derived_from": "tosca.nodes.Root"
- },
- "tosca.nodes.component.Python": {
- "description": "This is Resource Assignment Python Component API",
- "version": "1.0.0",
- "properties": {
- "type": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": false,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultOperation": {
- "operations": {
- "validate": {
- "inputs": {
- "action-name": {
- "description": "validate for action",
- "required": false,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "artifacts" :{
- "component-jar": {
- "description": "Component Jar",
- "type": "artifact-component-jar",
- "file": "Component/basecomponent.jar"
- }
- },
- "derived_from": "tosca.nodes.Root"
- },
- "component-resource-assignment": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "properties": {
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- },
- "resource-type": {
- "required": false,
- "type": "string"
- },
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- },
- "resource-id": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- },
- "template-content": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- },
- "mapping-content": {
- "description": "Id used to pull the data content from the data base. Either template-data or resource-id should be present",
- "required": true,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.Component"
- },
- "component-resource-assignment-python": {
- "description": "This is Resource Assignment Component API",
- "version": "1.0.0",
- "properties": {
- "request-id": {
- "description": "Request Id used to store the generated configuration, in the database along with the template-name",
- "required": true,
- "type": "string"
- }
- },
- "interfaces": {
- "DefaultComponentNode": {
- "operations": {
- "process": {
- "inputs": {
- "action-name": {
- "description": "Recipe Name to get from Database, Either (message & mask-info ) or ( resource-id & resource-type & action-name & template-name ) should be present. Message will be given higest priority",
- "required": false,
- "type": "string"
- }
- },
- "outputs": {
- "resource-assignment-params": {
- "required": true,
- "type": "string"
- },
- "status": {
- "required": true,
- "type": "string"
- }
- }
- }
- }
- }
- },
- "derived_from": "tosca.nodes.component.Python"
- }
- },
- "data_types": {
- "sample-property" : {
- "description": "This is sample data type",
- "version": "1.0.0",
- "properties": {
- "content": {
- "required": false,
- "type": "string"
- },
- "process-name": {
- "required": false,
- "type": "string"
- },
- "version": {
- "required": false,
- "type": "string",
- "default" : "LATEST"
- }
- },
- "derived_from" : "tosca.datatypes.Root"
- }
- }
-}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json deleted file mode 100644 index 6abfb51b..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Mappings/baseconfig-mapping.json +++ /dev/null @@ -1,3 +0,0 @@ -{
- "assignments": "Sample Assignments"
-}
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn deleted file mode 100644 index 5e94c0f8..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Plans/ActivateProcess.bpmn +++ /dev/null @@ -1,66 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
- xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
- xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
- xmlns:camunda="http://camunda.org/schema/1.0/bpmn"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1"
- targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.2">
- <bpmn:process id="ActivateProcess" isExecutable="true">
- <bpmn:startEvent id="StartEvent_1">
- <bpmn:outgoing>SequenceFlow_0l0dq58</bpmn:outgoing>
- </bpmn:startEvent>
- <bpmn:endEvent id="EndEvent_1pr0kil">
- <bpmn:incoming>SequenceFlow_1ay0k6p</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0l0dq58" sourceRef="StartEvent_1" targetRef="activate_device_task"/>
- <bpmn:sequenceFlow id="SequenceFlow_1ay0k6p" sourceRef="activate_device_task" targetRef="EndEvent_1pr0kil"/>
- <bpmn:serviceTask id="activate_device_task" name="Activate Device"
- camunda:delegateExpression="${componentDelegateService}">
- <bpmn:extensionElements>
- <camunda:inputOutput>
- <camunda:inputParameter name="selector"><![CDATA[resource-assignment
-]]></camunda:inputParameter>
- </camunda:inputOutput>
- </bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0l0dq58</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1ay0k6p</bpmn:outgoing>
- </bpmn:serviceTask>
- </bpmn:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateProcess">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
- <dc:Bounds x="175" y="143" width="36" height="36"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="148" y="179" width="90" height="20"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_1pr0kil_di" bpmnElement="EndEvent_1pr0kil">
- <dc:Bounds x="575" y="114" width="36" height="36"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="593" y="154" width="0" height="12"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0l0dq58_di" bpmnElement="SequenceFlow_0l0dq58">
- <di:waypoint xsi:type="dc:Point" x="211" y="161"/>
- <di:waypoint xsi:type="dc:Point" x="273" y="161"/>
- <di:waypoint xsi:type="dc:Point" x="273" y="149"/>
- <di:waypoint xsi:type="dc:Point" x="334" y="149"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="288" y="149" width="0" height="12"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1ay0k6p_di" bpmnElement="SequenceFlow_1ay0k6p">
- <di:waypoint xsi:type="dc:Point" x="434" y="149"/>
- <di:waypoint xsi:type="dc:Point" x="505" y="149"/>
- <di:waypoint xsi:type="dc:Point" x="505" y="132"/>
- <di:waypoint xsi:type="dc:Point" x="575" y="132"/>
- <bpmndi:BPMNLabel>
- <dc:Bounds x="520" y="134.5" width="0" height="12"/>
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0e8ek4f_di" bpmnElement="activate_device_task">
- <dc:Bounds x="334" y="109" width="100" height="80"/>
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn:definitions>
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py deleted file mode 100644 index eb198c79..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/SamplePythonComponentNode.py +++ /dev/null @@ -1,8 +0,0 @@ -from com.brvith.orchestrator.core.interfaces import ComponentNode
-
-class SamplePythonComponentNode(ComponentNode):
- def prepare(self, context, componentContext):
- return None
-
- def prepare(self, context, componentContext):
- return None
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Scripts/__init__.py +++ /dev/null diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta deleted file mode 100644 index 05c2c67f..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/TOSCA-Metadata/TOSCA.meta +++ /dev/null @@ -1,8 +0,0 @@ -TOSCA-Meta-File-Version: 1.0.0
-CSAR-Version: 1.0
-Created-By: Brinda Santh M
-Entry-Definitions: Definitions/activation-blueprint.json
-Template-Tags: vrr-test, Brinda Santh
-
-Name: Plans/ActivateProcess.bpmn
-Content-Type: application/vnd.oasis.bpmn
diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl deleted file mode 100644 index 026c5917..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Templates/baseconfig-template.vtl +++ /dev/null @@ -1 +0,0 @@ -This is Sample Velocity Template
\ No newline at end of file diff --git a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py deleted file mode 100644 index e69de29b..00000000 --- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/__init__.py +++ /dev/null diff --git a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json index a06165bf..92785796 100644 --- a/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json +++ b/ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json @@ -644,6 +644,26 @@ }
},
"derived_from": "tosca.nodes.Component"
+ },
+ "tosca.nodes.DG" : {
+ "description" : "This is Directed Graph Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "tosca.nodes.Vnf" : {
+ "description" : "This is VNF Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "tosca.nodes.Artifact" : {
+ "description" : "This is Deprecated Artifact Node Type.",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
+ "tosca.nodes.Component" : {
+ "description" : "This is default Component Node",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
}
},
"data_types": {
diff --git a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java index 93ea4c49..46b725f8 100644 --- a/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java +++ b/ms/controllerblueprints/modules/service/src/test/java/org/onap/ccsdk/apps/controllerblueprints/service/validator/ServiceTemplateValidationTest.java @@ -37,16 +37,15 @@ public class ServiceTemplateValidationTest { public void testBluePrintDirs() {
List<String> dirs = ConfigModelUtils.getBlueprintNames("load/blueprints");
Assert.assertNotNull("Failed to get blueprint directories", dirs);
- Assert.assertEquals("Failed to get actual directories", 2, dirs.size());
+ Assert.assertEquals("Failed to get actual directories", 1, dirs.size());
}
@Test
public void validateServiceTemplate() throws Exception {
- validateServiceTemplate("load/blueprints/baseconfiguration/Definitions/activation-blueprint.json");
validateServiceTemplate("load/blueprints/vrr-test/Definitions/vrr-test.json");
}
- //@Test
+ @Test
public void validateEnhancedServiceTemplate() throws Exception {
ServiceTemplate serviceTemplate = JacksonUtils
.readValueFromClassPathFile("enhance/enhanced-template.json", ServiceTemplate.class);
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json index c3f25738..9f8af1aa 100644 --- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json +++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json @@ -215,6 +215,11 @@ },
"derived_from" : "tosca.nodes.DG"
},
+ "tosca.nodes.Component" : {
+ "description" : "This is default Component Node",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"component-resource-assignment" : {
"description" : "This is Resource Assignment Component API",
"version" : "1.0.0",
@@ -283,6 +288,11 @@ },
"derived_from" : "tosca.nodes.Component"
},
+ "tosca.nodes.DG" : {
+ "description" : "This is Directed Graph Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"artifact-config-template" : {
"description" : "This is Configuration Velocity Template",
"version" : "1.0.0",
@@ -361,6 +371,11 @@ },
"derived_from" : "tosca.nodes.Vnf"
},
+ "tosca.nodes.Vnf" : {
+ "description" : "This is VNF Node Type",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"component-netconf-executor" : {
"description" : "This is Netconf Transaction Configuration Component API",
"version" : "1.0.0",
@@ -386,12 +401,12 @@ "required" : true,
"type" : "string"
},
- "service-template-name" : {
+ "template-name" : {
"description" : "Service Template Name",
"required" : true,
"type" : "string"
},
- "service-template-version" : {
+ "template-version" : {
"description" : "Service Template Version",
"required" : true,
"type" : "string"
@@ -440,6 +455,11 @@ },
"derived_from" : "tosca.nodes.Component"
},
+ "tosca.nodes.Artifact" : {
+ "description" : "This is Deprecated Artifact Node Type.",
+ "version" : "1.0.0",
+ "derived_from" : "tosca.nodes.Root"
+ },
"dg-activate-netconf" : {
"description" : "This is Download Netconf Directed Graph",
"version" : "1.0.0",
@@ -571,8 +591,8 @@ },
"inputs" : {
"action-name" : "{ \"get_input\" : \"action-name\" }",
- "template_name" : "{ \"get_attribute\" : \"template_name\" }",
- "service-template-version" : "{ \"get_attribute\" : \"service-template-version\" }",
+ "template-name" : "{ \"get_attribute\" : \"template_name\" }",
+ "template-version" : "{ \"get_attribute\" : \"template_version\" }",
"resource-type" : "vnf-type",
"request-id" : "{ \"get_input\" : \"request-id\" }",
"resource-id" : "{ \"get_input\" : \"hostname\" }",
|