aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/modules/blueprints/resource-dict
diff options
context:
space:
mode:
authorPaira, Saurav(sp694w) <sp694w@att.com>2020-05-07 12:54:40 +0000
committerSaurav Paira <sp694w@att.com>2020-05-18 17:13:58 +0000
commita726d7aa14e0ae841ede2dbdbc1a825290bf1452 (patch)
tree94d81ad88c66a413e044d93e24dcbd0c30e77496 /ms/blueprintsprocessor/modules/blueprints/resource-dict
parent6b6ac70007ba2b52c6beb8c0d22453a628c891f3 (diff)
Add Naming Service & IP Assign custom resource resolution capability
Issue-ID: CCSDK-2185 Signed-off-by: Paira, Saurav(sp694w) <sp694w@att.com> Change-Id: I70550fe9582b2db0a70c7b66591438b674173411
Diffstat (limited to 'ms/blueprintsprocessor/modules/blueprints/resource-dict')
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt12
1 files changed, 9 insertions, 3 deletions
diff --git a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
index 9a5523113..422f65157 100644
--- a/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils
import org.apache.commons.collections.CollectionUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.asListOfString
import org.onap.ccsdk.cds.controllerblueprints.core.utils.TopologicalSortingUtils
import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment
@@ -51,20 +52,25 @@ object BulkResourceSequencingUtils {
resourceAssignmentMap.forEach { _, resourceAssignment ->
// Get the dependencies from the assignment sources, if not get from the Resource Assignment dependencies
if (resourceAssignment.dictionarySourceDefinition != null) {
- val dependencies = resourceAssignment.dictionarySourceDefinition?.properties?.get("key-dependencies")?.asListOfString()
+ val dependencies =
+ resourceAssignment.dictionarySourceDefinition?.properties?.get("key-dependencies")?.asListOfString()
dependencies?.forEach { dependency ->
topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment)
}
} else if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) {
for (dependency in resourceAssignment.dependencies!!) {
- topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment)
+ val ra = resourceAssignmentMap[dependency]
+ ?: throw BluePrintProcessorException("Couldn't get Resource Assignment dependency " +
+ "Key($dependency)")
+ topologySorting.add(ra, resourceAssignment)
}
} else {
topologySorting.add(startResourceAssignment, resourceAssignment)
}
}
- val sequencedResourceAssignments: MutableList<ResourceAssignment> = topologySorting.topSort()!! as MutableList<ResourceAssignment>
+ val sequencedResourceAssignments: MutableList<ResourceAssignment> =
+ topologySorting.topSort()!! as MutableList<ResourceAssignment>
log.trace("Sorted Sequenced Assignments ({})", sequencedResourceAssignments)
var batchResourceAssignment: MutableList<ResourceAssignment>? = null