summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy27
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeAllocateSliceSubnet.groovy12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy56
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy182
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy10
6 files changed, 174 insertions, 119 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
index 5d952b6b8d..2c1fa64609 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
@@ -394,11 +394,13 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+ serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
}else if(domainType.equals("TN_MH")) {
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+ serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
}
}
JsonParser parser = new JsonParser()
@@ -425,24 +427,25 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
deAllocateNssi.addProperty("terminateNssiOption", 0)
deAllocateNssi.addProperty("scriptName", "TN1")
- if(domainType.equals("TN_FH")) {
- deAllocateNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
- deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
- }else if(domainType.equals("TN_MH")) {
- deAllocateNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
- deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
- }
JsonObject esrInfo = new JsonObject()
- esrInfo.addProperty("networkType", "tn")
- esrInfo.addProperty("vendor", "ONAP_internal")
+ esrInfo.addProperty("networkType", "tn")
+ esrInfo.addProperty("vendor", "ONAP_internal")
JsonObject serviceInfo = new JsonObject()
- serviceInfo.addProperty("serviceInvariantUuid", null)
- serviceInfo.addProperty("serviceUuid", null)
serviceInfo.addProperty("globalSubscriberId", globalSubscriberId)
serviceInfo.addProperty("subscriptionServiceType", subscriptionServiceType)
-
+
+ if(domainType.equals("TN_FH")) {
+ deAllocateNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+ serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+ deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+ }else if(domainType.equals("TN_MH")) {
+ deAllocateNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+ serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
+ deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+ }
+
JsonObject json = new JsonObject()
json.add("deAllocateNssi", deAllocateNssi)
json.add("esrInfo", esrInfo)
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 65885f3516..7c2f53fbe4 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
@@ -36,6 +36,8 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
RequestDBUtil requestDBUtil = new RequestDBUtil()
+ AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
+
private static final Logger logger = LoggerFactory.getLogger(DeAllocateSliceSubnet.class)
@Override
@@ -128,15 +130,16 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
def prepareInitOperationStatus = { DelegateExecution execution ->
logger.debug(Prefix + "prepareInitOperationStatus Start")
- String serviceId = execution.getVariable("serviceInstanceID")
+ String nssiId = execution.getVariable("serviceInstanceID")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+ String modelUuid = anNssmfUtils.getModelUuid(execution, nssiId)
+ logger.debug("Generated new job for Service Instance serviceId:" + nsiId + " jobId:" + jobId)
ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
+ initStatus.setServiceId(nsiId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setResourceTemplateUUID(modelUuid)
initStatus.setOperType("Deallocate")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
@@ -167,3 +170,4 @@ class DeAllocateSliceSubnet extends AbstractServiceTaskProcessor {
}
}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy
index 10a559475f..0d2e6c1d5e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy
@@ -138,11 +138,8 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
String serviceInstanceId = execution.getVariable("nsiId")
String anNssiId = execution.getVariable("anNssiId")
- String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNssiId, ROLE_NSSI,messageType,serviceInstanceId)
- OofRequest oofPayload = new OofRequest()
- oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
- oofPayload.setRequestDetails(oofRequest)
- execution.setVariable("oofAnNssiPayload", oofPayload)
+ String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNssiId, "NSSI",messageType,serviceInstanceId)
+ execution.setVariable("oofAnNssiPayload", oofRequest)
logger.debug("Finish prepareOOFTerminationRequest")
}
@@ -165,11 +162,8 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String anNfNssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"),AN_NF)
execution.setVariable("anNfNssiId", anNfNssiId)
- String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNfNssiId, ROLE_NSSI,messageType,serviceInstanceId)
- OofRequest oofPayload = new OofRequest()
- oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
- oofPayload.setRequestDetails(oofRequest)
- execution.setVariable("oofAnNfNssiPayload", oofPayload)
+ String oofRequest = oofUtils.buildTerminateNxiRequest(requestId,anNfNssiId, "NSSI",messageType,serviceInstanceId)
+ execution.setVariable("oofAnNfNssiPayload", oofRequest)
logger.debug("Finish prepareOOFAnNfNssiTerminationRequest")
}
@@ -198,26 +192,26 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject Payload = new JsonObject()
Payload.addProperty("version", "1.0")
- Payload.addProperty("rpc-name", "TerminateRANSlice")
+ Payload.addProperty("rpc-name", "terminateRANSliceInstance")
Payload.addProperty("correlation-id", reqId)
Payload.addProperty("type", "request")
JsonObject wrapinput = new JsonObject()
- wrapinput.addProperty("Action", "deallocate")
+ wrapinput.addProperty("action", "deallocate")
JsonObject CommonHeader = new JsonObject()
- CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
- CommonHeader.addProperty("APIver", "1.0")
- CommonHeader.addProperty("RequestID", reqId)
- CommonHeader.addProperty("SubRequestID", "1")
+ CommonHeader.addProperty("time-stamp", new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
+ CommonHeader.addProperty("api-ver", "1.0")
+ CommonHeader.addProperty("request-id", reqId)
+ CommonHeader.addProperty("sub-request-id", "1")
JsonObject body = new JsonObject()
body.add("input", wrapinput)
JsonObject sdnrRequest = new JsonObject()
Payload.add("input", input)
- wrapinput.add("Payload", Payload)
- wrapinput.add("CommonHeader", CommonHeader)
+ wrapinput.add("payload", Payload)
+ wrapinput.add("common-header", CommonHeader)
body.add("input", wrapinput)
sdnrRequest.add("body", body)
@@ -247,17 +241,21 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
* @param oofRequest - Request payload to be sent to adapter
* @return
*/
- boolean callOofAdapter(DelegateExecution execution, OofRequest oofRequest) {
+ boolean callOofAdapter(DelegateExecution execution, Object oofRequest) {
logger.debug("Start callOofAdapter")
String requestId = execution.getVariable("msoRequestId")
String oofAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution)
URL requestUrl = new URL(oofAdapterEndpoint)
- logger.debug("Calling OOF adapter : ${requestUrl} with payload : ${oofRequest}")
+ OofRequest oofPayload = new OofRequest()
+ oofPayload.setApiPath("/api/oof/terminate/nxi/v1")
+ oofPayload.setRequestDetails(oofRequest)
+ String requestJson = objectMapper.writeValueAsString(oofPayload)
+ logger.debug("Calling OOF adapter : ${requestUrl} with payload : ${requestJson}")
HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.EXTERNAL)
- Response httpResponse = httpClient.post(oofRequest)
+ Response httpResponse = httpClient.post(requestJson)
int responseCode = httpResponse.getStatus()
logger.debug("OOF sync response code is: " + responseCode)
- if(responseCode != 200){
+ if(responseCode < 200 || responseCode >= 300){
logger.debug("OOF request failed with reason : " + httpResponse)
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
}else {
@@ -316,9 +314,9 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
Map<String,Object> sliceParams = objectMapper.readValue(execution.getVariable("sliceParams"), Map.class)
sliceParams.put("modifyAction", "deallocate")
- execution.setVariable("modificationsliceParams", sliceParams)
+ execution.setVariable("modificationsliceParams", objectMapper.writeValueAsString(sliceParams))
- String serviceId = execution.getVariable("serviceInstanceId")
+ String serviceId = execution.getVariable("serviceInstanceID")
String nsiId = execution.getVariable("nsiId")
logger.debug("Generated new job for Service Instance serviceId:" + serviceId + " operationId:" + modificationJobId)
@@ -378,15 +376,15 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
void terminateTNFHNssi(DelegateExecution execution) {
logger.debug("Start terminateTNFHNssi in ${Prefix}")
String nssmfRequest = buildDeallocateNssiRequest(execution, TN_FH)
- String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_FH)
+ String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), TN_FH)
execution.setVariable("tnFHNSSIId", nssiId)
- String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+ String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles/" + nssiId
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -401,9 +399,9 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
void terminateTNMHNssi(DelegateExecution execution) {
logger.debug("Start terminateTNMHNssi in ${Prefix}")
String nssmfRequest = buildDeallocateNssiRequest(execution, TN_MH)
- String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_MH)
+ String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), TN_MH)
execution.setVariable("tnMHNSSIId", nssiId)
- String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+ String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles/" + nssiId
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
index 982771f681..8695946fd6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
@@ -42,10 +42,14 @@ import org.onap.so.beans.nsmf.EsrInfo
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.ServiceProxy
-
+import com.google.gson.JsonParser
import org.onap.aai.domain.yang.Relationship
import org.onap.aai.domain.yang.ServiceInstance
import org.onap.aai.domain.yang.SliceProfile
+import org.onap.aai.domain.yang.SliceProfiles
+import org.onap.aaiclient.client.aai.entities.uri.AAISimplePluralUri
+import com.fasterxml.jackson.annotation.JsonInclude
+import com.fasterxml.jackson.databind.SerializationFeature
import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
@@ -113,6 +117,11 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid modify Action : "+modifyAction)
}
}
+ String modelUuid = execution.getVariable("modelUuid")
+ if (isBlank(modelUuid)) {
+ modelUuid = anNssmfUtils.getModelUuid(execution, execution.getVariable("serviceInstanceID"))
+ }
+ execution.setVariable("modelUuid",modelUuid)
List<String> snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "snssaiList"))
String sliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
if (isBlank(sliceProfileId) || (snssaiList.empty)) {
@@ -143,9 +152,29 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug(Prefix + "getSliceProfiles Start")
String instanceId = execution.getVariable("sliceProfileId")
ServiceInstance sliceProfileInstance = getServiceInstance(execution, instanceId)
- SliceProfile ranSliceProfile = sliceProfileInstance.getSliceProfiles().getSliceProfile().get(0)
- logger.debug("RAN slice profile : "+ranSliceProfile.toString())
- execution.setVariable("RANSliceProfile", ranSliceProfile)
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ SliceProfile ranSliceProfile = new SliceProfile()
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAISimplePluralUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(instanceId)
+ .sliceProfiles())
+
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Slice Profiles of service Instance was not found in aai : ${instanceId}")
+ }
+
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<SliceProfiles> si = wrapper.asBean(SliceProfiles.class)
+ if(si.isPresent()) {
+ ranSliceProfile = si.get().getSliceProfile().get(0)
+ }
+ objectMapper.enable(SerializationFeature.INDENT_OUTPUT);
+ objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL)
+ logger.debug("RAN slice profile : "+objectMapper.writeValueAsString(ranSliceProfile))
+ execution.setVariable("RANSliceProfile", objectMapper.writeValueAsString(ranSliceProfile))
execution.setVariable("ranSliceProfileInstance", sliceProfileInstance)
}
@@ -194,15 +223,18 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSSI option OOF Url: " + urlString)
-
+ JsonParser parser = new JsonParser()
//build oof request body
boolean ranNssiPreferReuse = execution.getVariable("ranNssiPreferReuse");
String requestId = execution.getVariable("msoRequestId")
String messageType = "NSISelectionResponse"
Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("RANSliceProfile"), Map.class)
- ServiceInstance ranSliceProfileInstance = objectMapper.readValue(execution.getVariable("ranSliceProfileInstance"), ServiceInstance.class)
- String modelUuid = ranSliceProfileInstance.getModelVersionId()
- String modelInvariantUuid = ranSliceProfileInstance.getModelInvariantId()
+ ServiceInstance ranSliceProfileInstance = execution.getVariable("ranSliceProfileInstance")
+ profileInfo.put("sST",ranSliceProfileInstance.getServiceType())
+ profileInfo.put("snssaiList",ranSliceProfileInstance.getEnvironmentContext())
+ profileInfo.put("plmnIdList",ranSliceProfileInstance.getServiceInstanceLocationId())
+ String modelUuid = ranSliceProfileInstance.getModelVersionId()
+ String modelInvariantUuid = ranSliceProfileInstance.getModelInvariantId()
String modelName = execution.getVariable("servicename")
String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
List<String> nsstInfoList = new ArrayList<>()
@@ -213,12 +245,12 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject FH = new JsonObject()
JsonObject MH = new JsonObject()
JsonObject ANNF = new JsonObject()
- FH.addProperty("domainType", "TN_FH")
- FH.addProperty("capabilityDetails", FHCapabilities)
+ FH.addProperty("domainType", "TN_FH")
+ FH.add("capabilityDetails", (JsonObject) parser.parse(FHCapabilities))
MH.addProperty("domainType", "TN_MH")
- MH.addProperty("capabilityDetails", MHCapabilities)
+ MH.add("capabilityDetails", (JsonObject) parser.parse(MHCapabilities))
ANNF.addProperty("domainType", "AN_NF")
- ANNF.addProperty("capabilityDetails", FHCapabilities)
+ ANNF.add("capabilityDetails", (JsonObject) parser.parse(ANNFCapabilities))
capabilitiesList.add(FH)
capabilitiesList.add(MH)
capabilitiesList.add(ANNF)
@@ -242,12 +274,18 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
String oofResponse = execution.getVariable("nssiSelection_asyncCallbackResponse")
String requestStatus = jsonUtil.getJsonValue(oofResponse, "requestStatus")
if(requestStatus.equals("completed")) {
- List<String> solution = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(oofResponse, "solutions"))
- boolean existingNSI = jsonUtil.getJsonValue(solution.get(0), "existingNSI")
+ String solutions = jsonUtil.getJsonValue(oofResponse, "solutions")
+ logger.debug("solutions value : "+solutions)
+ JsonParser parser = new JsonParser()
+ JsonArray solution = parser.parse(solutions)
+ boolean existingNSI = solution.get(0).get("existingNSI").getAsBoolean()
+ logger.debug("existingNSI value : "+existingNSI)
if(!existingNSI) {
- def sliceProfiles = jsonUtil.getJsonValue(solution.get(0), "newNSISolution.sliceProfiles")
- execution.setVariable("RanConstituentSliceProfiles", sliceProfiles)
- List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(sliceProfiles)
+ JsonObject newNSISolution = solution.get(0).get("newNSISolution").getAsJsonObject()
+ JsonArray sliceProfiles = newNSISolution.get("sliceProfiles")
+ logger.debug("sliceProfiles: "+ sliceProfiles.toString())
+ execution.setVariable("RanConstituentSliceProfiles", sliceProfiles.toString())
+ List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(sliceProfiles.toString())
anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution)
logger.debug("RanConstituentSliceProfiles list from OOF "+sliceProfiles)
}else {
@@ -273,14 +311,20 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
case "AN-NF":
execution.setVariable("ANNF_NSSI", val.getServiceInstanceId())
execution.setVariable("ANNF_nssiName", val.getServiceInstanceName())
+ execution.setVariable("ANNF_modelInvariantUuid", val.getModelInvariantId())
+ execution.setVariable("ANNF_modelUuid", val.getModelVersionId())
break
case "TN-FH":
execution.setVariable("TNFH_NSSI", val.getServiceInstanceId())
execution.setVariable("TNFH_nssiName", val.getServiceInstanceName())
- break
+ execution.setVariable("TNFH_modelInvariantUuid", val.getModelInvariantId())
+ execution.setVariable("TNFH_modelUuid", val.getModelVersionId())
+ break
case "TN-MH":
- execution.setVariable("TNMH_NSSI", val.getServiceInstanceId())
+ execution.setVariable("TNMH_NSSI", val.getServiceInstanceId())
execution.setVariable("TNMH_nssiName", val.getServiceInstanceName())
+ execution.setVariable("TNMH_modelInvariantUuid", val.getModelInvariantId())
+ execution.setVariable("TNMH_modelUuid", val.getModelVersionId())
break
default:
logger.error("No expected match found for current domainType "+ key)
@@ -395,11 +439,10 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
}
private void createTnAllocateNssiJobQuery(DelegateExecution execution, String domainType) {
- EsrInfo esrInfo = new EsrInfo()
- esrInfo.setNetworkType("TN")
- esrInfo.setVendor("ONAP")
- String esrInfoString = objectMapper.writeValueAsString(esrInfo)
- execution.setVariable("esrInfo", esrInfoString)
+ JsonObject esrInfo = new JsonObject()
+ esrInfo.addProperty("networkType", "tn")
+ esrInfo.addProperty("vendor", "ONAP_internal")
+ execution.setVariable("esrInfo", esrInfo.toString())
JsonObject serviceInfo = new JsonObject()
serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
@@ -408,50 +451,52 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
- serviceInfo.addProperty("serviceInvariantUuid", null)
- serviceInfo.addProperty("serviceUuid", null)
if(domainType.equals("TN_FH")) {
serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
+ serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
+ serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
}else if(domainType.equals("TN_MH")) {
serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
+ serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
+ serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
}
execution.setVariable("serviceInfo", serviceInfo.toString())
execution.setVariable("responseId", "")
}
- def processFhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
- logger.debug(Prefix+"processJobStatusRsp method start")
- String jobResponse = execution.getVariable("TNFH_jobResponse")
- logger.debug("Job status response "+jobResponse)
- String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
- String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
- if(status.equalsIgnoreCase("finished")) {
- logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
- }
- else {
- String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
- logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
- }
- }
-
- def processMhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
- logger.debug(Prefix+"processJobStatusRsp method start")
- String jobResponse = execution.getVariable("TNMH_jobResponse")
- logger.debug("Job status response "+jobResponse)
- String status = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.status")
- String nssi = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.nssi")
- if(status.equalsIgnoreCase("finished")) {
- logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
- }
- else {
- String statusDescription = jsonUtil.getJsonValue(jobResponse, "responseDescriptor.statusDescription")
- logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
- }
- }
+ def processFhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+ logger.debug(Prefix+"processJobStatusRsp method start")
+ String jobResponse = execution.getVariable("TNFH_jobResponse")
+ logger.debug("Job status response "+jobResponse)
+ String status = jsonUtil.getJsonValue(jobResponse, "status")
+ String nssi = jsonUtil.getJsonValue(jobResponse, "nssi")
+ if(status.equalsIgnoreCase("finished")) {
+ logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+ }
+ else {
+ String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription")
+ logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+ }
+ }
+
+ def processMhAllocateNssiJobStatusRsp = { DelegateExecution execution ->
+ logger.debug(Prefix+"processJobStatusRsp method start")
+ String jobResponse = execution.getVariable("TNMH_jobResponse")
+ logger.debug("Job status response "+jobResponse)
+ String status = jsonUtil.getJsonValue(jobResponse, "status")
+ String nssi = jsonUtil.getJsonValue(jobResponse, "nssi")
+ if(status.equalsIgnoreCase("finished")) {
+ logger.debug("Job successfully completed ... proceeding with flow for nssi : "+nssi)
+ }
+ else {
+ String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription")
+ logger.error("received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000,"received failed status from job status query for nssi : "+nssi+" with status description : "+ statusDescription)
+ }
+ }
def getSliceProfilesFromAai = { DelegateExecution execution ->
logger.debug(Prefix+"getSliceProfilesFromAai method start")
@@ -482,7 +527,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_FH")
String nssiId = execution.getVariable("TNFH_NSSI")
execution.setVariable("tnFHNSSIId", nssiId)
- String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+ String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles/" + nssiId
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -498,7 +543,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_FH")
String nssiId = execution.getVariable("TNFH_NSSI")
execution.setVariable("tnFHNSSIId", nssiId)
- String urlString = "/api/rest/provMns/v1/NSS/nssi/" + nssiId
+ String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles/" + nssiId
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -537,16 +582,16 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
def prepareOperationStatusUpdate = { DelegateExecution execution ->
logger.debug(Prefix + "prepareOperationStatusUpdate Start")
- String serviceId = execution.getVariable("serviceInstanceID")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
String nssiId = execution.getVariable("serviceInstanceID")
- logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+ String modelUuid = execution.getVariable("modelUuid")
+ logger.debug("Service Instance serviceId:" + nsiId + " jobId:" + jobId)
ResourceOperationStatus updateStatus = new ResourceOperationStatus()
- updateStatus.setServiceId(serviceId)
+ updateStatus.setServiceId(nsiId)
updateStatus.setOperationId(jobId)
- updateStatus.setResourceTemplateUUID(nsiId)
+ updateStatus.setResourceTemplateUUID(modelUuid)
updateStatus.setResourceInstanceID(nssiId)
updateStatus.setOperType("Modify")
updateStatus.setProgress("100")
@@ -558,17 +603,16 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
def prepareFailedOperationStatusUpdate = { DelegateExecution execution ->
logger.debug(Prefix + "prepareFailedOperationStatusUpdate Start")
-
- String serviceId = execution.getVariable("serviceInstanceID")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
String nssiId = execution.getVariable("serviceInstanceID")
- logger.debug("Service Instance serviceId:" + serviceId + " jobId:" + jobId)
+ String modelUuid = execution.getVariable("modelUuid")
+ logger.debug("Service Instance serviceId:" + nsiId + " jobId:" + jobId)
ResourceOperationStatus updateStatus = new ResourceOperationStatus()
- updateStatus.setServiceId(serviceId)
+ updateStatus.setServiceId(nsiId)
updateStatus.setOperationId(jobId)
- updateStatus.setResourceTemplateUUID(nsiId)
+ updateStatus.setResourceTemplateUUID(modelUuid)
updateStatus.setResourceInstanceID(nssiId)
updateStatus.setOperType("Modify")
updateStatus.setProgress("0")
@@ -639,7 +683,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
if(si.isPresent()) {
- serviceInstance = si
+ serviceInstance = si.get()
}
return serviceInstance
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
index e0df9ea64b..bb8e516c3b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
@@ -75,6 +75,10 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
String sliceProfile = execution.getVariable("additionalProperties")
execution.setVariable("sliceProfile", sliceProfile)
break
+ case "deallocate":
+ String sliceProfile = execution.getVariable("additionalProperties")
+ execution.setVariable("sliceProfile", sliceProfile)
+ break
case "reconfigure":
String resourceConfig = execution.getVariable("additionalProperties")
execution.setVariable("resourceConfig", resourceConfig)
@@ -110,7 +114,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
logger.debug(Prefix+"createSdnrRequest method start")
String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
String modifyAction = execution.getVariable("modifyAction")
- String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "instantiateRANSlice", callbackUrl)
+ String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl)
execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
execution.setVariable("createNSSI_timeout", "PT10M")
execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
index 0465a433eb..7e505d1912 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ModifySliceSubnet.groovy
@@ -36,6 +36,7 @@ class ModifySliceSubnet extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
RequestDBUtil requestDBUtil = new RequestDBUtil()
+ AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
private static final Logger logger = LoggerFactory.getLogger(ModifySliceSubnet.class)
@@ -132,15 +133,16 @@ class ModifySliceSubnet extends AbstractServiceTaskProcessor {
def prepareInitOperationStatus = { DelegateExecution execution ->
logger.debug(Prefix + "prepareInitOperationStatus Start")
- String serviceId = execution.getVariable("serviceInstanceID")
+ String nssiId = execution.getVariable("serviceInstanceID")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- logger.debug("Generated new job for Service Instance serviceId:" + serviceId + "jobId:" + jobId)
+ String modelUuid = anNssmfUtils.getModelUuid(execution, nssiId)
+ logger.debug("Generated new job for Service Instance serviceId:" + nsiId + "jobId:" + jobId)
ResourceOperationStatus initStatus = new ResourceOperationStatus()
- initStatus.setServiceId(serviceId)
+ initStatus.setServiceId(nsiId)
initStatus.setOperationId(jobId)
- initStatus.setResourceTemplateUUID(nsiId)
+ initStatus.setResourceTemplateUUID(modelUuid)
initStatus.setOperType("Modify")
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)