aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main
diff options
context:
space:
mode:
authorhyu2010 <hyu2010b@gmail.com>2020-12-21 10:37:26 -0500
committerhyu2010 <hyu2010b@gmail.com>2020-12-23 15:22:56 -0500
commitd9fb2fbfa7f8c6b481bc8553f3035395f687664a (patch)
tree420522a1fd8e50dade93de53357c9e0566ed3c5d /bpmn/so-bpmn-infrastructure-common/src/main
parent3518025420e53b0257945ba7a0e1fd9925f8c25f (diff)
Fixes for bugs found in Transport Slicing integration
This update contains for the fixes for the following JIRAs: SO-3429: Transport Slicing integration: fix resource operation status table mapping SO-3434: Transport Slicing integration: modelUuid and modelInvariantUuid are missing from service-instance Issue-ID: SO-3429 Issue-ID: SO-3434 Signed-off-by: hyu2010 <hyu2010b@gmail.com> Change-Id: I7a9b7b7a3e40d967c138067a01f2c045fb3e4b56 Signed-off-by: hyu2010 <hyu2010b@gmail.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy24
5 files changed, 43 insertions, 25 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
index 05996d3671..37e3df1505 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy
@@ -142,20 +142,15 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor {
String status,
String progress,
String statusDescription) {
- String serviceId = execution.getVariable("sliceServiceInstanceId")
+ String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+ String modelUuid = execution.getVariable("modelUuid")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
String operType = execution.getVariable("actionType")
+ ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId,
+ jobId, nsiId, operType, status, progress, statusDescription)
- ResourceOperationStatus roStatus = new ResourceOperationStatus()
- roStatus.setServiceId(serviceId)
- roStatus.setOperationId(jobId)
- roStatus.setResourceTemplateUUID(nsiId)
- roStatus.setOperType(operType)
- roStatus.setProgress(progress)
- roStatus.setStatus(status)
- roStatus.setStatusDescription(statusDescription)
requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
index 4eb70a5302..0b028e6c13 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
@@ -34,6 +34,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import static org.apache.commons.lang3.StringUtils.isBlank
+
class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
private static final Logger logger = LoggerFactory.getLogger(DoCreateTnNssiInstance.class);
@@ -109,15 +111,18 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance()
ss.setServiceInstanceId(ssInstanceId)
String sliceInstanceName = execution.getVariable("sliceServiceInstanceName")
+ if (isBlank(sliceInstanceName)) {
+ logger.error("ERROR: createServiceInstance: sliceInstanceName is null")
+ sliceInstanceName = ssInstanceId
+ }
ss.setServiceInstanceName(sliceInstanceName)
ss.setServiceType(serviceType)
- String serviceStatus = "activated"
+ String serviceStatus = "deactivated"
ss.setOrchestrationStatus(serviceStatus)
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelUuid = execution.getVariable("modelUuid")
- //TODO: need valid model ID from the caller, as AAI does not accept invalid IDs
- //ss.setModelInvariantId(modelInvariantUuid)
- //ss.setModelVersionId(modelUuid)
+ ss.setModelInvariantId(modelInvariantUuid)
+ ss.setModelVersionId(modelUuid)
String serviceInstanceLocationid = tnNssmfUtils.getFirstPlmnIdFromSliceProfile(sliceProfileStr)
ss.setServiceInstanceLocationId(serviceInstanceLocationid)
String snssai = tnNssmfUtils.getFirstSnssaiFromSliceProfile(sliceProfileStr)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
index c817eaad61..a8622b9253 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy
@@ -25,7 +25,6 @@ import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.aai.domain.yang.ServiceInstance
-import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
@@ -150,18 +149,15 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor {
String status,
String progress,
String statusDescription) {
- String serviceId = execution.getVariable("sliceServiceInstanceId")
+ String ssInstanceId = execution.getVariable("sliceServiceInstanceId")
+ String modelUuid = execution.getVariable("modelUuid")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- ResourceOperationStatus roStatus = new ResourceOperationStatus()
- roStatus.setServiceId(serviceId)
- roStatus.setOperationId(jobId)
- roStatus.setResourceTemplateUUID(nsiId)
- roStatus.setOperType("Deallocate")
- roStatus.setProgress(progress)
- roStatus.setStatus(status)
- roStatus.setStatusDescription(statusDescription)
+ ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId,
+ jobId, nsiId, "deallocate", status, progress, statusDescription)
+
+ logger.debug("DoDeallocateTnNssi: roStatus={}", roStatus)
requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
index 88db2161f7..deeec94b74 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy
@@ -72,7 +72,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor {
String additionalPropJsonStr = execution.getVariable("sliceParams")
- String tnNssiId = execution.getVariable("serviceInstanceID")
+ String tnNssiId = jsonUtil.getJsonValue(additionalPropJsonStr, "serviceInstanceID") //for debug
if (isBlank(tnNssiId)) {
tnNssiId = UUID.randomUUID().toString()
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
index d97f416db9..cfee1aa0cf 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
@@ -32,6 +32,7 @@ import org.onap.so.bpmn.core.RollbackData
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.db.request.beans.ResourceOperationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -122,7 +123,7 @@ class TnNssmfUtils {
}
String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
+ """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1">
<sdncadapter:RequestHeader>
@@ -332,4 +333,25 @@ class TnNssmfUtils {
createRelationShipInAAI(execution, aaiResourceUri, relationship)
}
+
+ ResourceOperationStatus buildRoStatus(String nsstId,
+ String nssiId,
+ String jobId,
+ String nsiId,
+ String action,
+ String status,
+ String progress,
+ String statusDescription) {
+ ResourceOperationStatus roStatus = new ResourceOperationStatus()
+ roStatus.setResourceTemplateUUID(nsstId)
+ roStatus.setResourceInstanceID(nssiId)
+ roStatus.setServiceId(nsiId)
+ roStatus.setOperationId(jobId)
+ roStatus.setOperType(action)
+ roStatus.setProgress(progress)
+ roStatus.setStatus(status)
+ roStatus.setStatusDescription(statusDescription)
+
+ return roStatus
+ }
}