aboutsummaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions/resource-resolution/src
diff options
context:
space:
mode:
authorJozsef Csongvai <jozsef.csongvai@bell.ca>2020-12-09 19:49:48 -0500
committerJozsef Csongvai <jozsef.csongvai@bell.ca>2021-03-17 22:31:31 -0400
commitb96b44d6d7ca11dbbc3ad4bd2194df31fba5efb6 (patch)
treec10077ebb496410271ca3d07ca8896048c817bd9 /ms/blueprintsprocessor/functions/resource-resolution/src
parentae588292c67e20c5cae8cb3c899957aac79a676d (diff)
Refactoring to enable on_failure for imperative workflow
BlueprintError needs to associate errors with the steps in which they occurred in order for imperative workflow to handle on_failure properly. Made stepName more accessible and corrected places where stepName was assigned to nodeTemplateName. Issue-ID: CCSDK-3219 Change-Id: I7e5805745c63558cff6be533e1b99c32ad06c3db Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
Diffstat (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src')
-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
13 files changed, 26 insertions, 23 deletions
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 {