summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKAPIL SINGAL <ks220y@att.com>2021-03-24 13:13:49 +0000
committerGerrit Code Review <gerrit@onap.org>2021-03-24 13:13:49 +0000
commit6c28da342039728e77fbe1098921172848057d31 (patch)
tree5644bd68ca4f955ea8fb1e8e3b75d8ecb41e2e62
parent02460042f5ff66c0e98d04a282d5ccd1f28ea083 (diff)
parentaa3f6d9d6d87d265319820eaecb77dabed010a7b (diff)
Merge "Refactoring to enable on_failure for imperative workflow" into honolulu
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinDayOneConfig.kt2
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinK8sProfileUpload.kt2
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt2
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt2
-rw-r--r--components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt2
-rw-r--r--ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt6
-rw-r--r--ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt2
-rw-r--r--ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt2
-rw-r--r--ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt2
-rw-r--r--ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt6
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt15
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt3
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DatabaseResourceAssignmentProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt5
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt3
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt2
-rw-r--r--ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintError.kt18
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintContext.kt10
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintErrorTest.kt12
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorService.kt6
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintServiceTemplateValidatorImpl.kt2
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintWorkflowValidatorImpl.kt3
-rw-r--r--ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt8
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BlueprintEnhancerServiceImpl.kt4
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt6
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt4
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt12
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt3
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt4
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt13
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt6
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt5
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt2
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt4
49 files changed, 129 insertions, 99 deletions
diff --git a/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinDayOneConfig.kt b/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinDayOneConfig.kt
index 38d843acd..1080418ff 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinDayOneConfig.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinDayOneConfig.kt
@@ -221,7 +221,7 @@ open class DayOneConfig : AbstractScriptComponentFunction() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Executing Recovery")
- bluePrintRuntimeService.getBlueprintError().addError("${runtimeException.message}")
+ addError("${runtimeException.message}")
}
fun modifyTemplate(configmapName: String, typOfVfmodule: String): String {
diff --git a/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinK8sProfileUpload.kt b/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinK8sProfileUpload.kt
index 2673b3cd4..e69bdbeac 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinK8sProfileUpload.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/5GC_Simulator_CNF_CDS/Scripts/kotlin/KotlinK8sProfileUpload.kt
@@ -275,7 +275,7 @@ open class K8sProfileUpload : AbstractScriptComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Executing Recovery")
- bluePrintRuntimeService.getBlueprintError().addError("${runtimeException.message}")
+ addError("${runtimeException.message}")
}
inner class K8sApi(
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt
index e53b73eb0..bcbb47186 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/ConfigDeploy.kt
@@ -87,7 +87,7 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Executing Recovery")
- bluePrintRuntimeService.getBlueprintError().addError("${runtimeException.message}")
+ addError("${runtimeException.message}")
}
}
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt
index 606e76e84..c34decca9 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/vLB/Scripts/kotlin/HealthCheck.kt
@@ -89,7 +89,7 @@ open class HealthCheck : AbstractScriptComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Executing Recovery")
- bluePrintRuntimeService.getBlueprintError().addError("${runtimeException.message}")
+ addError("${runtimeException.message}")
}
}
diff --git a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt
index 07168ce76..c7f4c9352 100644
--- a/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt
+++ b/components/model-catalog/blueprint-model/service-blueprint/vLB_CDS_RESTCONF/Scripts/kotlin/KotlinRestCall.kt
@@ -87,7 +87,7 @@ open class ConfigDeploy : AbstractScriptComponentFunction() {
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
log.info("Executing Recovery")
- bluePrintRuntimeService.getBlueprintError().addError("${runtimeException.message}")
+ addError("${runtimeException.message}")
}
}
diff --git a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
index 27ce7a214..88cf0992f 100644
--- a/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/ansible-awx-executor/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/ansible/executor/ComponentRemoteAnsibleExecutorTest.kt
@@ -112,7 +112,7 @@ class ComponentRemoteAnsibleExecutorTest {
}
// then
- assertTrue(bluePrintRuntimeService.getBlueprintError().errors.isEmpty())
+ assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().isEmpty())
}
@Test
@@ -146,7 +146,7 @@ class ComponentRemoteAnsibleExecutorTest {
}
// then
- val errors = bluePrintRuntimeService.getBlueprintError().errors
+ val errors = bluePrintRuntimeService.getBlueprintError().allErrors()
assertEquals(1, errors.size)
}
@@ -187,7 +187,7 @@ class ComponentRemoteAnsibleExecutorTest {
}
// then
- val errors = bluePrintRuntimeService.getBlueprintError().errors
+ val errors = bluePrintRuntimeService.getBlueprintError().allErrors()
assertEquals(1, errors.size)
}
diff --git a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
index acdbe070f..99de66489 100644
--- a/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
+++ b/ms/blueprintsprocessor/functions/config-snapshots/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/config/snapshots/ComponentConfigSnapshotsExecutorTest.kt
@@ -247,7 +247,7 @@ class ComponentConfigSnapshotsExecutorTest {
}
// then; we should get error in our output properties
- assertTrue(bluePrintRuntimeService.getBlueprintError().errors.size == 1)
+ assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().size == 1)
assertEquals(
ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_ERROR.asJsonPrimitive(),
bluePrintRuntimeService.getNodeTemplateAttributeValue(
@@ -328,7 +328,7 @@ class ComponentConfigSnapshotsExecutorTest {
}
// then; we should get success
- assertTrue(bluePrintRuntimeService.getBlueprintError().errors.size == 0)
+ assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().size == 0)
assertEquals(
ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
bluePrintRuntimeService.getNodeTemplateAttributeValue(
@@ -377,7 +377,7 @@ class ComponentConfigSnapshotsExecutorTest {
}
// then; we should get success
- assertTrue(bluePrintRuntimeService.getBlueprintError().errors.size == 0)
+ assertTrue(bluePrintRuntimeService.getBlueprintError().allErrors().size == 0)
assertEquals(
ComponentConfigSnapshotsExecutor.OUTPUT_STATUS_SUCCESS.asJsonPrimitive(),
bluePrintRuntimeService.getNodeTemplateAttributeValue(
diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt
index db549f334..201895cc6 100644
--- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt
+++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/profile/K8sProfileUploadComponent.kt
@@ -174,7 +174,7 @@ open class K8sProfileUploadComponent(
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
private fun getTemplatePrefixList(node: JsonNode?): ArrayList<String> {
diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt
index 0944c2359..87a4d4e27 100644
--- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt
+++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigTemplateComponent.kt
@@ -165,7 +165,7 @@ open class K8sConfigTemplateComponent(
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
private fun getTemplatePrefixList(node: JsonNode?): ArrayList<String> {
diff --git a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt
index 34b6ea187..ba145cd9c 100644
--- a/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt
+++ b/ms/blueprintsprocessor/functions/k8s-connection-plugin/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/k8s/definition/template/K8sConfigValueComponent.kt
@@ -257,7 +257,7 @@ open class K8sConfigValueComponent(
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
private enum class OperationType {
diff --git a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
index de6eb6b40..aa13fa0d7 100644
--- a/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
+++ b/ms/blueprintsprocessor/functions/netconf-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/netconf/executor/ComponentNetconfExecutor.kt
@@ -69,7 +69,6 @@ open class ComponentNetconfExecutor(private var componentFunctionScriptingServic
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError()
- .addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}")
+ addError("Failed in ComponentNetconfExecutor : ${runtimeException.message}")
}
}
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
index 7911559ae..b32ccea13 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentJythonExecutor.kt
@@ -56,8 +56,7 @@ open class ComponentJythonExecutor(
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError()
- .addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
+ addError("Failed in ComponentJythonExecutor : ${runtimeException.message}")
}
private suspend fun populateJythonComponentInstance() {
diff --git a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
index 22154e5a0..539e03dc8 100644
--- a/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
+++ b/ms/blueprintsprocessor/functions/python-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/python/executor/ComponentRemotePythonExecutor.kt
@@ -313,11 +313,11 @@ open class ComponentRemotePythonExecutor(
}
}
- private fun noBlueprintErrors() = bluePrintRuntimeService.getBlueprintError().errors.isEmpty()
+ private fun noBlueprintErrors() =
+ bluePrintRuntimeService.getBlueprintError().stepErrors(stepName).isNullOrEmpty()
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError()
- .addError("Failed in ComponentRemotePythonExecutor : ${runtimeException.message}")
+ addError("Failed in ComponentRemotePythonExecutor : ${runtimeException.message}")
}
private fun formatNestedJsonNode(node: JsonNode): String {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
index 6a2e128e2..ada1a720e 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt
@@ -115,7 +115,8 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
bluePrintRuntimeService,
nodeTemplateName,
artifactPrefixNames,
- properties
+ properties,
+ stepName
)
// provide indexed result in output if we have multiple resolution
@@ -140,6 +141,6 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
index 46410a859..ea420dca4 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt
@@ -65,7 +65,8 @@ interface ResourceResolutionService {
bluePrintRuntimeService: BlueprintRuntimeService<*>,
nodeTemplateName: String,
artifactNames: List<String>,
- properties: Map<String, Any>
+ properties: Map<String, Any>,
+ stepName: String
): ResourceResolutionResult
suspend fun resolveResources(
@@ -128,7 +129,8 @@ open class ResourceResolutionServiceImpl(
bluePrintRuntimeService: BlueprintRuntimeService<*>,
nodeTemplateName: String,
artifactNames: List<String>,
- properties: Map<String, Any>
+ properties: Map<String, Any>,
+ stepName: String
): ResourceResolutionResult {
val resourceAssignmentRuntimeService =
@@ -150,11 +152,10 @@ open class ResourceResolutionServiceImpl(
val failedResolution = resourceAssignmentList.filter { it.status != "success" && it.property?.required == true }.map { it.name }
if (failedResolution.isNotEmpty()) {
- // The following error message is returned by default to handle a scenario when
- // error message comes empty even when resolution has actually failed.
- // Example: input-source type resolution seems to fail with no error code.
- bluePrintRuntimeService.getBlueprintError().errors.add("Failed to resolve required resources($failedResolution)")
- bluePrintRuntimeService.getBlueprintError().errors.addAll(resourceAssignmentRuntimeService.getBlueprintError().errors)
+ val errorMessages = mutableListOf("Failed to resolve required values: $failedResolution").apply {
+ this.addAll(resourceAssignmentRuntimeService.getBlueprintError().allErrors())
+ }
+ bluePrintRuntimeService.getBlueprintError().addErrors(stepName, errorMessages)
}
}
return ResourceResolutionResult(templateMap, assignmentMap)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
index d9a5ba0d1..a1f3249ab 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/IpAssignResolutionCapability.kt
@@ -116,7 +116,7 @@ open class IpAssignResolutionCapability : ResourceAssignmentProcessor() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
- raRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
/** Generates aggregated request payload for Ip Assign mS. Parses the resourceassignments of
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
index 903c1b3fa..4f656a8f0 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/capabilities/NamingResolutionCapability.kt
@@ -118,7 +118,7 @@ open class NamingResolutionCapability : ResourceAssignmentProcessor() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
- raRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
/** Generates aggregated request payload for Naming mS. Parses the resourceassignments of
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
index 4f33c8252..5e834d73d 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/CapabilityResourceResolutionProcessor.kt
@@ -87,8 +87,7 @@ open class CapabilityResourceResolutionProcessor(private var componentFunctionSc
}
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBlueprintError()
- .addError("Failed in CapabilityResourceResolutionProcessor : ${runtimeException.message}")
+ addError("Failed in CapabilityResourceResolutionProcessor : ${runtimeException.message}")
ResourceAssignmentUtils.setFailedResourceDataValue(resourceAssignment, runtimeException.message)
}
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 640b0f5fe..db5307f17 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
@@ -183,6 +183,6 @@ open class DatabaseResourceAssignmentProcessor(
}
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
index f90a8b5fa..e904ebcb4 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/DefaultResourceResolutionProcessor.kt
@@ -64,6 +64,6 @@ open class DefaultResourceResolutionProcessor : ResourceAssignmentProcessor() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
index d85449b19..c3add86fd 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/InputResourceResolutionProcessor.kt
@@ -91,6 +91,6 @@ open class InputResourceResolutionProcessor : ResourceAssignmentProcessor() {
}
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
index b5bafad59..ce00ac17b 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/ResourceAssignmentProcessor.kt
@@ -191,11 +191,11 @@ abstract class ResourceAssignmentProcessor : BlueprintFunctionNode<ResourceAssig
}
fun addError(type: String, name: String, error: String) {
- raRuntimeService.getBlueprintError().addError(type, name, error)
+ raRuntimeService.getBlueprintError().addError(type, name, error, getName())
}
fun addError(error: String) {
- raRuntimeService.getBlueprintError().addError(error)
+ raRuntimeService.getBlueprintError().addError(error, getName())
}
fun isTemplateKeyValueNull(resourceAssignment: ResourceAssignment): Boolean {
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
index 0085b1624..c17e14000 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/processor/RestResourceResolutionProcessor.kt
@@ -187,6 +187,6 @@ open class RestResourceResolutionProcessor(private val blueprintRestLibPropertyS
}
override suspend fun recoverNB(runtimeException: RuntimeException, resourceAssignment: ResourceAssignment) {
- raRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
index 80ba8315b..74a88b4e3 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentTest.kt
@@ -145,7 +145,8 @@ class ResourceResolutionComponentTest {
any(),
any(),
any<List<String>>(),
- any<MutableMap<String, Any>>()
+ any<MutableMap<String, Any>>(),
+ "step"
)
} returns ResourceResolutionResult(mutableMapOf(), mutableMapOf())
@@ -168,7 +169,7 @@ class ResourceResolutionComponentTest {
every { bluePrintRuntimeService.getBlueprintError() } returns blueprintError
resourceResolutionComponent.recoverNB(exception, executionRequest)
- assertEquals(1, blueprintError.errors.size)
+ assertEquals(1, blueprintError.allErrors().size)
}
}
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
index 00fb39515..a1de557d5 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionServiceTest.kt
@@ -182,7 +182,8 @@ class ResourceResolutionServiceTest {
bluePrintRuntimeService,
"resource-assignment",
artifactNames,
- props
+ props,
+ "mockStep"
)
}.let {
assertEquals(artifactNames.toSet(), it.templateMap.keys)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
index de46fe6f3..77c90ba51 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/mock/MockRestResourceResolutionProcessor.kt
@@ -110,7 +110,7 @@ class MockRestResourceResolutionProcessor(
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ResourceAssignment) {
- raRuntimeService.getBlueprintError().addError(runtimeException.message!!)
+ addError(runtimeException.message!!)
}
private fun blueprintWebClientService(resourceAssignment: ResourceAssignment): MockBlueprintWebClientService {
diff --git a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
index 59c010eb5..cb44364c0 100644
--- a/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
+++ b/ms/blueprintsprocessor/functions/restful-executor/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/restful/executor/ComponentRestfulExecutor.kt
@@ -66,7 +66,6 @@ open class ComponentRestfulExecutor(private var componentFunctionScriptingServic
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError()
- .addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}")
+ addError("Failed in ComponentRestfulExecutor : ${runtimeException.message}")
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintError.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintError.kt
index b4d95ca3b..2ecdce770 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintError.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintError.kt
@@ -18,13 +18,21 @@ package org.onap.ccsdk.cds.controllerblueprints.core
class BlueprintError {
- var errors: MutableList<String> = arrayListOf()
+ private val errors: MutableMap<String, MutableList<String>> = mutableMapOf()
- fun addError(type: String, name: String, error: String) {
- this.errors.add("$type : $name : $error")
+ fun addError(type: String, name: String, error: String, stepName: String) {
+ addError("$type : $name : $error", stepName)
}
- fun addError(error: String) {
- this.errors.add(error)
+ fun addError(error: String, stepName: String) {
+ errors.getOrPut(stepName, { mutableListOf() }).add(error)
}
+
+ fun addErrors(stepName: String, errorList: List<String>) {
+ errors.getOrPut(stepName, { mutableListOf() }).addAll(errorList)
+ }
+
+ fun allErrors(): List<String> = errors.values.flatten()
+
+ fun stepErrors(stepName: String): MutableList<String>? = errors[stepName]
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintContext.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintContext.kt
index b79b86747..62026be88 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintContext.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/service/BlueprintContext.kt
@@ -103,8 +103,11 @@ class BlueprintContext(val serviceTemplate: ServiceTemplate) {
fun workflowInputs(workFlowName: String) = workflowByName(workFlowName).inputs
+ fun workflowSteps(workFlowName: String) =
+ workflowByName(workFlowName).steps ?: throw BlueprintException("could't get steps for workflow($workFlowName)")
+
fun workflowStepByName(workFlowName: String, stepName: String): Step {
- return workflowByName(workFlowName).steps?.get(stepName)
+ return workflowSteps(workFlowName)[stepName]
?: throw BlueprintException("could't get step($stepName) for workflow($workFlowName)")
}
@@ -114,8 +117,9 @@ class BlueprintContext(val serviceTemplate: ServiceTemplate) {
}
fun workflowFirstStepNodeTemplate(workFlowName: String): String {
- val firstStepName = workflowByName(workFlowName).steps?.keys?.first()
- ?: throw BlueprintException("could't get first step for workflow($workFlowName)")
+ val firstStepName = workflowSteps(workFlowName).keys.ifEmpty {
+ throw BlueprintException("could't get first step for workflow($workFlowName)")
+ }.first()
return workflowStepNodeTemplate(workFlowName, firstStepName)
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintErrorTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintErrorTest.kt
index 482d21abd..94ba98603 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintErrorTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-core/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/core/BlueprintErrorTest.kt
@@ -10,24 +10,24 @@ class BlueprintErrorTest {
fun testBlueprintErrorIsCreatedWithemptyList() {
val bluePrintError = BlueprintError()
- assertTrue(bluePrintError.errors.isEmpty())
+ assertTrue(bluePrintError.allErrors().isEmpty())
}
@Test
fun testAddErrorWith3Params() {
val bluePrintError = BlueprintError()
- bluePrintError.addError("type", "name", "error")
+ bluePrintError.addError("type", "name", "error", "step")
- assertEquals("type : name : error", bluePrintError.errors[0])
+ assertEquals("type : name : error", bluePrintError.stepErrors("step")!![0])
}
@Test
- fun testAddErrorWith1Params() {
+ fun testAddErrorWith2Params() {
val bluePrintError = BlueprintError()
- bluePrintError.addError("error")
+ bluePrintError.addError("error", "step")
- assertEquals("error", bluePrintError.errors[0])
+ assertEquals("error", bluePrintError.stepErrors("step")!![0])
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorService.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorService.kt
index fe3aeb1ed..aac1c2e97 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorService.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorService.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.controllerblueprints.validation
+import org.jetbrains.kotlin.utils.addToStdlib.ifNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintException
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintTypeValidatorService
@@ -57,9 +58,10 @@ open class BlueprintDesignTimeValidatorService(
// Validate Resource Definitions
validateResourceDefinitions(bluePrintRuntimeService)
- if (bluePrintRuntimeService.getBlueprintError().errors.size > 0) {
- throw BlueprintException("failed in blueprint validation : ${bluePrintRuntimeService.getBlueprintError().errors.joinToString("\n")}")
+ bluePrintRuntimeService.getBlueprintError().allErrors().ifNotEmpty {
+ throw BlueprintException("failed in blueprint validation : ${this.joinToString("\n")}")
}
+
return true
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintServiceTemplateValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintServiceTemplateValidatorImpl.kt
index b9450e66d..137e6e6b9 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintServiceTemplateValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintServiceTemplateValidatorImpl.kt
@@ -58,7 +58,7 @@ open class BlueprintServiceTemplateValidatorImpl(private val bluePrintTypeValida
serviceTemplate.topologyTemplate?.let { validateTopologyTemplate(serviceTemplate.topologyTemplate!!) }
} catch (e: Exception) {
log.error("failed in blueprint service template validation", e)
- error.addError(BlueprintConstants.PATH_SERVICE_TEMPLATE, paths.joinToString(BlueprintConstants.PATH_DIVIDER), e.message!!)
+ error.addError(BlueprintConstants.PATH_SERVICE_TEMPLATE, paths.joinToString(BlueprintConstants.PATH_DIVIDER), e.message!!, "BlueprintServiceTemplateValidator")
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintWorkflowValidatorImpl.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintWorkflowValidatorImpl.kt
index 8f9cb01c5..bff09fc83 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintWorkflowValidatorImpl.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/main/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintWorkflowValidatorImpl.kt
@@ -76,7 +76,8 @@ open class BlueprintWorkflowValidatorImpl(private val bluePrintTypeValidatorServ
.addError(
"Failed to validate Workflow($workflowName)'s step($stepName)'s " +
"definition",
- paths.joinToString(BlueprintConstants.PATH_DIVIDER), e.message!!
+ paths.joinToString(BlueprintConstants.PATH_DIVIDER), e.message!!,
+ "BlueprintWorkflowValidatorImpl"
)
}
}
diff --git a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt
index 49c12b95f..dd82ec5da 100644
--- a/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/blueprints/blueprint-validation/src/test/kotlin/org/onap/ccsdk/cds/controllerblueprints/validation/BlueprintDesignTimeValidatorServiceTest.kt
@@ -63,10 +63,10 @@ class BlueprintDesignTimeValidatorServiceTest {
workflow.steps = mutableMapOf("test" to step)
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
- assertEquals(1, bluePrintRuntime.getBlueprintError().errors.size)
+ assertEquals(1, bluePrintRuntime.getBlueprintError().allErrors().size)
assertEquals(
"Failed to validate Workflow(resource-assignment)'s step(test)'s definition : resource-assignment/steps/test : could't get node template for the name(TestCaseFailNoNodeTemplate)",
- bluePrintRuntime.getBlueprintError().errors[0]
+ bluePrintRuntime.getBlueprintError().allErrors()[0]
)
}
@@ -96,12 +96,12 @@ class BlueprintDesignTimeValidatorServiceTest {
workflow.steps = mutableMapOf("test" to step)
workflowValidator.validate(bluePrintRuntime, workflowName, workflow)
- assertEquals(1, bluePrintRuntime.getBlueprintError().errors.size)
+ assertEquals(1, bluePrintRuntime.getBlueprintError().allErrors().size)
assertEquals(
"Failed to validate Workflow(resource-assignment)'s step(test)'s definition : " +
"resource-assignment/steps/test : NodeType(TestNodeType) derived from is 'tosca.nodes.TEST', " +
"Expected 'tosca.nodes.Workflow' or 'tosca.nodes.Component'",
- bluePrintRuntime.getBlueprintError().errors[0]
+ bluePrintRuntime.getBlueprintError().allErrors()[0]
)
}
diff --git a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BlueprintEnhancerServiceImpl.kt b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BlueprintEnhancerServiceImpl.kt
index aa8b77a17..7603963a1 100644
--- a/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BlueprintEnhancerServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/designer-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/designer/api/enhancer/BlueprintEnhancerServiceImpl.kt
@@ -78,8 +78,8 @@ open class BlueprintEnhancerServiceImpl(
// Write the Enhanced Blueprint Resource Definitions
ResourceDictionaryUtils.writeResourceDefinitionTypes(basePath, resourceDefinitions)
- if (blueprintRuntimeService.getBlueprintError().errors.isNotEmpty()) {
- throw BlueprintException(blueprintRuntimeService.getBlueprintError().errors.toString())
+ if (blueprintRuntimeService.getBlueprintError().allErrors().isNotEmpty()) {
+ throw BlueprintException(blueprintRuntimeService.getBlueprintError().allErrors().toString())
}
} catch (e: BlueprintProcessorException) {
val errorMsg = "Error while enriching the CBA package."
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
index 3d8cc04ef..8c958c4b4 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/ExecutionServiceHandler.kt
@@ -42,7 +42,6 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BlueprintDependencyS
import org.onap.ccsdk.cds.controllerblueprints.core.utils.BlueprintMetadataUtils
import org.slf4j.LoggerFactory
import org.springframework.stereotype.Service
-import java.util.stream.Collectors
@Service
class ExecutionServiceHandler(
@@ -119,10 +118,9 @@ class ExecutionServiceHandler(
executionServiceInput, hashMapOf()
)
- val errors = blueprintRuntimeService.getBlueprintError().errors
+ val errors = blueprintRuntimeService.getBlueprintError().allErrors()
if (errors.isNotEmpty()) {
- val errorMessage = errors.stream().map { it.toString() }.collect(Collectors.joining(", "))
- setErrorStatus(errorMessage, executionServiceOutput.status)
+ setErrorStatus(errors.joinToString(", "), executionServiceOutput.status)
}
}
} catch (e: Exception) {
diff --git a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt
index 8be43cc94..46befee8a 100644
--- a/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/selfservice-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/selfservice/api/KafkaPublishAuditService.kt
@@ -169,9 +169,7 @@ class KafkaPublishAuditService(
val blueprintRuntimeService = BlueprintMetadataUtils.getBlueprintRuntime(requestId, basePath.toString())
val blueprintContext = blueprintRuntimeService.bluePrintContext()
- val workflowSteps = blueprintContext.workflowByName(workflowName).steps
- checkNotNull(workflowSteps) { "Failed to get step(s) for workflow($workflowName)" }
- workflowSteps.forEach { step ->
+ blueprintContext.workflowSteps(workflowName).forEach { step ->
val nodeTemplateName = step.value.target
checkNotNull(nodeTemplateName) { "Failed to get node template target for workflow($workflowName), step($step)" }
val nodeTemplate = blueprintContext.nodeTemplateByName(nodeTemplateName)
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
index c1a898582..f85b6424d 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/AbstractComponentFunction.kt
@@ -65,7 +65,7 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
var operationInputs: MutableMap<String, JsonNode> = hashMapOf()
override fun getName(): String {
- return stepName
+ return "$stepName - $nodeTemplateName"
}
override suspend fun prepareRequestNB(executionRequest: ExecutionServiceInput): ExecutionServiceInput {
@@ -143,8 +143,12 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
properties = stepOutputs
}
executionServiceOutput.stepData = stepOutputData
- // Set the Default Step Status
+
status.eventType = EventType.EVENT_COMPONENT_EXECUTED.name
+
+ bluePrintRuntimeService.getBlueprintError().stepErrors(stepName)?.let {
+ status.message = BlueprintConstants.STATUS_FAILURE
+ }
} catch (e: Exception) {
status.message = BlueprintConstants.STATUS_FAILURE
status.eventType = EventType.EVENT_COMPONENT_FAILURE.name
@@ -192,11 +196,11 @@ abstract class AbstractComponentFunction : BlueprintFunctionNode<ExecutionServic
}
fun addError(type: String, name: String, error: String) {
- bluePrintRuntimeService.getBlueprintError().addError(type, name, error)
+ bluePrintRuntimeService.getBlueprintError().addError(type, name, error, stepName)
}
fun addError(error: String) {
- bluePrintRuntimeService.getBlueprintError().addError(error)
+ bluePrintRuntimeService.getBlueprintError().addError(error, stepName)
}
/**
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
index 815b190dd..5a552e32a 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentRemoteScriptExecutor.kt
@@ -101,7 +101,6 @@ open class ComponentRemoteScriptExecutor(
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError()
- .addError("Failed in ComponentRemoteScriptExecutor : ${runtimeException.message}")
+ addError("Failed in ComponentRemoteScriptExecutor : ${runtimeException.message}")
}
}
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
index 213d21eae..d2c81a626 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/ComponentScriptExecutor.kt
@@ -67,8 +67,7 @@ open class ComponentScriptExecutor(private var componentFunctionScriptingService
}
override suspend fun recoverNB(runtimeException: RuntimeException, executionRequest: ExecutionServiceInput) {
- bluePrintRuntimeService.getBlueprintError()
- .addError("Failed in ComponentScriptExecutor : ${runtimeException.message}")
+ addError("Failed in ComponentScriptExecutor : ${runtimeException.message}")
}
open fun populateScriptDependencies(scriptDependencies: MutableList<String>) {
diff --git a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
index 8440e5faa..3438821c7 100644
--- a/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
+++ b/ms/blueprintsprocessor/modules/services/execution-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/execution/scripts/AbstractComponentFunctionTest.kt
@@ -41,6 +41,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.AbstractCompone
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.ComponentFunctionScriptingService
import org.onap.ccsdk.cds.blueprintsprocessor.services.execution.nodeTypeComponentScriptExecutor
import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintConstants
+import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintError
import org.onap.ccsdk.cds.controllerblueprints.core.BlueprintTypes
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonPrimitive
import org.onap.ccsdk.cds.controllerblueprints.core.asJsonType
@@ -90,6 +91,8 @@ class AbstractComponentFunctionTest {
any(), any(), any()
)
} returns Implementation()
+
+ every { bluePrintRuntimeService.getBlueprintError() } returns BlueprintError()
}
@Test
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt
index d690235e9..5a175b056 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImpl.kt
@@ -97,7 +97,7 @@ open class BlueprintWorkflowExecutionServiceImpl(
workflowOutputs = bluePrintRuntimeService.resolveWorkflowOutputs(workflowName)
} catch (e: RuntimeException) {
log.error("Failed to resolve outputs for workflow: $workflowName", e)
- e.message?.let { bluePrintRuntimeService.getBlueprintError().errors.add(it) }
+ e.message?.let { bluePrintRuntimeService.getBlueprintError().addError(it, "workflow") }
}
// Set the Response Payload
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
index 330d297c2..322180893 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ComponentWorkflowExecutionService.kt
@@ -38,10 +38,10 @@ open class ComponentWorkflowExecutionService(private val nodeTemplateExecutionSe
// Get the DG Node Template
val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
+ val stepName = bluePrintContext.workflowSteps(workflowName).keys.first()
return nodeTemplateExecutionService.executeNodeTemplate(
- bluePrintRuntimeService,
- nodeTemplateName, executionServiceInput
+ bluePrintRuntimeService, stepName, nodeTemplateName, executionServiceInput
)
}
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
index c8d72a1a4..efcae4aee 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/DGWorkflowExecutionService.kt
@@ -19,6 +19,7 @@ package org.onap.ccsdk.cds.blueprintsprocessor.services.workflow
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceInput
import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.ExecutionServiceOutput
+import org.onap.ccsdk.cds.blueprintsprocessor.core.api.data.StepData
import org.onap.ccsdk.cds.blueprintsprocessor.services.workflow.utils.SvcGraphUtils
import org.onap.ccsdk.cds.controllerblueprints.core.interfaces.BlueprintWorkflowExecutionService
import org.onap.ccsdk.cds.controllerblueprints.core.normalizedPathName
@@ -45,6 +46,11 @@ open class DGWorkflowExecutionService(private val blueprintSvcLogicService: Blue
// Get the DG Node Template
val nodeTemplateName = bluePrintContext.workflowFirstStepNodeTemplate(workflowName)
+ val stepName = bluePrintContext.workflowSteps(workflowName).keys.first()
+ executionServiceInput.stepData = StepData().apply {
+ name = stepName
+ }
+
log.info("Executing workflow($workflowName) directed graph NodeTemplate($nodeTemplateName)")
// Get the DG file info
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
index 561136a87..29019b7cc 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/ImperativeWorkflowExecutionService.kt
@@ -114,7 +114,7 @@ open class ImperativeBlueprintWorkflowService(private val nodeTemplateExecutionS
if (exceptions.isNotEmpty()) {
exceptions.forEach {
val errorMessage = it.message ?: ""
- bluePrintRuntimeService.getBlueprintError().addError(errorMessage)
+ bluePrintRuntimeService.getBlueprintError().addError(errorMessage, "workflow")
log.error("workflow($workflowId) exception :", it)
}
message = BlueprintConstants.STATUS_FAILURE
@@ -160,12 +160,15 @@ open class ImperativeBlueprintWorkflowService(private val nodeTemplateExecutionS
/** execute node template */
val executionServiceOutput = nodeTemplateExecutionService
- .executeNodeTemplate(bluePrintRuntimeService, nodeTemplateName, nodeInput)
+ .executeNodeTemplate(bluePrintRuntimeService, node.id, nodeTemplateName, nodeInput)
- return when (executionServiceOutput.status.message) {
- BlueprintConstants.STATUS_FAILURE -> EdgeLabel.FAILURE
- else -> EdgeLabel.SUCCESS
+ if (executionServiceOutput.status.message == BlueprintConstants.STATUS_FAILURE) {
+ // Clear step errors so that the workflow does not fail
+ bluePrintRuntimeService.getBlueprintError().stepErrors(node.id)?.clear()
+ return EdgeLabel.FAILURE
}
+
+ return EdgeLabel.SUCCESS
}
override suspend fun skipNode(
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
index 1d179a1b7..ff8f5b8cf 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionService.kt
@@ -37,6 +37,7 @@ open class NodeTemplateExecutionService(private val bluePrintClusterService: Blu
suspend fun executeNodeTemplate(
bluePrintRuntimeService: BlueprintRuntimeService<*>,
+ stepName: String,
nodeTemplateName: String,
executionServiceInput: ExecutionServiceInput
): ExecutionServiceOutput {
@@ -66,7 +67,8 @@ open class NodeTemplateExecutionService(private val bluePrintClusterService: Blu
// Set the Blueprint Services
plugin.bluePrintRuntimeService = bluePrintRuntimeService
plugin.bluePrintClusterService = bluePrintClusterService
- plugin.stepName = nodeTemplateName
+ plugin.stepName = stepName
+ plugin.nodeTemplateName = nodeTemplateName
// Parent request shouldn't tamper, so need to clone the request and send to the actual component.
val clonedExecutionServiceInput = ExecutionServiceInput().apply {
@@ -81,7 +83,7 @@ open class NodeTemplateExecutionService(private val bluePrintClusterService: Blu
stepInputs[BlueprintConstants.PROPERTY_CURRENT_INTERFACE] = interfaceName.asJsonPrimitive()
stepInputs[BlueprintConstants.PROPERTY_CURRENT_OPERATION] = operationName.asJsonPrimitive()
val stepInputData = StepData().apply {
- name = nodeTemplateName
+ name = stepName
properties = stepInputs
}
clonedExecutionServiceInput.stepData = stepInputData
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
index cf5955e33..2e3f78a69 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/executor/ComponentExecuteNodeExecutor.kt
@@ -48,10 +48,11 @@ open class ComponentExecuteNodeExecutor(private val nodeTemplateExecutionService
val executionInput = ctx.getRequest() as ExecutionServiceInput
+ val stepName = executionInput.stepData?.name ?: nodeTemplateName
+
try { // Get the Request from the Context and Set to the Function Input and Invoke the function
val executionOutput = nodeTemplateExecutionService.executeNodeTemplate(
- ctx.getBlueprintService(),
- nodeTemplateName, executionInput
+ ctx.getBlueprintService(), stepName, nodeTemplateName, executionInput
)
ctx.setResponse(executionOutput)
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt
index 0bd1c33c9..b7087b338 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/BlueprintWorkflowExecutionServiceImplTest.kt
@@ -178,7 +178,7 @@ class BlueprintWorkflowExecutionServiceImplTest {
val output = bluePrintWorkflowExecutionServiceImpl.executeBlueprintWorkflow(
bluePrintRuntimeService, executionServiceInput, mutableMapOf()
)
- assertEquals("failed to resolve property...", blueprintError.errors[0])
+ assertEquals("failed to resolve property...", blueprintError.allErrors()[0])
assertEquals("""{"config-assign-response":{}}""".asJsonType(), output.payload)
}
}
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt
index 70b52d053..b113987e5 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/services/workflow/NodeTemplateExecutionServiceTest.kt
@@ -72,10 +72,12 @@ class NodeTemplateExecutionServiceTest {
val input = executionServiceInput.payload.get("resource-assignment-request")
bluePrintRuntimeService.assignWorkflowInputs("resource-assignment", input)
+ val stepName = bluePrintRuntimeService.bluePrintContext()
+ .workflowSteps("resource-assignment").keys.first()
val nodeTemplate = "resource-assignment"
val nodeTemplateExecutionService = NodeTemplateExecutionService(bluePrintClusterService)
val executionServiceOutput = nodeTemplateExecutionService
- .executeNodeTemplate(bluePrintRuntimeService, nodeTemplate, executionServiceInput)
+ .executeNodeTemplate(bluePrintRuntimeService, stepName, nodeTemplate, executionServiceInput)
assertNotNull(executionServiceOutput, "failed to get response")
assertEquals(