summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy91
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn2
5 files changed, 65 insertions, 55 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java
index b6227aae16..2e0ec3f154 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java
@@ -39,8 +39,6 @@ public class AAIPropertiesImpl implements AAIProperties {
public static final String AAI_ENABLE_CACHING = "aai.caching.enable";
public static final String AAI_CACHE_MAX_AGE = "aai.caching.maxAge";
- private UrnPropertiesReader reader;
-
@Override
public URL getEndpoint() throws MalformedURLException {
return new URL(UrnPropertiesReader.getVariable(AAI_ENDPOINT));
@@ -68,17 +66,17 @@ public class AAIPropertiesImpl implements AAIProperties {
@Override
public Long getReadTimeout() {
- return Long.valueOf(reader.getVariable(AAI_READ_TIMEOUT, "60000"));
+ return Long.valueOf(UrnPropertiesReader.getVariable(AAI_READ_TIMEOUT, "60000"));
}
@Override
public Long getConnectionTimeout() {
- return Long.valueOf(reader.getVariable(AAI_CONNECTION_TIMEOUT, "60000"));
+ return Long.valueOf(UrnPropertiesReader.getVariable(AAI_CONNECTION_TIMEOUT, "60000"));
}
@Override
public boolean isCachingEnabled() {
- return Boolean.parseBoolean(reader.getVariable(AAI_ENABLE_CACHING, "false"));
+ return Boolean.parseBoolean(UrnPropertiesReader.getVariable(AAI_ENABLE_CACHING, "false"));
}
@Override
@@ -86,7 +84,7 @@ public class AAIPropertiesImpl implements AAIProperties {
return new AAICacheProperties() {
@Override
public Long getMaxAge() {
- return Long.valueOf(reader.getVariable(AAI_CACHE_MAX_AGE, "60000"));
+ return Long.valueOf(UrnPropertiesReader.getVariable(AAI_CACHE_MAX_AGE, "60000"));
}
};
}
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 9ccc6951ea..897cdfcd7b 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
@@ -49,7 +49,8 @@ import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.ObjectMapper
import com.google.gson.JsonObject
-
+import groovy.json.JsonSlurper
+import com.google.gson.Gson
/**
* Internal AN NSSMF to handle NSSI Activation/Deactivation
@@ -78,16 +79,26 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
private static final String ACTIVATE = "activateInstance"
private static final String DEACTIVATE = "deactivateInstance"
- private static final String VENDOR_ONAP = "ONAP"
+ private static final String VENDOR_ONAP = "ONAP_internal"
+
+ enum orchStatusMap {
+ activateInstance("activated"),
+ deactivateInstance("deactivated")
+
+ private String value;
+
+ private orchStatusMap(String value) {
+ this.value = value;
+ }
+ }
- Map<String,String> orchStatusMap = new HashMap<>()
@Override
public void preProcessRequest(DelegateExecution execution) {
logger.debug("${Prefix} - Start preProcessRequest")
String sliceParams = execution.getVariable("sliceParams")
- String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+ List<String> sNssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "snssaiList"))
String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
String nsiId = execution.getVariable("nsiId")
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -95,7 +106,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String anNssiId = execution.getVariable("serviceInstanceID")
String operationType = execution.getVariable("operationType")
- if(isBlank(sNssaiList) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
+ if((sNssaiList.empty) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
String msg = "Input fields cannot be null : Mandatory attributes : [snssaiList, sliceProfileId, nsiId]"
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
@@ -112,9 +123,6 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("nsiId", nsiId)
execution.setVariable("anNssiId", anNssiId)
- orchStatusMap.put(ACTIVATE, "activated")
- orchStatusMap.put(DEACTIVATE, "deactivated")
-
logger.debug("${Prefix} - Preprocessing completed with sliceProfileId : ${anSliceProfileId} , nsiId : ${nsiId} , nssiId : ${anNssiId}")
}
@@ -145,11 +153,12 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
ServiceInstance sliceProfileInstance = execution.getVariable(KEY_SLICE_PROFILE)
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeSPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeSPStatus", false)
- }
+ }else {
+ execution.setVariable("shouldChangeSPStatus", true)
+
+ }
logger.debug("${Prefix} - SPOrchStatus : ${orchStatus}")
}
@@ -167,10 +176,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeAN_NF_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeAN_NF_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeAN_NF_SPStatus", true)
}
logger.debug("${Prefix} - getAnNfSPOrchStatus AN_NF SP ID:${anNfSPId} : ${orchStatus}")
}
@@ -181,7 +190,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String action = operationType.equalsIgnoreCase(ACTIVATE) ? "activate":"deactivate"
String anNfNssiId = execution.getVariable("anNfNssiId")
- String sNssai = execution.getVariable("sNssaiList")
+ List<String> sNssai = execution.getVariable("sNssaiList")
String reqId = execution.getVariable("msoRequestId")
String messageType = "SDNRActivateResponse"
StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
@@ -190,7 +199,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject input = new JsonObject()
input.addProperty("RANNFNSSIId", anNfNssiId)
input.addProperty("callbackURL", callbackURL.toString())
- input.addProperty("s-NSSAI", sNssai)
+ input.addProperty("s-NSSAI", sNssai.toString())
JsonObject Payload = new JsonObject()
Payload.addProperty("version", "1.0")
@@ -202,7 +211,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
wrapinput.addProperty("Action", action)
JsonObject CommonHeader = new JsonObject()
- CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
+ CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss", TimeZone.getDefault()))
CommonHeader.addProperty("APIver", "1.0")
CommonHeader.addProperty("RequestID", reqId)
CommonHeader.addProperty("SubRequestID", "1")
@@ -211,18 +220,18 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
body.add("input", wrapinput)
JsonObject sdnrRequest = new JsonObject()
- Payload.add("input", input)
+ Payload.addProperty("input", input.toString())
wrapinput.add("Payload", Payload)
wrapinput.add("CommonHeader", CommonHeader)
body.add("input", wrapinput)
sdnrRequest.add("body", body)
String json = sdnrRequest.toString()
- execution.setVariable("sdnrRequest", sdnrRequest)
+ execution.setVariable("sdnrRequest", json)
execution.setVariable("SDNR_messageType", messageType)
execution.setVariable("SDNR_timeout", "PT10M")
- logger.debug("${Prefix} - prepareSdnrActivationRequest : SDNR Request : ${json}")
+ logger.debug("${Prefix} - Exit prepareSdnrActivationRequest ")
}
void processSdnrResponse(DelegateExecution execution) {
@@ -267,10 +276,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeTN_FH_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeTN_FH_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeTN_FH_SPStatus", true)
}
logger.debug("${Prefix} Exit getTnFhSPOrchStatus TN_FH SP ID:${tnFhSPId} : ${orchStatus}")
@@ -283,9 +292,8 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
List<String> sNssaiList = execution.getVariable("sNssaiList")
- String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
-
- String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+ String snssai = sNssaiList.get(0)
+ String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + urlOpType
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -307,10 +315,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeTN_MH_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeTN_MH_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeTN_MH_SPStatus", true)
}
logger.debug("${Prefix} Exit getTnMhSPOrchStatus TN_MH SP ID:${tnFhSPId} : ${orchStatus}")
}
@@ -322,9 +330,9 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
List<String> sNssaiList = execution.getVariable("sNssaiList")
- String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
+ String snssai = sNssaiList.get(0)
- String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+ String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + urlOpType
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -378,7 +386,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String anSliceProfileId = execution.getVariable("anSliceProfileId")
updateOrchStatus(execution, anNssiId)
updateOrchStatus(execution, anSliceProfileId)
- logger.debug("${Prefix} Start updateANStatus")
+ logger.debug("${Prefix} Exit updateANStatus")
}
void prepareQueryJobStatus(DelegateExecution execution,String jobId,String networkType,String instanceId) {
@@ -463,7 +471,8 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ logger.debug("${Prefix} Exit prepareUpdateJobStatus : ${statusDescription}")
}
@@ -567,20 +576,22 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
actDeactNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
actDeactNssi.setSnssaiList(sNssaiList)
- EsrInfo esrInfo = new EsrInfo()
- esrInfo.setVendor(VENDOR_ONAP)
- esrInfo.setNetworkType("TN")
+ JsonObject esrInfo = new JsonObject()
+ esrInfo.addProperty("networkType", "tn")
+ esrInfo.addProperty("vendor", VENDOR_ONAP)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ serviceInfo.setNssiId(nssiId)
JsonObject json = new JsonObject()
- json.addProperty("actDeActNssi", objectMapper.writeValueAsString(actDeactNssi))
- json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
- json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+ Gson jsonConverter = new Gson()
+ json.add("actDeActNssi", jsonConverter.toJsonTree(actDeactNssi))
+ json.add("esrInfo", esrInfo)
+ json.add("serviceInfo", jsonConverter.toJsonTree(serviceInfo))
return json.toString()
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
index ec97972e5d..01aefe2054 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
@@ -123,7 +123,6 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("OOFResponse", OOFResponse)
String solutions =""
if(requestStatus.equals("completed")) {
- solutions = jsonUtil.getJsonValue(OOFResponse, "solutions")
List solutionsList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(OOFResponse, "solutions"))
if(solutionsList!=null && !solutionsList.isEmpty() ) {
solutions = solutionsList.get(0)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
index 1ca0605ac8..91599700ef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
@@ -440,7 +440,9 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId)
client.create(networkRouteUri, bh_ep)
//relationship b/w bh_ep and Core NSSI
- def coreNssi = execution.getVariable("nssiServiceInstanceId")
+ String coreNssi = execution.getVariable("nssiServiceInstanceId")
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
Relationship relationship = new Relationship()
String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}"
relationship.setRelatedLink(relatedLink)
@@ -448,10 +450,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
logger.debug("networkRouteUri: "+networkRouteUri+"relationship: "+relationship)
try {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
- execution.getVariable("globalSubscriberId"),
- execution.getVariable("subscriptionServiceType"),
- coreNssi).relationshipAPI()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(coreNssi)).relationshipAPI()
logger.debug("uri: "+uri)
client.create(uri, relationship)
} catch (BpmnError e) {
@@ -475,6 +474,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
+ String nssiId = execution.getVariable("nssiServiceInstanceId")
String operationType = "ALLOCATE"
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
@@ -494,15 +494,17 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
- String nssiId = execution.getVariable("nssiId")
+ String nssiId = execution.getVariable("nssiServiceInstanceId")
String operationType = "ALLOCATE"
//modelUuid
String modelUuid= execution.getVariable("modelUuid")
- logger.debug("serviceId: "+serviceId +" "+ "jobId: "+jobId +" "+ "nsiId: "+nsiId +" "+ "operationType: "+operationType)
+ logger.debug("serviceId: "+serviceId +" "+ "jobId: "+jobId +" "+ "nsiId: "+nsiId +" "+ "nssiId: "+nssiId +" "+ "operationType: "+operationType)
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
resourceOperationStatus.setJobId(jobId)
resourceOperationStatus.setOperationId(jobId)
+ resourceOperationStatus.setResourceTemplateUUID(nsiId)
+ resourceOperationStatus.setResourceInstanceID(nssiId)
resourceOperationStatus.setResourceTemplateUUID(modelUuid)
resourceOperationStatus.setOperType(operationType)
resourceOperationStatus.setProgress("0")
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
index d81f5465b3..2301b47639 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
@@ -154,7 +154,7 @@ activator.processSdnrResponse(execution)</bpmn:script>
<bpmn:outgoing>Flow_0rizzsm</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def activator = new DoActivateAccessNSSI()
-activator..prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
+activator.prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
</bpmn:scriptTask>
<bpmn:serviceTask id="Activity_08yj5gq" name="Update Resource Operation Status">
<bpmn:extensionElements>