diff options
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) } |