summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2021-02-26 11:33:53 +0000
committerGerrit Code Review <gerrit@onap.org>2021-02-26 11:33:53 +0000
commit958662ecba2ed20b7dda8b56ccd1a35b3eec92f8 (patch)
tree284353085e4e0054868097d8facb84c350a6c74e /bpmn/so-bpmn-infrastructure-common/src/main/groovy/org
parent152968b95fe825c237cef6f06e50bdefc7802385 (diff)
parent47bf9e3ce3fffd831b041b41f643ec8546e9dfb2 (diff)
Merge "Fix issues in AN NSSMF for activate flow"
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy/org')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy13
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy18
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy63
3 files changed, 61 insertions, 33 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
index eabe58488e..7e30d79152 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceSubnet.groovy
@@ -35,6 +35,7 @@ class ActivateSliceSubnet extends AbstractServiceTaskProcessor {
String Prefix="ActivateSliceSubnet_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+ AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
RequestDBUtil requestDBUtil = new RequestDBUtil()
private static final Logger logger = LoggerFactory.getLogger(ActivateSliceSubnet.class)
@@ -136,16 +137,19 @@ class ActivateSliceSubnet 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")
String operationType = execution.getVariable("operationType")
- 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.setResourceInstanceID(nssiId)
initStatus.setOperType(operationType)
requestDBUtil.prepareInitResourceOperationStatus(execution, initStatus)
@@ -153,7 +157,6 @@ class ActivateSliceSubnet extends AbstractServiceTaskProcessor {
}
-
/**
* return sync response
*/
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 75006365f2..5d952b6b8d 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
@@ -450,4 +450,22 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
return json.toString()
}
+
+ public String getModelUuid(DelegateExecution execution, String instanceId) {
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+ ServiceInstance serviceInstance = new ServiceInstance()
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(instanceId))
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai : ${instanceId}")
+ }
+ AAIResultWrapper wrapper = client.get(uri, NotFoundException.class)
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+
+ if(si.isPresent()) {
+ serviceInstance = si.get()
+ }
+ return serviceInstance.getModelVersionId()
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
index 897cdfcd7b..1d75cf5216 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
@@ -63,6 +63,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
RequestDBUtil requestDBUtil = new RequestDBUtil()
JsonUtils jsonUtil = new JsonUtils()
ObjectMapper objectMapper = new ObjectMapper()
+ AnNssmfUtils anNssmfUtils = new AnNssmfUtils()
private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil)
private static final Logger logger = LoggerFactory.getLogger(DoActivateAccessNSSI.class)
@@ -197,15 +198,11 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
callbackURL.append("/").append(messageType).append("/").append(reqId)
JsonObject input = new JsonObject()
+ String sliceProfileId = execution.getVariable("anNfSPId")
+ input.addProperty("sliceProfileId",sliceProfileId)
input.addProperty("RANNFNSSIId", anNfNssiId)
input.addProperty("callbackURL", callbackURL.toString())
- input.addProperty("s-NSSAI", sNssai.toString())
-
- JsonObject Payload = new JsonObject()
- Payload.addProperty("version", "1.0")
- Payload.addProperty("rpc-name", "activateRANSlice")
- Payload.addProperty("correlation-id", reqId)
- Payload.addProperty("type", "request")
+ input.addProperty("sNSSAI", sNssai.toString())
JsonObject wrapinput = new JsonObject()
wrapinput.addProperty("Action", action)
@@ -220,11 +217,16 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
body.add("input", wrapinput)
JsonObject sdnrRequest = new JsonObject()
- Payload.addProperty("input", input.toString())
- wrapinput.add("Payload", Payload)
+ JsonObject payload = new JsonObject()
+ payload.add("input", input)
+ wrapinput.addProperty("Payload", payload.toString())
wrapinput.add("CommonHeader", CommonHeader)
body.add("input", wrapinput)
sdnrRequest.add("body", body)
+ sdnrRequest.addProperty("version", "1.0")
+ sdnrRequest.addProperty("rpc-name", "activateRANSlice")
+ sdnrRequest.addProperty("correlation-id", reqId)
+ sdnrRequest.addProperty("type", "request")
String json = sdnrRequest.toString()
execution.setVariable("sdnrRequest", json)
@@ -395,27 +397,29 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
- EsrInfo esrInfo = new EsrInfo()
- esrInfo.setNetworkType(networkType)
- esrInfo.setVendor(VENDOR_ONAP)
+ JsonObject esrInfo = new JsonObject()
+ esrInfo.addProperty("networkType", networkType)
+ esrInfo.addProperty("vendor", VENDOR_ONAP)
- ServiceInfo serviceInfo = new ServiceInfo()
- serviceInfo.setNssiId(instanceId)
- serviceInfo.setNsiId(execution.getVariable("nsiId"))
- serviceInfo.setGlobalSubscriberId(globalSubscriberId)
- serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ JsonObject serviceInfo = new JsonObject()
+ serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
+ serviceInfo.addProperty("nssiId", instanceId)
+ serviceInfo.addProperty("globalSubscriberId", globalSubscriberId)
+ serviceInfo.addProperty("subscriptionServiceType", subscriptionServiceType)
- execution.setVariable("${networkType}_esrInfo", esrInfo)
+ execution.setVariable("${networkType}_esrInfo", esrInfo.toString())
execution.setVariable("${networkType}_responseId", responseId)
- execution.setVariable("${networkType}_serviceInfo", serviceInfo)
+ execution.setVariable("${networkType}_serviceInfo", serviceInfo.toString())
}
void validateJobStatus(DelegateExecution execution,String responseDescriptor) {
logger.debug("validateJobStatus ${responseDescriptor}")
- String status = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.status")
- String statusDescription = jsonUtil.getJsonValue(responseDescriptor, "responseDescriptor.statusDescription")
- if("finished".equalsIgnoreCase(status)) {
+ String jobResponse = execution.getVariable("tn_responseDescriptor")
+ logger.debug("Job status response "+jobResponse)
+ String status = jsonUtil.getJsonValue(jobResponse, "status")
+ String statusDescription = jsonUtil.getJsonValue(jobResponse, "statusDescription")
+ if("finished".equalsIgnoreCase(status)) {
execution.setVariable("isSuccess", true)
}else {
execution.setVariable("isSuccess", false)
@@ -458,15 +462,18 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
void prepareUpdateJobStatus(DelegateExecution execution,String status,String progress,String statusDescription) {
logger.debug("${Prefix} Start prepareUpdateJobStatus : ${statusDescription}")
- String serviceId = execution.getVariable("anNssiId")
+ String nssiId = execution.getVariable("anNssiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
+ //String modelUuid = execution.getVariable("modelUuid")
+ String modelUuid = anNssmfUtils.getModelUuid(execution, nssiId)
String operationType = execution.getVariable("operationType")
ResourceOperationStatus roStatus = new ResourceOperationStatus()
- roStatus.setServiceId(serviceId)
+ roStatus.setServiceId(nsiId)
roStatus.setOperationId(jobId)
- roStatus.setResourceTemplateUUID(nsiId)
+ roStatus.setResourceTemplateUUID(modelUuid)
+ roStatus.setResourceInstanceID(nssiId)
roStatus.setOperType(operationType)
roStatus.setProgress(progress)
roStatus.setStatus(status)
@@ -562,7 +569,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
Map<String, ServiceInstance> relatedNssis = execution.getVariable("relatedNssis")
- String anNssiId = execution.getVariable("anNssiId")
+ String nsiId = execution.getVariable("nsiId")
List<String> sNssaiList = execution.getVariable("sNssaiList")
ServiceInstance tnNssi = relatedNssis.get(serviceFunction)
@@ -572,11 +579,11 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
ActDeActNssi actDeactNssi = new ActDeActNssi()
actDeactNssi.setNssiId(nssiId)
- actDeactNssi.setNsiId(anNssiId)
+ actDeactNssi.setNsiId(nsiId)
actDeactNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
actDeactNssi.setSnssaiList(sNssaiList)
- JsonObject esrInfo = new JsonObject()
+ JsonObject esrInfo = new JsonObject()
esrInfo.addProperty("networkType", "tn")
esrInfo.addProperty("vendor", VENDOR_ONAP)