aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt36
-rw-r--r--ms/controllerblueprints/modules/service/load/blueprints/vrr-test/Definitions/vrr-test.json2
2 files changed, 34 insertions, 4 deletions
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 2b11589d..8c00e0a1 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
@@ -136,7 +136,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
//Check Derived From
checkValidNodeTypesDerivedFrom(nodeTypeName, derivedFrom)
- if(!BluePrintTypes.rootNodeTypes().contains(derivedFrom)){
+ if (!BluePrintTypes.rootNodeTypes().contains(derivedFrom)) {
serviceTemplate.nodeTypes?.get(derivedFrom)
?: throw BluePrintException(format("Failed to get derivedFrom NodeType({})'s for NodeType({}) ",
derivedFrom, nodeTypeName))
@@ -193,7 +193,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
nodeTemplate.artifacts?.let { validateArtifactDefinitions(nodeTemplate.artifacts!!) }
nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
- nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeTemplate.capabilities!!) }
+ nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeType, nodeTemplateName, nodeTemplate) }
nodeTemplate.requirements?.let { validateRequirementAssignments(nodeType, nodeTemplateName, nodeTemplate) }
nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeType, nodeTemplateName, nodeTemplate) }
paths.removeAt(paths.lastIndex)
@@ -291,7 +291,28 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateCapabilityAssignments(capabilities: MutableMap<String, CapabilityAssignment>) {
+ open fun validateCapabilityAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+ val capabilities = nodeTemplate.capabilities
+ paths.add("capabilities")
+ capabilities?.forEach { capabilityName, capabilityAssignment ->
+ paths.add(capabilityName)
+
+ val capabilityDefinition = nodeType.capabilities?.get(capabilityName)
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) capability definition ({}) " +
+ "from NodeType({}) ", nodeTemplateName, capabilityName, nodeTemplate.type))
+
+ validateCapabilityAssignment(nodeTemplateName, capabilityName, capabilityDefinition, capabilityAssignment)
+
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateCapabilityAssignment(nodeTemplateName: String, capabilityName: String,
+ capabilityDefinition: CapabilityDefinition, capabilityAssignment: CapabilityAssignment) {
+
+ capabilityAssignment.properties?.let { validatePropertyAssignments(capabilityDefinition.properties!!, capabilityAssignment.properties!!) }
}
@@ -396,6 +417,15 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
}
+ outputs?.forEach { propertyName, propertyAssignment ->
+ val propertyDefinition = operationDefinition.outputs?.get(propertyName)
+ ?: throw BluePrintException(format("Failed to get NodeTemplate({}) operation definition ({}) " +
+ "output property definition({})", nodeTemplateName, operationAssignmentName,
+ propertyName))
+ // Check the property values with property definition
+ validatePropertyAssignment(propertyName, propertyDefinition, propertyAssignment)
+ }
+
}
}
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 92785796..724dfc4d 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
@@ -206,7 +206,7 @@
"properties": {
"profile-name": "sample",
"oam-ipv4-address": "{ \"get_attribute\" : \"hostname\" }",
- "port-number": "{ \"get_attribute\" : \"host-port\" }",
+ "port-number": { "get_input" : "host-port" },
"connection-time-out": 30
}
}