aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-05 23:40:46 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-05 23:40:46 +0000
commit50eeeb8ec7bf3dc6c1d43f82f340b4abbec964de (patch)
tree39e0ddad0cfd80b3c7aac64e9a47daf523ef49f3
parentcb7b049aa0ae2a0eda114a5793a1af4db51b148f (diff)
Controller Blueprints Microservice
Add Property Assign validation and Data Type Entry schema validation. Change-Id: Ifa40f62f848d06381ab83d7f1c9e7c6526f5edf0 Issue-ID: CCSDK-484 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
-rw-r--r--components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json33
-rw-r--r--components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json4
-rw-r--r--components/core/load/model_type/node_type/component-resource-assignment.json2
-rw-r--r--components/core/load/model_type/node_type/dg-activate-netconf.json2
-rw-r--r--components/core/load/model_type/node_type/dg-config-generator.json2
-rw-r--r--components/core/load/model_type/node_type/dg-resource-assign-activate.json2
-rw-r--r--components/core/load/model_type/node_type/dg-resource-assignment.json2
-rw-r--r--components/core/load/model_type/node_type/tosca.nodes.Component.json5
-rw-r--r--components/core/load/model_type/node_type/tosca.nodes.DG.json5
-rw-r--r--components/core/load/model_type/node_type/tosca.nodes.Vnf.json5
-rw-r--r--components/core/load/model_type/node_type/tosca.nodes.component.Python.json5
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt2
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt27
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt129
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json2
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json2
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json2
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json2
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Component.json5
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.DG.json5
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Vnf.json5
-rw-r--r--ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.component.Python.json5
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json4
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json4
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json2
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json2
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json2
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json2
-rw-r--r--ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json23
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhanced-template.json34
31 files changed, 187 insertions, 143 deletions
diff --git a/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json b/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
index 635e177a..7b9b7dd7 100644
--- a/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
+++ b/components/core/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
@@ -44,7 +44,7 @@
"resource-assignment": {
"type": "component-resource-assignment",
"properties":{
- "request-id": ["1234", "1234"]
+ "request-id": "1234"
},
"interfaces": {
"DefaultComponentNode": {
@@ -80,7 +80,7 @@
"resource-assignment-py": {
"type": "component-resource-assignment",
"properties":{
- "request-id": ["1234", "1234"]
+ "request-id": "1234"
},
"interfaces": {
"DefaultComponentNode": {
@@ -256,35 +256,6 @@
"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": {
diff --git a/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json b/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json
index e78f32f0..65028ace 100644
--- a/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json
+++ b/components/core/load/blueprints/simple-baseconfig/Definitions/simple-baseconfig.json
@@ -117,7 +117,7 @@
"properties": {
"mode": "sync",
"version": "LATEST",
- "is-start-flow": "false"
+ "is-start-flow": false
},
"requirements": {
"component-dependency": {
@@ -151,7 +151,7 @@
"properties": {
"mode": "sync",
"version": "LATEST",
- "is-start-flow": "false"
+ "is-start-flow": false
},
"requirements": {
"component-dependency": {
diff --git a/components/core/load/model_type/node_type/component-resource-assignment.json b/components/core/load/model_type/node_type/component-resource-assignment.json
index 34c02848..03f3c284 100644
--- a/components/core/load/model_type/node_type/component-resource-assignment.json
+++ b/components/core/load/model_type/node_type/component-resource-assignment.json
@@ -7,7 +7,7 @@
}
},
"interfaces": {
- "org-openecomp-sdnc-config-assignment-service-ConfigAssignmentNode": {
+ "org-onap-sdnc-config-assignment-service-ConfigAssignmentNode": {
"operations": {
"process": {
"inputs": {
diff --git a/components/core/load/model_type/node_type/dg-activate-netconf.json b/components/core/load/model_type/node_type/dg-activate-netconf.json
index c638df00..a9d16edd 100644
--- a/components/core/load/model_type/node_type/dg-activate-netconf.json
+++ b/components/core/load/model_type/node_type/dg-activate-netconf.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/components/core/load/model_type/node_type/dg-config-generator.json b/components/core/load/model_type/node_type/dg-config-generator.json
index 28bace0f..6794b3c8 100644
--- a/components/core/load/model_type/node_type/dg-config-generator.json
+++ b/components/core/load/model_type/node_type/dg-config-generator.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/components/core/load/model_type/node_type/dg-resource-assign-activate.json b/components/core/load/model_type/node_type/dg-resource-assign-activate.json
index e98fa5a6..22a4d813 100644
--- a/components/core/load/model_type/node_type/dg-resource-assign-activate.json
+++ b/components/core/load/model_type/node_type/dg-resource-assign-activate.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/components/core/load/model_type/node_type/dg-resource-assignment.json b/components/core/load/model_type/node_type/dg-resource-assignment.json
index 36fbb686..7c01faa1 100644
--- a/components/core/load/model_type/node_type/dg-resource-assignment.json
+++ b/components/core/load/model_type/node_type/dg-resource-assignment.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/components/core/load/model_type/node_type/tosca.nodes.Component.json b/components/core/load/model_type/node_type/tosca.nodes.Component.json
new file mode 100644
index 00000000..bc4827b8
--- /dev/null
+++ b/components/core/load/model_type/node_type/tosca.nodes.Component.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is default Component Node",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+} \ No newline at end of file
diff --git a/components/core/load/model_type/node_type/tosca.nodes.DG.json b/components/core/load/model_type/node_type/tosca.nodes.DG.json
new file mode 100644
index 00000000..86728cf2
--- /dev/null
+++ b/components/core/load/model_type/node_type/tosca.nodes.DG.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is Directed Graph Node Type",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+} \ No newline at end of file
diff --git a/components/core/load/model_type/node_type/tosca.nodes.Vnf.json b/components/core/load/model_type/node_type/tosca.nodes.Vnf.json
new file mode 100644
index 00000000..acb1f2f3
--- /dev/null
+++ b/components/core/load/model_type/node_type/tosca.nodes.Vnf.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is VNF Node Type",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+} \ No newline at end of file
diff --git a/components/core/load/model_type/node_type/tosca.nodes.component.Python.json b/components/core/load/model_type/node_type/tosca.nodes.component.Python.json
new file mode 100644
index 00000000..7b67c8cb
--- /dev/null
+++ b/components/core/load/model_type/node_type/tosca.nodes.component.Python.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is Python Component",
+ "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/BluePrintConstants.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
index 4ae1f4d5..ffad8e56 100644
--- a/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
+++ b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintConstants.kt
@@ -94,6 +94,8 @@ object BluePrintConstants {
const val MODEL_TYPE_NODES_COMPONENT_PYTHON: String = "tosca.nodes.component.Python"
const val MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT: String = "tosca.nodes.component.JavaScript"
+ const val MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION ="tosca.artifacts.Implementation"
+
const val MODEL_TYPE_DATA_TYPE_DYNAMIC = "tosca.datatypes.Dynamic"
const val EXPRESSION_GET_INPUT: String = "get_input"
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 33c811f4..af3966aa 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
@@ -24,6 +24,33 @@ package org.onap.ccsdk.apps.controllerblueprints.core
object BluePrintTypes {
@JvmStatic
+ val validNodeTypeDerivedFroms: MutableList<String> = arrayListOf(
+ BluePrintConstants.MODEL_TYPE_NODES_ROOT,
+ BluePrintConstants.MODEL_TYPE_NODE_DG,
+ BluePrintConstants.MODEL_TYPE_NODE_COMPONENT,
+ BluePrintConstants.MODEL_TYPE_NODE_VNF,
+ BluePrintConstants.MODEL_TYPE_NODE_ARTIFACT,
+ BluePrintConstants.MODEL_TYPE_NODE_RESOURCE_SOURCE,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_BUNDLE,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_SCRIPT,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_PYTHON,
+ BluePrintConstants.MODEL_TYPE_NODES_COMPONENT_JAVA_SCRIPT
+ )
+
+ @JvmStatic
+ val validArtifactTypeDerivedFroms: MutableList<String> = arrayListOf(
+ BluePrintConstants.MODEL_TYPE_ARTIFACTS_ROOT,
+ BluePrintConstants.MODEL_TYPE_ARTIFACT_TYPE_IMPLEMENTATION
+ )
+
+ @JvmStatic
+ val validDataTypeDerivedFroms: MutableList<String> = arrayListOf(
+ BluePrintConstants.MODEL_TYPE_DATATYPES_ROOT,
+ BluePrintConstants.MODEL_TYPE_DATA_TYPE_DYNAMIC
+ )
+
+ @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/BluePrintValidatorService.kt b/components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt
index 34399fdd..a3b68e0d 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
@@ -23,6 +23,7 @@ import org.onap.ccsdk.apps.controllerblueprints.core.*
import org.onap.ccsdk.apps.controllerblueprints.core.data.*
import com.att.eelf.configuration.EELFLogger
import com.att.eelf.configuration.EELFManager
+import org.onap.ccsdk.apps.controllerblueprints.core.utils.JacksonUtils
import java.io.Serializable
/**
@@ -52,7 +53,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
@Throws(BluePrintException::class)
override fun validateBlueprint(bluePrintContext: BluePrintContext, properties: MutableMap<String, Any>) {
- validateBlueprint(bluePrintContext.serviceTemplate,properties)
+ validateBlueprint(bluePrintContext.serviceTemplate, properties)
}
@Throws(BluePrintException::class)
@@ -121,7 +122,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
paths.add("nodeTypes")
nodeTypes.forEach { nodeTypeName, nodeType ->
// Validate Single Node Type
- validateNodeType(nodeTypeName,nodeType)
+ validateNodeType(nodeTypeName, nodeType)
}
paths.removeAt(paths.lastIndex)
}
@@ -132,7 +133,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
message.appendln("--> Node Type :" + paths.joinToString(separator))
val derivedFrom: String = nodeType.derivedFrom
//Check Derived From
- checkValidNodeTypesDerivedFrom(derivedFrom)
+ checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
nodeType.properties?.let { validatePropertyDefinitions(nodeType.properties!!) }
nodeType.interfaces?.let { validateInterfaceDefinitions(nodeType.interfaces!!) }
@@ -140,6 +141,13 @@ 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))
+ }
+ }
+
+ @Throws(BluePrintException::class)
open fun validateTopologyTemplate(topologyTemplate: TopologyTemplate) {
paths.add("topology")
message.appendln("--> Topology Template")
@@ -167,7 +175,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateNodeTemplate(nodeTemplateName : String, nodeTemplate: NodeTemplate) {
+ open fun validateNodeTemplate(nodeTemplateName: String, nodeTemplate: NodeTemplate) {
paths.add(nodeTemplateName)
message.appendln("---> Node Template :" + paths.joinToString(separator))
val type: String = nodeTemplate.type
@@ -184,6 +192,25 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
+ open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
+ paths.add("artifacts")
+ artifacts.forEach { artifactDefinitionName, artifactDefinition ->
+ paths.add(artifactDefinitionName)
+ message.appendln("Validating artifact " + paths.joinToString(separator))
+ val type: String = artifactDefinition.type
+ ?: throw BluePrintException("type is missing for artifact definition :" + artifactDefinitionName)
+ // Check Artifact Type
+ checkValidArtifactType(artifactDefinitionName, type)
+
+ val file: String = artifactDefinition.file
+ ?: throw BluePrintException(format("file is missing for artifact definition : {}", artifactDefinitionName))
+
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
open fun validateWorkFlows(workflows: MutableMap<String, Workflow>) {
paths.add("workflows")
workflows.forEach { workflowName, workflow ->
@@ -195,7 +222,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateWorkFlow(workflowName:String, workflow: Workflow) {
+ open fun validateWorkFlow(workflowName: String, workflow: Workflow) {
paths.add(workflowName)
message.appendln("---> Workflow :" + paths.joinToString(separator))
// Step Validation Start
@@ -239,31 +266,20 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
properties.forEach { propertyName, propertyAssignment ->
val propertyDefinition: PropertyDefinition = nodeTypeProperties[propertyName]
?: throw BluePrintException(format("failed to get definition for the property ({})", propertyName))
- // Check and Validate if Expression Node
- val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
- if (!expressionData.isExpression) {
- checkPropertyValue(propertyDefinition, propertyAssignment)
- }
+
+ validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+
}
}
@Throws(BluePrintException::class)
- open fun validateArtifactDefinitions(artifacts: MutableMap<String, ArtifactDefinition>) {
- paths.add("artifacts")
- artifacts.forEach { artifactName, artifactDefinition ->
- paths.add(artifactName)
- message.appendln("Validating artifact " + paths.joinToString(separator))
- val type: String = artifactDefinition.type
- ?: throw BluePrintException("type is missing for artifact definition :" + artifactName)
- // Check Artifact Type
- checkValidArtifactType(type)
-
- val file: String = artifactDefinition.file
- ?: throw BluePrintException(format("file is missing for artifact definition : {}", artifactName))
-
- paths.removeAt(paths.lastIndex)
+ open fun validatePropertyAssignment(propertyName: String, propertyDefinition: PropertyDefinition,
+ propertyAssignment: JsonNode) {
+ // Check and Validate if Expression Node
+ val expressionData = BluePrintExpressionService.getExpressionData(propertyAssignment)
+ if (!expressionData.isExpression) {
+ checkPropertyValue(propertyName, propertyDefinition, propertyAssignment)
}
- paths.removeAt(paths.lastIndex)
}
@Throws(BluePrintException::class)
@@ -313,34 +329,65 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun checkValidNodeType(nodeType : String) {
+ open fun checkValidArtifactType(artifactDefinitionName: String, artifactTypeName: String) {
+
+ val artifactType = serviceTemplate.artifactTypes?.get(artifactTypeName)
+ ?: throw BluePrintException(format("Failed to artifact type for artifact definition : {}", artifactDefinitionName))
+ checkValidArtifactTypeDerivedFrom(artifactTypeName, artifactType.derivedFrom)
}
@Throws(BluePrintException::class)
- open fun checkValidArtifactType(artifactType: String) {
-
- serviceTemplate.artifactTypes?.containsKey(artifactType)
- ?: throw BluePrintException(format("Failed to node type definition for artifact definition : {}", artifactType))
+ 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))
+ }
}
@Throws(BluePrintException::class)
- open fun checkValidNodeTypesDerivedFrom(derivedFrom: String) {
-
+ 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))
+ }
}
- private fun checkPropertyValue(propertyDefinition: PropertyDefinition, jsonNode: JsonNode) {
- //log.info("validating path ({}), Property {}, value ({})", paths, propertyDefinition, jsonNode)
- }
+ open fun checkPropertyValue(propertyName: String, propertyDefinition: PropertyDefinition, propertyAssignment: JsonNode) {
+ val propertyType = propertyDefinition.type
+ val isValid: Boolean
+
+ if (BluePrintTypes.validPrimitiveTypes().contains(propertyType)) {
+ isValid = JacksonUtils.checkJsonNodeValueOfPrimitiveType(propertyType, propertyAssignment)
+
+ } else if (BluePrintTypes.validCollectionTypes().contains(propertyType)) {
+
+ isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment)
+ val entrySchemaType = propertyDefinition.entrySchema?.type
+ ?: throw BluePrintException(format("Failed to get Entry Schema type for the collection property ({})", propertyName))
+
+ if (!BluePrintTypes.validPropertyTypes().contains(entrySchemaType)) {
+ checkPropertyDataType(entrySchemaType, propertyName)
+ }
- private fun checkPropertyDataType(dataType: String, propertyName: String): Boolean {
- if (checkDataType(dataType)) {
- return true
} else {
- throw BluePrintException(format("Data type ({}) for the property ({}) not found", dataType, propertyName))
+ checkPropertyDataType(propertyType, propertyName)
+ isValid = true
+ }
+
+ check(isValid) {
+ throw BluePrintException(format("property({}) defined of type({}) is not compatable with the value ({})",
+ propertyName, propertyType, propertyAssignment))
}
}
+ 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))
+
+ checkValidDataTypeDerivedFrom(propertyName, dataType.derivedFrom)
+
+ }
+
private fun checkPrimitiveOrComplex(dataType: String, propertyName: String): Boolean {
if (BluePrintTypes.validPrimitiveTypes().contains(dataType) || checkDataType(dataType)) {
return true
@@ -353,8 +400,4 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
return serviceTemplate.dataTypes?.containsKey(key) ?: false
}
- private fun checkNodeType(key: String): Boolean {
- return serviceTemplate.nodeTypes?.containsKey(key) ?: false
- }
-
} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json
index c638df00..a9d16edd 100644
--- a/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json
+++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-activate-netconf.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json
index 28bace0f..6794b3c8 100644
--- a/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json
+++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-config-generator.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json
index e98fa5a6..22a4d813 100644
--- a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json
+++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assign-activate.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json
index 36fbb686..7c01faa1 100644
--- a/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json
+++ b/ms/controllerblueprints/application/load/model_type/node_type/dg-resource-assignment.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Component.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Component.json
new file mode 100644
index 00000000..bc4827b8
--- /dev/null
+++ b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Component.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is default Component Node",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.DG.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.DG.json
new file mode 100644
index 00000000..86728cf2
--- /dev/null
+++ b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.DG.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is Directed Graph Node Type",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Vnf.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Vnf.json
new file mode 100644
index 00000000..acb1f2f3
--- /dev/null
+++ b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.Vnf.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is VNF Node Type",
+ "version": "1.0.0",
+ "derived_from": "tosca.nodes.Root"
+} \ No newline at end of file
diff --git a/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.component.Python.json b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.component.Python.json
new file mode 100644
index 00000000..7b67c8cb
--- /dev/null
+++ b/ms/controllerblueprints/application/load/model_type/node_type/tosca.nodes.component.Python.json
@@ -0,0 +1,5 @@
+{
+ "description": "This is Python Component",
+ "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
index 635e177a..851ded2c 100644
--- a/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
+++ b/ms/controllerblueprints/modules/service/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
@@ -44,7 +44,7 @@
"resource-assignment": {
"type": "component-resource-assignment",
"properties":{
- "request-id": ["1234", "1234"]
+ "request-id": "1234"
},
"interfaces": {
"DefaultComponentNode": {
@@ -80,7 +80,7 @@
"resource-assignment-py": {
"type": "component-resource-assignment",
"properties":{
- "request-id": ["1234", "1234"]
+ "request-id": "1234"
},
"interfaces": {
"DefaultComponentNode": {
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 d71dd201..a06165bf 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
@@ -268,7 +268,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
@@ -524,7 +524,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json
index c638df00..a9d16edd 100644
--- a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-activate-netconf.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json
index 28bace0f..6794b3c8 100644
--- a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-config-generator.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json
index e98fa5a6..22a4d813 100644
--- a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assign-activate.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json
index 36fbb686..7c01faa1 100644
--- a/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/dg-resource-assignment.json
@@ -15,7 +15,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json b/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json
index 95c829c4..14f724e5 100644
--- a/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json
+++ b/ms/controllerblueprints/modules/service/src/main/resources/service_template/default_netconf.json
@@ -394,7 +394,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
@@ -459,7 +459,7 @@
"is-start-flow": {
"required": false,
"type": "boolean",
- "default": "false"
+ "default": false
}
},
"capabilities": {
diff --git a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
index fedf1da2..5824031e 100644
--- a/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
+++ b/ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json
@@ -118,7 +118,7 @@
"properties": {
"mode": "sync",
"version": "LATEST",
- "is-start-flow": "false"
+ "is-start-flow": false
},
"requirements": {
"component-dependency": {
@@ -152,7 +152,7 @@
"properties": {
"mode": "sync",
"version": "LATEST",
- "is-start-flow": "false"
+ "is-start-flow": false
},
"requirements": {
"component-dependency": {
@@ -195,16 +195,8 @@
{
"name": "bundle-mac",
"property": {
- "description": "",
"required": true,
- "type": "string",
- "status": "",
- "constraints": [
- {}
- ],
- "entry_schema": {
- "type": ""
- }
+ "type": "string"
},
"input-param": false,
"dictionary-name": "bundle-mac",
@@ -220,10 +212,6 @@
"description": "",
"required": true,
"type": "list",
- "status": "",
- "constraints": [
- {}
- ],
"entry_schema": {
"type": "dt-v4-aggregate"
}
@@ -293,13 +281,8 @@
{
"name": "licenses",
"property": {
- "description": "",
"required": true,
"type": "list",
- "status": "",
- "constraints": [
- {}
- ],
"entry_schema": {
"type": "dt-license-key"
}
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 0633c64d..c3f25738 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
@@ -115,25 +115,16 @@
"version" : "1.0.0",
"properties" : {
"bundle-mac" : {
- "description" : "",
"required" : true,
- "type" : "string",
- "status" : "",
- "constraints" : [ { } ],
- "entry_schema" : {
- "type" : ""
- }
+ "type" : "string"
},
"hostname" : {
"required" : true,
"type" : "string"
},
"licenses" : {
- "description" : "",
"required" : true,
"type" : "list",
- "status" : "",
- "constraints" : [ { } ],
"entry_schema" : {
"type" : "dt-license-key"
}
@@ -142,8 +133,6 @@
"description" : "",
"required" : true,
"type" : "list",
- "status" : "",
- "constraints" : [ { } ],
"entry_schema" : {
"type" : "dt-v4-aggregate"
}
@@ -178,7 +167,7 @@
"is-start-flow" : {
"required" : false,
"type" : "boolean",
- "default" : "false"
+ "default" : false
}
},
"capabilities" : {
@@ -468,7 +457,7 @@
"is-start-flow" : {
"required" : false,
"type" : "boolean",
- "default" : "false"
+ "default" : false
}
},
"capabilities" : {
@@ -630,7 +619,7 @@
"properties" : {
"mode" : "sync",
"version" : "LATEST",
- "is-start-flow" : "false"
+ "is-start-flow" : false
},
"capabilities" : {
"dg-node" : { },
@@ -664,7 +653,7 @@
"properties" : {
"mode" : "sync",
"version" : "LATEST",
- "is-start-flow" : "false"
+ "is-start-flow" : false
},
"capabilities" : {
"dg-node" : { },
@@ -709,14 +698,8 @@
"mapping" : [ {
"name" : "bundle-mac",
"property" : {
- "description" : "",
"required" : true,
- "type" : "string",
- "status" : "",
- "constraints" : [ { } ],
- "entry_schema" : {
- "type" : ""
- }
+ "type" : "string"
},
"input-param" : false,
"dictionary-name" : "bundle-mac",
@@ -729,8 +712,6 @@
"description" : "",
"required" : true,
"type" : "list",
- "status" : "",
- "constraints" : [ { } ],
"entry_schema" : {
"type" : "dt-v4-aggregate"
}
@@ -791,11 +772,8 @@
"mapping" : [ {
"name" : "licenses",
"property" : {
- "description" : "",
"required" : true,
"type" : "list",
- "status" : "",
- "constraints" : [ { } ],
"entry_schema" : {
"type" : "dt-license-key"
}