aboutsummaryrefslogtreecommitdiffstats
path: root/components/core/src
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-06 20:18:24 +0000
committerMuthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>2018-09-06 20:49:58 +0000
commitc8c4cd151732fa6e9be45f403244de307456b923 (patch)
tree1e4c623afc4eac37f8411612799a4a2e5172dafc /components/core/src
parente7f37ab7283160ef1b2a9ea02a8dcdfa0aad22c0 (diff)
Controller Blueprints Microservice
Add Blueprint Dervied from NodeType, Requirement Definitions and Assignments validations. Change-Id: I1cc643b5a83c5a707c8e3ae1342a439f122da55e Issue-ID: CCSDK-484 Signed-off-by: Muthuramalingam, Brinda Santh(bs2796) <bs2796@att.com>
Diffstat (limited to 'components/core/src')
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/BluePrintTypes.kt10
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintEnhancerService.kt20
-rw-r--r--components/core/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintValidatorService.kt130
-rw-r--r--components/core/src/test/kotlin/org/onap/ccsdk/apps/controllerblueprints/core/service/BluePrintRuntimeServiceTest.kt38
-rw-r--r--components/core/src/test/resources/data/default-context.json2
5 files changed, 155 insertions, 45 deletions
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 af3966aad..24514db50 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 f38c317e7..b125c594c 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 a60f532e0..2b11589d4 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 5d24b072f..919dc564e 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 fcd4cbe26..e033f6f57 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