aboutsummaryrefslogtreecommitdiffstats
path: root/ms
diff options
context:
space:
mode:
Diffstat (limited to 'ms')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt29
-rw-r--r--ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json46
3 files changed, 63 insertions, 15 deletions
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
index e8b61a8fe..987390fdb 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt
@@ -124,7 +124,8 @@ open class DatabaseResourceAssignmentProcessor(private val bluePrintDBLibPropert
checkNotEmpty(resourceAssignment.dictionaryName) {
"resource assignment dictionary name is not defined for template key (${resourceAssignment.name})"
}
- checkEquals(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, resourceAssignment.dictionarySource) {
+ check(resourceAssignment.dictionarySource in arrayOf(ResourceDictionaryConstants.SOURCE_PROCESSOR_DB, ResourceDictionaryConstants.SOURCE_PRIMARY_DB))
+ {
"resource assignment source is not ${ResourceDictionaryConstants.SOURCE_PROCESSOR_DB} but it is ${resourceAssignment.dictionarySource}"
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
index 89674ea24..f73197e0b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceResolutionProcessorTest.kt
@@ -49,7 +49,7 @@ class DatabaseResourceResolutionProcessorTest {
lateinit var databaseResourceAssignmentProcessor: DatabaseResourceAssignmentProcessor
@Test
- fun `test database resource resolution`() {
+ fun `test database resource resolution processor db`() {
runBlocking {
val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
"./../../../../components/model-catalog/blueprint-model/test-blueprint/baseconfiguration")
@@ -74,4 +74,31 @@ class DatabaseResourceResolutionProcessorTest {
println(processorName)
}
}
+
+ @Test
+ fun `test database resource resolution primary db`() {
+ runBlocking {
+ val bluePrintContext = BluePrintMetadataUtils.getBluePrintContext(
+ "./../../../../components/model-catalog/blueprint-model/test-blueprint/capability_python")
+
+ val resourceAssignmentRuntimeService = ResourceAssignmentRuntimeService("1234", bluePrintContext)
+
+ databaseResourceAssignmentProcessor.raRuntimeService = resourceAssignmentRuntimeService
+ databaseResourceAssignmentProcessor.resourceDictionaries = ResourceAssignmentUtils
+ .resourceDefinitions(bluePrintContext.rootPath)
+
+ val resourceAssignment = ResourceAssignment().apply {
+ name = "service-instance-id"
+ dictionaryName = "service-instance-id"
+ dictionarySource = "primary-db"
+ property = PropertyDefinition().apply {
+ type = "string"
+ }
+ }
+
+ val processorName = databaseResourceAssignmentProcessor.applyNB(resourceAssignment)
+ assertNotNull(processorName, "couldn't get Database resource assignment processor name")
+ println(processorName)
+ }
+ }
} \ No newline at end of file
diff --git a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
index 4c0320aca..bcfea9f24 100644
--- a/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
+++ b/ms/controllerblueprints/modules/resource-dict/load/resource_dictionary/vnf-name.json
@@ -7,21 +7,41 @@
"type" : "string"
},
"sources" : {
- "primary-config-data" : {
- "type" : "source-rest",
- "properties" : {
- "type" : "JSON",
- "url-path" : "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-id/vnf-data/vnf-topology/vnf-parameters-data/param/vnf_name",
- "path" : "/param/0/value",
- "expression-type" : "JSON_POINTER",
- "input-key-mapping" : {
- "service-instance-id" : "service-instance-id",
- "vnf-id" : "vnf-id"
+ "primary-config-data": {
+ "type": "source-rest",
+ "properties": {
+ "type": "JSON",
+ "url-path": "config/GENERIC-RESOURCE-API:services/service/$service-instance-id/service-data/vnfs/vnf/$vnf-name/vnf-data/vnf-topology/vnf-parameters-data/param/vnf-name",
+ "path": "/param/0/value",
+ "input-key-mapping": {
+ "service-instance-id": "service-instance-id",
+ "vnf-name": "vnf-name"
},
- "output-key-mapping" : {
- "vnf-name" : "value"
+ "output-key-mapping": {
+ "vnf-name": "value"
},
- "key-dependencies" : [ "service-instance-id", "vnf-id" ]
+ "key-dependencies": [
+ "service-instance-id",
+ "vnf-name"
+ ]
+ }
+ },
+ "primary-aai-data": {
+ "type": "source-rest",
+ "properties": {
+ "type": "JSON",
+ "verb": "GET",
+ "url-path": "/aai/v14/network/generic-vnfs/generic-vnf/$vnf-id",
+ "path": "",
+ "input-key-mapping": {
+ "vnf-id": "vnf-id"
+ },
+ "output-key-mapping": {
+ "vnf-name": "vnf-name"
+ },
+ "key-dependencies": [
+ "vnf-id"
+ ]
}
}
}