From 2fce8bf2891f3ce472f4b06d09d0e987fbc44149 Mon Sep 17 00:00:00 2001 From: Jozsef Csongvai Date: Tue, 3 Mar 2020 10:08:59 -0500 Subject: Add properties to ResolutionSummary Also wrapping ResolutionSummary response to ease integration with SDNC. Issue-ID: CCSDK-2038 Signed-off-by: Jozsef Csongvai Change-Id: Ic1b8959e22ef795065d37664fb60f100af235a90 --- .../resolution/utils/ResourceAssignmentUtils.kt | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap') diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt index 6922192c6..7bb757b8e 100644 --- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt +++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt @@ -42,6 +42,7 @@ import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeServ import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonReactorUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.JacksonUtils import org.onap.ccsdk.cds.controllerblueprints.core.utils.PropertyDefinitionUtils.Companion.hasLogProtect +import org.onap.ccsdk.cds.controllerblueprints.resource.dict.DictionaryMetadataEntry import org.onap.ccsdk.cds.controllerblueprints.resource.dict.KeyIdentifier import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResolutionSummary import org.onap.ccsdk.cds.controllerblueprints.resource.dict.ResourceAssignment @@ -203,15 +204,22 @@ class ResourceAssignmentUtils { resourceDefinitions: Map ): String { val resolutionSummaryList = resourceAssignments.map { - val payload = resourceDefinitions[it.name] - ?.sources?.get(it.dictionarySource)?.properties?.get("resolved-payload") + val definition = resourceDefinitions[it.name] + val payload = definition?.sources?.get(it.dictionarySource) + ?.properties?.get("resolved-payload") + val metadata = definition?.property?.metadata + ?.map { e -> DictionaryMetadataEntry(e.key, e.value) } + ?.toMutableList() ?: mutableListOf() + val description = definition?.property?.description ResolutionSummary( - it.name, it.property?.value, it.property?.required, - it.property?.type, it.keyIdentifiers, it.dictionaryName, - payload, it.dictionarySource, it.status, it.message + it.name, it.property?.value, it.property?.required, it.property?.type, + it.keyIdentifiers, description, metadata, it.dictionaryName, + it.dictionarySource, payload, it.status, it.message ) } - return JacksonUtils.getJson(resolutionSummaryList, includeNull = true) + // Wrapper needed for integration with SDNC + val data = mapOf("resolution-summary" to resolutionSummaryList) + return JacksonUtils.getJson(data, includeNull = true) } private fun useDefaultValueIfNull( -- cgit 1.2.3-korg