aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy60
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn9
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java4
4 files changed, 29 insertions, 45 deletions
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
index 8e5793d559..491da0aab4 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/external/ExternalAnNssmfManager.java
@@ -117,6 +117,7 @@ public class ExternalAnNssmfManager extends ExternalNssmfManager {
ResponseDescriptor responseDescriptor = new ResponseDescriptor();
responseDescriptor.setStatus(JobStatus.FINISHED.toString());
responseDescriptor.setProgress(100);
+ responseDescriptor.setStatusDescription("Finished");
JobStatusResponse jobStatusResponse = new JobStatusResponse();
jobStatusResponse.setResponseDescriptor(responseDescriptor);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
index 9d6c4a1b2a..75ef7d347c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy
@@ -19,8 +19,8 @@
*/
package org.onap.so.bpmn.infrastructure.scripts
+import com.fasterxml.jackson.databind.ObjectMapper
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.json.JSONObject
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
@@ -47,6 +47,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
private ExceptionUtil exceptionUtil = new ExceptionUtil()
private JsonUtils jsonUtil = new JsonUtils()
+ ObjectMapper objectMapper = new ObjectMapper()
private RequestDBUtil requestDBUtil = new RequestDBUtil()
private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
@@ -133,10 +134,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
String nssiId = currentNSSI['nssiServiceInstanceId']
String nsiId = currentNSSI['nsiServiceInstanceId']
String scriptName = execution.getVariable("scriptName")
- boolean modifyAction = execution.getVariable("terminateNSI")
String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
+ String serviceUuid = currentNSSI['modelId']
String globalSubscriberId = currentNSSI['globalSubscriberId']
String subscriptionServiceType = execution.getVariable("serviceType")
@@ -146,37 +146,37 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
deAllocateNssi.setTerminateNssiOption(0)
deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
deAllocateNssi.setScriptName(scriptName)
- deAllocateNssi.setSliceProfileId(profileId)
- deAllocateNssi.setModifyAction(modifyAction)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
serviceInfo.setServiceUuid(serviceUuid)
+ serviceInfo.setNsiId(nsiId)
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ String serviceInfoString = objectMapper.writeValueAsString(serviceInfo)
EsrInfo esrInfo = getEsrInfo(currentNSSI)
+ String esrInfoString = objectMapper.writeValueAsString(esrInfo)
execution.setVariable("deAllocateNssi",deAllocateNssi)
- execution.setVariable("esrInfo",esrInfo)
- execution.setVariable("serviceInfo",serviceInfo)
+ execution.setVariable("esrInfo", esrInfoString)
+ execution.setVariable("serviceInfo", serviceInfoString)
String nssmfRequest = """
{
- "deAllocateNssi": "${execution.getVariable("deAllocateNssi") as JSONObject}",
- "esrInfo": ${execution.getVariable("esrInfo") as JSONObject},
- "serviceInfo": ${execution.getVariable("serviceInfo") as JSONObject}
+ "deAllocateNssi": ${objectMapper.writeValueAsString(deAllocateNssi)},
+ "esrInfo": ${esrInfoString},
+ "serviceInfo": ${serviceInfoString}
}
"""
- String urlStr = String.format("/api/rest/provMns/v1/NSS/nssi/%s",nssiId)
+ String urlStr = String.format("/api/rest/provMns/v1/NSS/SliceProfiles/%s", profileId)
NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlStr, nssmfRequest, NssiResponse.class)
if (nssmfResponse != null) {
currentNSSI['jobId']= nssmfResponse.getJobId() ?: ""
currentNSSI['jobProgress'] = 0
execution.setVariable("currentNSSI", currentNSSI)
- }
- else {
+ } else {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.")
}
LOGGER.debug("*****${PREFIX} Exit sendRequestToNSSMF *****")
@@ -190,32 +190,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
{
def currentNSSI = execution.getVariable("currentNSSI")
String jobId = currentNSSI['jobId']
- String nssiId = currentNSSI['nssiServiceInstanceId']
- String nsiId = currentNSSI['nsiServiceInstanceId']
- String serviceInvariantUuid = currentNSSI['modelInvariantId']
- String serviceUuid = currentNSSI['modelVersionId']
- String globalSubscriberId = currentNSSI['globalSubscriberId']
- String subscriptionServiceType = execution.getVariable("serviceType")
- String sST = currentNSSI['sST']
- String PLMNIdList = currentNSSI['PLMNIdList']
- String nssiName = currentNSSI['nssiName']
-
+
execution.setVariable("responseId", "3")
- execution.setVariable("esrInfo", getEsrInfo(currentNSSI))
execution.setVariable("jobId", jobId)
-
- Map<String, ?> serviceInfoMap = new HashMap<>()
- serviceInfoMap.put("nssiId", nssiId)
- serviceInfoMap.put("nsiId", nsiId)
- serviceInfoMap.put("nssiName", nssiName)
- serviceInfoMap.put("sST", sST)
- serviceInfoMap.put("PLMNIdList", PLMNIdList)
- serviceInfoMap.put("globalSubscriberId", globalSubscriberId)
- serviceInfoMap.put("subscriptionServiceType", subscriptionServiceType)
- serviceInfoMap.put("serviceInvariantUuid", serviceInvariantUuid)
- serviceInfoMap.put("serviceUuid", serviceUuid)
-
- execution.setVariable("serviceInfo", serviceInfoMap)
}
@@ -238,8 +215,9 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
LOGGER.error("job progress is null or empty!")
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Job progress from NSSMF.")
}
+ def currentNSSI = execution.getVariable("currentNSSI")
int oldProgress = currentNSSI['jobProgress']
- int currentProgress = progress
+ int currentProgress = Integer.parseInt(progress)
execution.setVariable("isNSSIDeAllocated", (currentProgress == 100))
execution.setVariable("isNeedUpdateDB", (oldProgress != currentProgress))
@@ -247,6 +225,8 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
currentNSSI['status'] = status
currentNSSI['statusDescription'] = statusDescription
+ String nssiId = currentNSSI['nssiServiceInstanceId']
+ String nsiId = currentNSSI['nsiServiceInstanceId']
LOGGER.debug("job status result: nsiId = ${nsiId}, nssiId=${nssiId}, oldProgress=${oldProgress}, progress = ${currentProgress}" )
}
else {
@@ -256,7 +236,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
}
catch (any)
{
- String msg = "Received a Bad Response from NSSMF." cause-"+any.getCause()"
+ String msg = "Received a Bad Response from NSSMF. cause-"+any.getCause()
LOGGER.error(any.printStackTrace())
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -309,7 +289,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
String nssiServiceInstanceId = currentNSSI['nssiServiceInstanceId']
String profileId = currentNSSI['profileId']
String globalSubscriberId = currentNSSI["globalSubscriberId"]
- String serviceType = currentNSSI["serviceType"]
+ String serviceType = execution.getVariable("serviceType")
try
{
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
index c107cfb53a..a745f7c50d 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateNSSI.bpmn
@@ -99,10 +99,11 @@ dnssi.prepareUpdateOperationStatus(execution)</bpmn:script>
<bpmn:callActivity id="Task_1x3et9h" name="Query Job Status" calledElement="QueryJobStatus">
<bpmn:extensionElements>
<camunda:in source="msoRequestId" target="msoRequestId" />
- <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
- <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
- <camunda:out source="serviceDecomposition" target="serviceDecomposition" />
- <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" />
+ <camunda:in source="esrInfo" target="esrInfo" />
+ <camunda:in source="serviceInfo" target="serviceInfo" />
+ <camunda:in source="jobId" target="jobId" />
+ <camunda:in source="responseId" target="responseId" />
+ <camunda:out source="responseDescriptor" target="responseDescriptor" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0w01l14</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_10nogqz</bpmn:outgoing>
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
index 399d51e894..10aaf26413 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/DeAllocateNssi.java
@@ -21,12 +21,14 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class DeAllocateNssi {
+public class DeAllocateNssi implements Serializable {
@Deprecated
public final static String URL = "/api/rest/provMns/v1/NSS" + "/SliceProfiles/%s";
+ private static final long serialVersionUID = 8198187346132154044L;
private String nsiId;