summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordeepikasatheesh <deepika.s84@wipro.com>2021-09-01 19:12:27 +0000
committerdeepikasatheesh <deepika.s84@wipro.com>2021-09-01 19:12:27 +0000
commit8186b41544ec5aff18b619e1fb183916fad1cc2d (patch)
treea678e5005e18866d061b5a2115d73ccdc084beef
parent808be6bca9c86c4857b0f3cb08675cbbdb1aaaaf (diff)
Fix issues in NSMF terminate flow
Issue-ID: SO-3759 Signed-off-by: deepikasatheesh <deepika.s84@wipro.com> Change-Id: Ic27f53b8b8e739849f6eb5ab4a1cee1d2cc0969c
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateNSSI.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy18
3 files changed, 17 insertions, 7 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
index 7c2f53fbe4..0cb72ab9b4 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy
@@ -139,7 +139,8 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
ResourceOperationStatus initStatus = new ResourceOperationStatus()
initStatus.setServiceId(nsiId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(modelUuid)
+ //initStatus.setResourceTemplateUUID(modelUuid)
+ initStatus.setResourceInstanceID(nssiId)
initStatus.setOperType("Deallocate")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
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 147e623ece..554f7a6392 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
@@ -129,7 +129,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
if(serviceCategory ==~ /CN.*/){
return SubnetType.CN.getNetworkType()
}
- if (serviceCategory ==~ /AN.*NF.*/){
+ if (serviceCategory ==~ /AN.*/){
return SubnetType.AN.getNetworkType()
}
if (serviceCategory ==~ /TN.*BH.*/){
@@ -166,6 +166,7 @@ class DoDeallocateNSSI extends AbstractServiceTaskProcessor
deAllocateNssi.setTerminateNssiOption(0)
deAllocateNssi.setSnssaiList(Arrays.asList(snssai))
deAllocateNssi.setScriptName(scriptName)
+ deAllocateNssi.setSliceProfileId(profileId)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(serviceInvariantUuid)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy
index 5fd06fd8d4..7dc63b61ed 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteSliceService.groovy
@@ -31,6 +31,7 @@ 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
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types
+import org.onap.so.client.oof.adapter.beans.payload.OofRequest
import org.onap.logging.filter.base.ONAPComponents
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -40,6 +41,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import com.fasterxml.jackson.databind.ObjectMapper
import javax.ws.rs.NotFoundException
import javax.ws.rs.core.Response
@@ -404,11 +406,12 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
{
LOGGER.debug("Start terminateNSIQuery")
- return
+ //return
//To test
String requestId = execution.getVariable("msoRequestId")
- String nxlId = currentNSSI['nsiServiceInstanceId']
+ String nxlId = execution.getVariable("nsiId")
+ //String nxlId = currentNSSI['nsiServiceInstanceId']
String nxlType = "NSI"
String messageType = "nsiTerminationResponse"
String serviceInstanceId = execution.getVariable("serviceInstanceId")
@@ -433,12 +436,17 @@ class DoDeleteSliceService extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
"value null")
}
-
- URL requestUrl = new URL(oofUrl + "/api/oof/terminate/nxi/v1")
+ String oofUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution)
+ URL requestUrl = new URL(oofUrl)
String oofRequest = oofUtils.buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, serviceInstanceId)
+ OofRequest oofPayload = new OofRequest()
+ oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
+ oofPayload.setRequestDetails(oofRequest)
+ ObjectMapper objectMapper = new ObjectMapper()
+ String requestJson = objectMapper.writeValueAsString(oofPayload)
HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.OOF)
httpClient.addAdditionalHeader("Authorization", authHeader)
- Response httpResponse = httpClient.post(oofRequest)
+ Response httpResponse = httpClient.post(requestJson)
int responseCode = httpResponse.getStatus()
LOGGER.debug("OOF sync response code is: " + responseCode)