aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt69
-rw-r--r--ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json4
-rw-r--r--ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json4
-rw-r--r--ms/controllerblueprints/modules/service/src/test/resources/enhance/enhance-template.json4
4 files changed, 71 insertions, 10 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 a3b68e0d..a60f532e 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
@@ -1,5 +1,6 @@
/*
* Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -187,7 +188,7 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
nodeTemplate.properties?.let { validatePropertyAssignments(nodeType.properties!!, nodeTemplate.properties!!) }
nodeTemplate.capabilities?.let { validateCapabilityAssignments(nodeTemplate.capabilities!!) }
nodeTemplate.requirements?.let { validateRequirementAssignments(nodeTemplate.requirements!!) }
- nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeTemplate.interfaces!!) }
+ nodeTemplate.interfaces?.let { validateInterfaceAssignments(nodeType, nodeTemplateName, nodeTemplate) }
paths.removeAt(paths.lastIndex)
}
@@ -293,11 +294,72 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
}
@Throws(BluePrintException::class)
- open fun validateInterfaceAssignments(interfaces: MutableMap<String, InterfaceAssignment>) {
+ open fun validateInterfaceAssignments(nodeType: NodeType, nodeTemplateName: String, nodeTemplate: NodeTemplate) {
+
+ val interfaces = nodeTemplate.interfaces
+ paths.add("interfaces")
+ 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))
+
+ validateInterfaceAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment)
+ paths.removeAt(paths.lastIndex)
+ }
+ paths.removeAt(paths.lastIndex)
+
}
@Throws(BluePrintException::class)
+ open fun validateInterfaceAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment) {
+
+ val operations = interfaceAssignment.operations
+ operations?.let {
+ validateInterfaceOperationsAssignment(nodeTemplateName, interfaceAssignmentName, interfaceDefinition,
+ interfaceAssignment)
+ }
+
+ }
+
+ @Throws(BluePrintException::class)
+ open fun validateInterfaceOperationsAssignment(nodeTemplateName: String, interfaceAssignmentName: String,
+ interfaceDefinition: InterfaceDefinition,
+ interfaceAssignment: InterfaceAssignment) {
+
+ val operations = interfaceAssignment.operations
+ operations?.let {
+ it.forEach { operationAssignmentName, operationAssignments ->
+
+ val operationDefinition = interfaceDefinition.operations?.get(operationAssignmentName)
+ ?: throw BluePrintException(format("Failed to get nodeTemplate({}) operation definition ({}) ",
+ nodeTemplateName, operationAssignmentName))
+
+ log.info("Validation Node Template({}) Interface({}) Operation ({})", nodeTemplateName,
+ interfaceAssignmentName, operationAssignmentName)
+
+ val inputs = operationAssignments.inputs
+ val outputs = operationAssignments.outputs
+
+ inputs?.forEach { propertyName, propertyAssignment ->
+ val propertyDefinition = operationDefinition.inputs?.get(propertyName)
+ ?: 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)
+ }
+
+ }
+ }
+
+ }
+
+
+ @Throws(BluePrintException::class)
open fun validateInterfaceDefinitions(interfaces: MutableMap<String, InterfaceDefinition>) {
paths.add("interfaces")
interfaces.forEach { interfaceName, interfaceDefinition ->
@@ -360,14 +422,13 @@ open class BluePrintValidatorDefaultService : BluePrintValidatorService {
} 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)
}
-
+ isValid = JacksonUtils.checkJsonNodeValueOfCollectionType(propertyType, propertyAssignment)
} else {
checkPropertyDataType(propertyType, propertyName)
isValid = true
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 635e177a..851ded2c 100644
--- a/ms/controllerblueprints/application/load/blueprints/baseconfiguration/Definitions/activation-blueprint.json
+++ b/ms/controllerblueprints/application/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/model_type/node_type/component-netconf-executor.json b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json
index aed667aa..240caf3f 100644
--- a/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json
+++ b/ms/controllerblueprints/modules/service/load/model_type/node_type/component-netconf-executor.json
@@ -23,12 +23,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"
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 5824031e..155dc723 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
@@ -64,8 +64,8 @@
"process": {
"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\" }",