summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor')
-rwxr-xr-xms/blueprintsprocessor/application/src/main/docker/Dockerfile2
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt11
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt1
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt7
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtils.kt7
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt17
-rw-r--r--ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt10
-rw-r--r--ms/blueprintsprocessor/modules/services/workflow-service/pom.xml3
9 files changed, 53 insertions, 6 deletions
diff --git a/ms/blueprintsprocessor/application/src/main/docker/Dockerfile b/ms/blueprintsprocessor/application/src/main/docker/Dockerfile
index bd1b3804a..e9c4c5895 100755
--- a/ms/blueprintsprocessor/application/src/main/docker/Dockerfile
+++ b/ms/blueprintsprocessor/application/src/main/docker/Dockerfile
@@ -9,7 +9,7 @@ FROM omahoco1/alpine-java-python
# add entrypoint
COPY startService.sh /startService.sh
-RUN addgroup -S onap && adduser -S onap -G onap
+RUN addgroup -S -g 1000 onap && adduser -u 1000 -S onap -G onap
RUN chown onap:onap /startService.sh
RUN touch /velocity.log && chmod 777 /velocity.log
RUN chown onap:onap /velocity.log
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 3c95ea7bb..e15705a7e 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
@@ -51,6 +51,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
const val ATTRIBUTE_STATUS = "status"
const val OUTPUT_RESOURCE_ASSIGNMENT_PARAMS = "resource-assignment-params"
+ const val OUTPUT_RESOURCE_ASSIGNMENT_MAP = "resource-assignment-map"
const val OUTPUT_STATUS = "status"
}
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
index fd104d3ad..8c854b840 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponentDSL.kt
@@ -116,6 +116,10 @@ fun BluePrintTypes.nodeTypeComponentResourceResolution(): NodeType {
true, "Output Response"
)
property(
+ ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_MAP, BluePrintConstants.DATA_TYPE_MAP,
+ true, "Output Resolved Values"
+ )
+ property(
ResourceResolutionComponent.OUTPUT_STATUS, BluePrintConstants.DATA_TYPE_STRING,
true, "Status of the Component Execution ( success or failure )"
)
@@ -229,6 +233,13 @@ class ComponentResourceResolutionNodeTemplateBuilder(id: String, description: St
property(ResourceResolutionComponent.OUTPUT_STATUS, status)
}
+ fun resourceAssignmentMap(resourceAssignmentMap: String) =
+ resourceAssignmentMap(resourceAssignmentMap.asJsonType())
+
+ fun resourceAssignmentMap(resourceAssignmentMap: JsonNode) {
+ property(ResourceResolutionComponent.OUTPUT_RESOURCE_ASSIGNMENT_MAP, resourceAssignmentMap)
+ }
+
fun resourceAssignmentParams(resourceAssignmentParams: String) =
resourceAssignmentParams(resourceAssignmentParams.asJsonType())
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
index b934940b1..e2a8920f5 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionConstants.kt
@@ -23,6 +23,7 @@ object ResourceResolutionConstants {
const val PREFIX_RESOURCE_RESOLUTION_PROCESSOR = "rr-processor-"
const val INPUT_ARTIFACT_PREFIX_NAMES = "artifact-prefix-names"
const val OUTPUT_ASSIGNMENT_PARAMS = "assignment-params"
+ const val OUTPUT_ASSIGNMENT_MAP = "assignment-map"
const val FILE_NAME_RESOURCE_DEFINITION_TYPES = "resources_definition_types.json"
const val RESOURCE_RESOLUTION_INPUT_RESOLUTION_KEY = "resolution-key"
const val RESOURCE_RESOLUTION_INPUT_STORE_RESULT = "store-result"
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 15fd1d673..4ad86b4ad 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
@@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.JsonNode
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.coroutineScope
+import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.ResourceResolutionConstants.OUTPUT_ASSIGNMENT_MAP
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolution
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.ResourceResolutionDBService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.TemplateResolutionService
@@ -185,6 +186,12 @@ open class ResourceResolutionServiceImpl(
properties
)
+ bluePrintRuntimeService.setNodeTemplateAttributeValue(
+ nodeTemplateName,
+ OUTPUT_ASSIGNMENT_MAP,
+ ResourceAssignmentUtils.generateAssignmentMap(artifactPrefix, resourceAssignments)
+ )
+
val resolutionSummary = properties.getOrDefault(
ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOLUTION_SUMMARY,
false
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 1be9649b9..f97c669d6 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
@@ -274,6 +274,13 @@ class ResourceAssignmentUtils {
return JacksonUtils.getJson(data, includeNull = true)
}
+ fun generateAssignmentMap(
+ artifactPrefix: String,
+ resourceAssignments: List<ResourceAssignment>
+ ): ObjectNode = resourceAssignments.associateBy({ it.name }, { it.property?.value })
+ .let { mutableMapOf(artifactPrefix to it) }
+ .let { JacksonUtils.objectNodeFromObject(it) }
+
private fun useDefaultValueIfNull(
resourceAssignment: ResourceAssignment,
resourceAssignmentName: String
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
index b4befc26d..6734613fc 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/test/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/utils/ResourceAssignmentUtilsTest.kt
@@ -22,6 +22,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils
import com.fasterxml.jackson.databind.JsonNode
+import com.fasterxml.jackson.databind.node.ObjectNode
import com.fasterxml.jackson.databind.node.TextNode
import io.mockk.every
import io.mockk.spyk
@@ -167,7 +168,7 @@ class ResourceAssignmentUtilsTest {
}
@Test
- fun generate() {
+ fun generateResolutionSummaryDataTest() {
val resourceAssignment = createResourceAssignmentForTest(null)
val resourceDefinition = ResourceDefinition()
val nodeTemplate = NodeTemplate().apply {
@@ -206,6 +207,20 @@ class ResourceAssignmentUtilsTest {
""".replace("\n|\\s".toRegex(), ""), result)
}
+ @Test
+ fun generateAssignmentMapTest() {
+ val artifactPrefix = "vdns"
+ val resourceAssignments = mutableListOf(
+ createResourceAssignmentForTest("abc-123", "vnf-id"),
+ createResourceAssignmentForTest(null, "vf-module-name")
+ )
+
+ val result: ObjectNode = ResourceAssignmentUtils.generateAssignmentMap(artifactPrefix, resourceAssignments)
+
+ assertEquals("abc-123", result["vdns"]["vnf-id"].textValue())
+ assertEquals(JacksonUtils.getJsonNode(null), result["vdns"]["vf-module-name"])
+ }
+
private fun createResourceAssignmentForTest(resourceValue: String?, resourceName: String = "pnf-id"): ResourceAssignment {
val valueForTest = if (resourceValue == null) null else TextNode(resourceValue)
val resourceAssignmentForTest = ResourceAssignment().apply {
diff --git a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
index 80000d5fc..bd52bfee6 100644
--- a/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
+++ b/ms/blueprintsprocessor/modules/inbounds/resource-api/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/resource/api/TemplateController.kt
@@ -94,7 +94,9 @@ open class TemplateController(private val templateResolutionService: TemplateRes
defaultValue = MediaType.TEXT_PLAIN_VALUE,
required = true
)
- @RequestParam(value = "format", required = false, defaultValue = MediaType.TEXT_PLAIN_VALUE) format: String
+ @RequestParam(value = "format", required = false, defaultValue = MediaType.TEXT_PLAIN_VALUE) format: String,
+ @ApiParam(value = "Occurrence of the template resolution (1-n).", required = false)
+ @RequestParam(value = "occurrence", required = false, defaultValue = "1") occurrence: Int = 1
):
ResponseEntity<String> = runBlocking {
@@ -108,7 +110,8 @@ open class TemplateController(private val templateResolutionService: TemplateRes
bpName,
bpVersion,
artifactName,
- resolutionKey
+ resolutionKey,
+ occurrence
)
} else if (resourceType.isNotEmpty() && resourceId.isNotEmpty()) {
result =
@@ -117,7 +120,8 @@ open class TemplateController(private val templateResolutionService: TemplateRes
bpVersion,
artifactName,
resourceId,
- resourceType
+ resourceType,
+ occurrence
)
} else {
throw httpProcessorException(ErrorCatalogCodes.REQUEST_NOT_FOUND, ResourceApiDomains.RESOURCE_API,
diff --git a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
index cfc03e7dc..41bdacf96 100644
--- a/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
+++ b/ms/blueprintsprocessor/modules/services/workflow-service/pom.xml
@@ -41,7 +41,8 @@
</dependency>
<dependency>
<groupId>org.onap.ccsdk.sli.core</groupId>
- <artifactId>sli-provider</artifactId>
+ <artifactId>sli-provider-base</artifactId>
+ <version>${ccsdk.sli.core.version}</version>
</dependency>
</dependencies>
</project>