diff options
author | Brinda Santh <brindasanth@in.ibm.com> | 2019-08-05 09:50:15 -0400 |
---|---|---|
committer | Dan Timoney <dtimoney@att.com> | 2019-08-09 21:51:14 +0000 |
commit | 977287b586e27e2f835a5d24950abf1f2adae8be (patch) | |
tree | 86200548402e907c6cf969bd4f0a516eed937ed0 /ms/controllerblueprints/modules/resource-dict | |
parent | 4001ac13397c082ee97c7ff440fa2ead5d50b421 (diff) |
Add resource definition resolution service.
Change-Id: Ife75d290540e3ed0e0dfd0a82785a498607a2d25
Issue-ID: CCSDK-1577
Signed-off-by: Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/resource-dict')
2 files changed, 17 insertions, 3 deletions
diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt index a2f1e23e7..c222de9e5 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt +++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/ResourceDefinition.kt @@ -58,6 +58,12 @@ open class ResourceAssignment { @JsonProperty("dictionary-source") var dictionarySource: String? = null + /** Modified Source definition, Capability Source will use for script reference changes, + * Rest Source will use for extra headers etc **/ + @JsonProperty("dictionary-source-definition") + var dictionarySourceDefinition: NodeTemplate? = null + + /** Duplicate field : Shall be used directly from Dictionary Source definition dependencies. **/ @JsonProperty("dependencies") var dependencies: MutableList<String>? = null diff --git a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt index dbd5b7dfe..60fe6a705 100644 --- a/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt +++ b/ms/controllerblueprints/modules/resource-dict/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/resource/dict/utils/BulkResourceSequencingUtils.kt @@ -17,17 +17,19 @@ package org.onap.ccsdk.cds.controllerblueprints.resource.dict.utils import org.apache.commons.collections.CollectionUtils +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 import org.slf4j.LoggerFactory -import java.util.ArrayList +import java.util.* + /** * BulkResourceSequencingUtils. * * @author Brinda Santh */ object BulkResourceSequencingUtils { - private val log= LoggerFactory.getLogger(BulkResourceSequencingUtils::class.java) + private val log = LoggerFactory.getLogger(BulkResourceSequencingUtils::class.java) @JvmStatic fun process(resourceAssignments: MutableList<ResourceAssignment>): List<List<ResourceAssignment>> { @@ -46,7 +48,13 @@ object BulkResourceSequencingUtils { // Preepare Sorting Map val topologySorting = TopologicalSortingUtils<ResourceAssignment>() resourceAssignmentMap.forEach { _, resourceAssignment -> - if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) { + // 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() + dependencies?.forEach { dependency -> + topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment) + } + } else if (CollectionUtils.isNotEmpty(resourceAssignment.dependencies)) { for (dependency in resourceAssignment.dependencies!!) { topologySorting.add(resourceAssignmentMap[dependency]!!, resourceAssignment) } |