summaryrefslogtreecommitdiffstats
path: root/ms/controllerblueprints/modules/service/src/main
diff options
context:
space:
mode:
authorMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-15 17:07:19 -0400
committerMuthuramalingam, Brinda Santh <brindasanth@in.ibm.com>2019-03-15 17:07:19 -0400
commit06484d350655bea2da849e4d21dc9aeca10ccde9 (patch)
treea1ebc72f58149dd0785d089960ff22d847ca37fa /ms/controllerblueprints/modules/service/src/main
parent52443341dbc778648a8705dc5b62ed172ed2ccf5 (diff)
Add workflow node template enrichment
Change-Id: I15c2db6ab81bae2176d1606157f13416c1fac660 Issue-ID: CCSDK-1168 Signed-off-by: Muthuramalingam, Brinda Santh <brindasanth@in.ibm.com>
Diffstat (limited to 'ms/controllerblueprints/modules/service/src/main')
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt23
-rw-r--r--ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt2
2 files changed, 22 insertions, 3 deletions
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt
index 9fbf0916a..fc9ee5045 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/BluePrintWorkflowEnhancerImpl.kt
@@ -82,8 +82,27 @@ open class BluePrintWorkflowEnhancerImpl(private val bluePrintRepoService: BlueP
private fun enhanceStepTargets(name: String, workflow: Workflow) {
- // Get the first Step Target NodeTemplate name( Since that is the DG Node Template)
- val dgNodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(name)
+ // Get the first Step Target NodeTemplate name( It may be Component or DG Node Template)
+ val firstNodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(name)
+
+ val derivedFrom = bluePrintContext.nodeTemplateNodeType(firstNodeTemplateName).derivedFrom
+
+ when {
+ derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_COMPONENT, true) -> {
+ // DO Nothing
+ }
+ derivedFrom.startsWith(BluePrintConstants.MODEL_TYPE_NODE_DG, true) -> {
+ enhanceDGStepTargets(name, workflow, firstNodeTemplateName)
+ }
+ else -> {
+ throw BluePrintProcessorException("couldn't execute workflow($name) step mapped " +
+ "to node template($firstNodeTemplateName) derived from($derivedFrom)")
+ }
+ }
+
+ }
+
+ private fun enhanceDGStepTargets(name: String, workflow: Workflow, dgNodeTemplateName: String) {
val dgNodeTemplate = bluePrintContext.nodeTemplateByName(dgNodeTemplateName)
diff --git a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt
index 6171687f2..816b35664 100644
--- a/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt
+++ b/ms/controllerblueprints/modules/service/src/main/kotlin/org/onap/ccsdk/apps/controllerblueprints/service/enhancer/ResourceDefinitionEnhancerService.kt
@@ -75,7 +75,7 @@ class ResourceDefinitionEnhancerServiceImpl(private val resourceDefinitionRepoSe
// Get all the Mapping files from all node templates.
private fun getAllResourceMappingFiles(blueprintContext: BluePrintContext): List<String>? {
- return blueprintContext.nodeTemplates?.mapNotNull { nodeTemplateMap ->
+ return blueprintContext.nodeTemplates()?.mapNotNull { nodeTemplateMap ->
// Return only Mapping Artifact File Names
nodeTemplateMap.value.artifacts?.filter { artifactDefinitionMap ->