summaryrefslogtreecommitdiffstats
path: root/ms/blueprintsprocessor/functions
diff options
context:
space:
mode:
Diffstat (limited to 'ms/blueprintsprocessor/functions')
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionComponent.kt8
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/ResourceResolutionService.kt4
-rw-r--r--ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt18
-rwxr-xr-xms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt8
4 files changed, 32 insertions, 6 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 7c2c11c06..c98c6d6bd 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
@@ -35,7 +35,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
override suspend fun processNB(executionRequest: ExecutionServiceInput) {
val occurrence = getOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_OCCURRENCE)
- val key = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY)
+ val resolutionKey = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY)
val storeResult = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)
val resourceId = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID)
val resourceType = getOptionalOperationInput(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE)
@@ -43,7 +43,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
val properties: MutableMap<String, Any> = mutableMapOf()
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] = storeResult?.asBoolean() ?: false
- properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY] = key?.asText() ?: ""
+ properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY] = resolutionKey?.asText() ?: ""
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_ID] = resourceId?.asText() ?: ""
properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_RESOURCE_TYPE] = resourceType?.asText() ?: ""
@@ -52,6 +52,8 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
val jsonResponse = JsonNodeFactory.instance.objectNode()
for (j in 1..occurrence.asInt()) {
+ val key = resolutionKey?.asText() + "-" + j
+ properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_KEY] = key
val response = resourceResolutionService.resolveResources(bluePrintRuntimeService,
nodeTemplateName,
@@ -60,7 +62,7 @@ open class ResourceResolutionComponent(private val resourceResolutionService: Re
// provide indexed result in output if we have multiple resolution
if (occurrence.asInt() != 1) {
- jsonResponse.set(key?.asText() + "-" + j, response.asJsonNode())
+ jsonResponse.set(key, response.asJsonNode())
} else {
jsonResponse.setAll(response.asObjectNode())
}
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 96c3f644c..ba0adf967 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
@@ -24,6 +24,7 @@ import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.R
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db.TemplateResolutionService
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.processor.ResourceAssignmentProcessor
import org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.utils.ResourceAssignmentUtils
+import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintConstants
import org.onap.ccsdk.cds.controllerblueprints.core.BluePrintProcessorException
import org.onap.ccsdk.cds.controllerblueprints.core.checkNotEmpty
import org.onap.ccsdk.cds.controllerblueprints.core.service.BluePrintRuntimeService
@@ -175,7 +176,8 @@ open class ResourceResolutionServiceImpl(private var applicationContext: Applica
// Invoke Apply Method
resourceAssignmentProcessor.applyNB(resourceAssignment)
- if (properties.containsKey(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)
+ if (BluePrintConstants.STATUS_FAILURE != resourceAssignment.status
+ && properties.containsKey(ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT)
&& properties[ResourceResolutionConstants.RESOURCE_RESOLUTION_INPUT_STORE_RESULT] as Boolean) {
resourceResolutionDBService.write(properties,
blueprintRuntimeService,
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
index 767a1feaf..fa922cde5 100644
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/ResourceResolution.kt
@@ -17,7 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db
import com.fasterxml.jackson.annotation.JsonFormat
-import com.fasterxml.jackson.annotation.JsonProperty
+import io.swagger.annotations.ApiModelProperty
import org.hibernate.annotations.Proxy
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
@@ -42,43 +42,57 @@ class ResourceResolution : Serializable {
@Column(name = "resource_resolution_id")
var id: String? = null
+ @get:ApiModelProperty(value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
+ required = true)
@Column(name = "resolution_key", nullable = false)
var resolutionKey: String? = null
+ @get:ApiModelProperty(value = "Resolution type.", required = true, example = "ServiceInstance, VfModule, VNF")
@Column(name = "resource_type", nullable = false)
var resourceType: String? = null
+ @get:ApiModelProperty(value = "ID associated with the resolution type in the inventory system.", required = true)
@Column(name = "resource_id", nullable = false)
var resourceId: String? = null
+ @get:ApiModelProperty(value = "Name of the CBA.", required = true)
@Column(name = "blueprint_name", nullable = false)
var blueprintName: String? = null
+ @get:ApiModelProperty(value = "Version of the CBA.", required = true)
@Column(name = "blueprint_version", nullable = false)
var blueprintVersion: String? = null
+ @get:ApiModelProperty(value = "Artifact name for which to retrieve a resolved resource.", required = true)
@Column(name = "artifact_name", nullable = false)
var artifactName: String? = null
+ @get:ApiModelProperty(value = "Whether success of failure.", required = true)
@Column(name = "status", nullable = false)
var status: String? = null
+ @get:ApiModelProperty(value = "Name of the resource.", required = true)
@Column(name = "name", nullable = false)
var name: String? = null
- @Column(name = "dictionary_vname", nullable = false)
+ @get:ApiModelProperty(value = "Name of the data dictionary used for the resolution.", required = true)
+ @Column(name = "dictionary_name", nullable = false)
var dictionaryName: String? = null
+ @get:ApiModelProperty(value = "Source associated with the data dictionary used for the resolution.", required = true)
@Column(name = "dictionary_status", nullable = false)
var dictionarySource: String? = null
+ @get:ApiModelProperty(value = "Version of the data dictionary used for the resolution.", required = true)
@Column(name = "dictionary_version", nullable = false)
var dictionaryVersion: Int = 0
+ @get:ApiModelProperty(value = "Value of the resolution.", required = true)
@Lob
@Column(name = "value", nullable = false)
var value: String? = null
+ @get:ApiModelProperty(value = "Creation date of the resolution.", required = true)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)
diff --git a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
index ea5626a80..ae24a9ac2 100755
--- a/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
+++ b/ms/blueprintsprocessor/functions/resource-resolution/src/main/kotlin/org/onap/ccsdk/cds/blueprintsprocessor/functions/resource/resolution/db/TemplateResolution.kt
@@ -17,6 +17,7 @@
package org.onap.ccsdk.cds.blueprintsprocessor.functions.resource.resolution.db
import com.fasterxml.jackson.annotation.JsonFormat
+import io.swagger.annotations.ApiModelProperty
import org.hibernate.annotations.Proxy
import org.springframework.data.annotation.LastModifiedDate
import org.springframework.data.jpa.domain.support.AuditingEntityListener
@@ -41,22 +42,29 @@ class TemplateResolution : Serializable {
@Column(name = "template_resolution_id")
var id: String? = null
+ @get:ApiModelProperty(value = "Resolution Key uniquely identifying the resolution of a given artifact within a CBA.",
+ required = true)
@Column(name = "resolution_key", nullable = false)
var resolutionKey: String? = null
+ @get:ApiModelProperty(value = "Name of the CBA.", required = true)
@Column(name = "blueprint_name", nullable = false)
var blueprintName: String? = null
+ @get:ApiModelProperty(value = "Version of the CBA.", required = true)
@Column(name = "blueprint_version", nullable = false)
var blueprintVersion: String? = null
+ @get:ApiModelProperty(value = "Artifact name for which to retrieve a resolved resource.", required = true)
@Column(name = "artifact_name", nullable = false)
var artifactName: String? = null
+ @get:ApiModelProperty(value = "Rendered template.", required = true)
@Lob
@Column(name = "result", nullable = false)
var result: String? = null
+ @get:ApiModelProperty(value = "Creation date of the resolution.", required = true)
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
@LastModifiedDate
@Temporal(TemporalType.TIMESTAMP)