aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy37
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeAllocateAccessNSSI.groovy101
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy64
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn136
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java38
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java154
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java64
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java40
17 files changed, 429 insertions, 278 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 a812b37879..07a23481d7 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
@@ -356,12 +356,15 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
JsonArray connectionLinksList = new JsonArray()
JsonObject connectionLinks = new JsonObject()
Gson jsonConverter = new Gson()
+ String TNFH_nssiInstanceId = UUID.randomUUID().toString()
+ String TNMH_nssiInstanceId = UUID.randomUUID().toString()
+
if(action.equals("allocate")){
JsonObject endpoints = new JsonObject()
if(domainType.equals("TN_FH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
- serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNFH_modelName"))
+ serviceInfo.addProperty("nssiName", "nssi_tn_fh_"+TNFH_nssiInstanceId)
serviceInfo.addProperty("sst", execution.getVariable("sst"))
allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid"))
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
@@ -374,7 +377,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
}else if(domainType.equals("TN_MH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
- serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNMH_modelName"))
+ serviceInfo.addProperty("nssiName", "nssi_tn_mh_"+TNMH_nssiInstanceId)
serviceInfo.addProperty("sst", execution.getVariable("sst"))
allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid"))
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
@@ -435,15 +438,15 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
public String buildDeallocateNssiRequest(DelegateExecution execution,String domainType) {
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
+
+ List<String> sNssaiList = execution.getVariable("snssaiList")
+
+ DeAllocateNssi deallocateNssi = new DeAllocateNssi()
+ deallocateNssi.setNsiId(execution.getVariable("nsiId"))
+ deallocateNssi.setScriptName("TN1")
+ deallocateNssi.setSnssaiList(sNssaiList)
+ deallocateNssi.setTerminateNssiOption(0)
- JsonObject deAllocateNssi = new JsonObject()
- deAllocateNssi.addProperty("snssaiList", execution.getVariable("snssaiList"))
- deAllocateNssi.addProperty("nsiId", execution.getVariable("nsiId"))
- deAllocateNssi.addProperty("modifyAction", true)
- deAllocateNssi.addProperty("terminateNssiOption", 0)
- deAllocateNssi.addProperty("scriptName", "TN1")
-
-
JsonObject esrInfo = new JsonObject()
esrInfo.addProperty("networkType", "tn")
esrInfo.addProperty("vendor", "ONAP_internal")
@@ -451,19 +454,21 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
JsonObject serviceInfo = new JsonObject()
serviceInfo.addProperty("globalSubscriberId", globalSubscriberId)
serviceInfo.addProperty("subscriptionServiceType", subscriptionServiceType)
-
+ serviceInfo.addProperty("modifyAction", true)
+
if(domainType.equals("TN_FH")) {
- deAllocateNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
+ deallocateNssi.setNssiId(execution.getVariable("TNFH_NSSI"))
+ deallocateNssi.setSliceProfileId(execution.getVariable("TNFH_sliceProfileInstanceId"))
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"))
+ deallocateNssi.setNssiId(execution.getVariable("TNMH_NSSI"))
+ deallocateNssi.setSliceProfileId(execution.getVariable("TNMH_sliceProfileInstanceId"))
serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
- deAllocateNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
}
JsonObject json = new JsonObject()
- json.add("deAllocateNssi", deAllocateNssi)
+ Gson jsonConverter = new Gson()
+ json.add("deAllocateNssi", jsonConverter.toJsonTree(deallocateNssi))
json.add("esrInfo", esrInfo)
json.add("serviceInfo", serviceInfo)
return json.toString()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
index 2564b11295..d5c132087c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
@@ -643,7 +643,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
//create RAN NF NSSI
ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId"))
- sliceInstanceName = "nssi_"+execution.getVariable("ANNF_modelName")
+ String ANNF_nssiInstanceId = UUID.randomUUID().toString()
+ sliceInstanceName = "nssi_an_nf_"+ANNF_nssiInstanceId
ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
ANNFServiceInstance.setServiceType(execution.getVariable("sst"))
ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
index 0d64d7811b..0088ed4e54 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -691,6 +691,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
allocateTnNssi.setNetworkSliceInfos()
allocateTnNssi.setSliceProfile(sliceTaskInfo.sliceProfile.trans2TnProfile())
+ allocateTnNssi.getSliceProfile().setDomainType(sliceTaskInfo.subnetType.subnetType)
NsiInfo nsiInfo = new NsiInfo()
nsiInfo.setNsiId(sliceParams.suggestNsiId)
nsiInfo.setNsiName(sliceParams.suggestNsiName)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
index 67e4b9227d..b07f5c965d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCommonCoreNSSI.groovy
@@ -121,6 +121,7 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
currentNSSI['S-NSSAI'] = sNssai
}
+ LOGGER.debug("S-NSSAI=" + currentNSSI['S-NSSAI'])
// Slice Profile id
String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
@@ -381,9 +382,10 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
}
+ LOGGER.debug("${getPrefix()} Exit callPUTServiceInstance")
+
return response
- LOGGER.debug("${getPrefix()} Exit callPUTServiceInstance")
}
@@ -742,6 +744,8 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
// Supported S-NSSAI
List<String> snssais = (List<String>) currentNSSI['S-NSSAIs']
+ LOGGER.debug("prepareInstanceParams: snssais size = " + snssais.size())
+
ServiceInstance nssi = (ServiceInstance) currentNSSI['nssi']
String orchStatus = nssi.getOrchestrationStatus()
@@ -750,6 +754,7 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
List<Map<String, String>> snssaiList = new ArrayList<>()
for(String snssai:snssais) {
+ LOGGER.debug("prepareInstanceParams: snssai = " + snssai)
Map<String, String> snssaisMap = new HashMap<>()
snssaisMap.put("snssai", snssai)
snssaisMap.put("status", orchStatus)
@@ -761,12 +766,15 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
ObjectMapper mapper = new ObjectMapper()
- String supportedNssaiDetailsStr = mapper.writeValueAsString(snssaiList)
+ Map<String, Object> nSsai= new LinkedHashMap<>()
+ nSsai.put("sNssai", snssaiList)
+ // String supportedsNssaiJson = mapper.writeValueAsString(snssaiList)
+ String supportedsNssaiJson = mapper.writeValueAsString(nSsai)
instanceParamsMap.put("k8s-rb-profile-name", "default") // ???
instanceParamsMap.put("config-type", "day2") // ???
- instanceParamsMap.put("supportedNssai", supportedNssaiDetailsStr)
+ instanceParamsMap.put("supportedsNssai", supportedsNssaiJson)
instanceParams.add(instanceParamsMap)
LOGGER.debug("${getPrefix()} Exit prepareInstanceParams")
@@ -1177,9 +1185,8 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
sliceProfileInstanceUri = (AAIResourceUri)spURI
}
else {
- String msg = "Slice Profile URI not found"
- LOGGER.error(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ String msg = "Slice Profile association with NSSI was already removed"
+ LOGGER.info(msg)
}
}
@@ -1220,13 +1227,12 @@ class DoCommonCoreNSSI extends AbstractServiceTaskProcessor {
sliceProfileInstanceUri = (AAIResourceUri)spURI
}
else {
- String msg = "Slice Profile URI not found"
- LOGGER.error(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ String msg = "Slice Profile instance was already deleted"
+ LOGGER.info(msg)
}
}
- if(sliceProfileInstanceUri != null) { // NSSI should not be terminated
+ if(sliceProfileInstanceUri != null) {
try {
client.delete(sliceProfileInstanceUri)
} catch (Exception e) {
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 0d2e6c1d5e..5a3859fff4 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
@@ -38,6 +38,7 @@ import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.T
import org.onap.logging.filter.base.ONAPComponents
import org.onap.so.beans.nsmf.DeAllocateNssi
import org.onap.so.beans.nsmf.EsrInfo
+import org.onap.so.beans.nsmf.NetworkType
import org.onap.so.beans.nsmf.ServiceInfo
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
@@ -55,6 +56,7 @@ import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.ObjectMapper
import com.google.gson.JsonObject
+import com.google.gson.Gson
/**
@@ -74,23 +76,23 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
private static final String ROLE_SLICE_PROFILE = "slice-profile-instance"
private static final String ROLE_NSSI = "nssi"
- private static final String AN_NF = "AN-NF"
- private static final String TN_FH = "TN-FH"
- private static final String TN_MH = "TN-MH"
+ private static final String AN_NF = "AN_NF"
+ private static final String TN_FH = "TN_FH"
+ private static final String TN_MH = "TN_MH"
@Override
public void preProcessRequest(DelegateExecution execution) {
logger.debug("${Prefix} - Start preProcessRequest")
String sliceParams = execution.getVariable("sliceParams")
- String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+ def sNssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "snssaiList"))
String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
String nsiId = jsonUtil.getJsonValue(sliceParams, "nsiId")
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
String anNssiId = execution.getVariable("serviceInstanceID")
- 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)
@@ -172,14 +174,15 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
boolean terminateAnNfNSSI = callOofAdapter(execution,execution.getVariable("oofAnNfNssiPayload"))
execution.setVariable("terminateAnNfNSSI", terminateAnNfNSSI)
if(!terminateAnNfNSSI) {
- execution.setVariable("modifyAction",true)
+ execution.setVariable("modifyAction","deallocate")
}
}
void prepareSdnrRequest(DelegateExecution execution) {
String anNfNssiId = execution.getVariable("anNfNssiId")
- String sNssai = execution.getVariable("sNssaiList")
+ String sNssai = execution.getVariable("sNssaiList").get(0)
+ String sliceProfileId = execution.getVariable("anNfSliceProfileId")
String reqId = execution.getVariable("msoRequestId")
String messageType = "SDNRTerminateResponse"
StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
@@ -188,35 +191,38 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject input = new JsonObject()
input.addProperty("RANNFNSSIId", anNfNssiId)
input.addProperty("callbackURL", callbackURL.toString())
- input.addProperty("s-NSSAI", sNssai)
+ input.addProperty("sNSSAI", sNssai)
+ input.addProperty("sliceProfileId",sliceProfileId)
+ input.add("additionalproperties", new JsonObject())
JsonObject Payload = new JsonObject()
- Payload.addProperty("version", "1.0")
- Payload.addProperty("rpc-name", "terminateRANSliceInstance")
- Payload.addProperty("correlation-id", reqId)
- Payload.addProperty("type", "request")
JsonObject wrapinput = new JsonObject()
wrapinput.addProperty("action", "deallocate")
JsonObject CommonHeader = new JsonObject()
- CommonHeader.addProperty("time-stamp", new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
+ CommonHeader.addProperty("timestamp", new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
CommonHeader.addProperty("api-ver", "1.0")
+ CommonHeader.addProperty("originator-id", "testing")
CommonHeader.addProperty("request-id", reqId)
CommonHeader.addProperty("sub-request-id", "1")
+ CommonHeader.add("flags", new JsonObject())
JsonObject body = new JsonObject()
- body.add("input", wrapinput)
JsonObject sdnrRequest = new JsonObject()
Payload.add("input", input)
- wrapinput.add("payload", Payload)
+ wrapinput.addProperty("payload", Payload.toString())
wrapinput.add("common-header", CommonHeader)
body.add("input", wrapinput)
sdnrRequest.add("body", body)
+ sdnrRequest.addProperty("version", "1.0")
+ sdnrRequest.addProperty("rpc-name", "terminateRANSliceInstance")
+ sdnrRequest.addProperty("correlation-id", reqId)
+ sdnrRequest.addProperty("type", "request")
String json = sdnrRequest.toString()
- execution.setVariable("sdnrRequest", sdnrRequest)
+ execution.setVariable("sdnrRequest", json)
execution.setVariable("SDNR_messageType", messageType)
execution.setVariable("SDNR_timeout", "PT10M")
@@ -336,26 +342,26 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
- EsrInfo esrInfo = new EsrInfo()
- esrInfo.setNetworkType(networkType)
- esrInfo.setVendor("ONAP")
+ JsonObject esrInfo = new JsonObject()
+ esrInfo.addProperty("networkType", networkType)
+ esrInfo.addProperty("vendor", "ONAP_internal")
- 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")
+ String status = jsonUtil.getJsonValue(responseDescriptor, "status")
+ String statusDescription = jsonUtil.getJsonValue(responseDescriptor, "statusDescription")
if("finished".equalsIgnoreCase(status)) {
execution.setVariable("isSuccess", true)
}else {
@@ -364,14 +370,15 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
}
void prepareUpdateJobStatus(DelegateExecution execution,String status,String progress,String statusDescription) {
- String serviceId = execution.getVariable("anNssiId")
+ String nssiId = execution.getVariable("anNssiId")
String jobId = execution.getVariable("jobId")
String nsiId = execution.getVariable("nsiId")
ResourceOperationStatus roStatus = new ResourceOperationStatus()
- roStatus.setServiceId(serviceId)
+ roStatus.setServiceId(nsiId)
roStatus.setOperationId(jobId)
- roStatus.setResourceTemplateUUID(nsiId)
+ //roStatus.setResourceTemplateUUID(nsiId)
+ roStatus.setResourceInstanceID(nssiId)
roStatus.setOperType("DeAllocate")
roStatus.setProgress(progress)
roStatus.setStatus(status)
@@ -382,7 +389,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
void terminateTNFHNssi(DelegateExecution execution) {
logger.debug("Start terminateTNFHNssi in ${Prefix}")
String nssmfRequest = buildDeallocateNssiRequest(execution, TN_FH)
- String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedSPs"), TN_FH)
+ String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_FH)
execution.setVariable("tnFHNSSIId", nssiId)
String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles/" + nssiId
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
@@ -399,7 +406,7 @@ 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("relatedSPs"), TN_MH)
+ String nssiId = getInstanceIdByWorkloadContext(execution.getVariable("relatedNssis"), TN_MH)
execution.setVariable("tnMHNSSIId", nssiId)
String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles/" + nssiId
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
@@ -430,7 +437,7 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
void deleteANNSSI(DelegateExecution execution) {
logger.debug("${Prefix} delete AN NSSI")
- String nssiId = execution.getVariable("serviceInstanceID")
+ String nssiId = execution.getVariable("anNssiId")
deleteServiceInstanceInAAI(execution, nssiId)
}
@@ -508,42 +515,46 @@ class DoDeAllocateAccessNSSI extends AbstractServiceTaskProcessor {
Map<String, ServiceInstance> relatedNssis = execution.getVariable("relatedNssis")
String anNssiId = execution.getVariable("anNssiId")
- List<String> sNssaiList = execution.getVariable("sNssaiList")
+ List<String> sNssaiList = execution.getVariable("sNssaiList")
Map<String, ServiceInstance> relatedSPs = execution.getVariable("relatedSPs")
DeAllocateNssi deallocateNssi = new DeAllocateNssi()
- deallocateNssi.setNsiId(anNssiId)
+ deallocateNssi.setNsiId(execution.getVariable("nsiId"))
ServiceInstance tnNssi = relatedNssis.get(serviceFunction)
String nssiId = tnNssi.getServiceInstanceId()
deallocateNssi.setNssiId(nssiId)
- deallocateNssi.setScriptName(tnNssi.getServiceInstanceName())
+ deallocateNssi.setScriptName("TN1")
deallocateNssi.setSnssaiList(sNssaiList)
deallocateNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
- EsrInfo esrInfo = new EsrInfo()
- esrInfo.setVendor("ONAP")
- esrInfo.setNetworkType("TN")
+ JsonObject esrInfo = new JsonObject()
+ esrInfo.addProperty("networkType", "tn")
+ esrInfo.addProperty("vendor", "ONAP_internal")
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ serviceInfo.setNssiId(nssiId)
+ serviceInfo.setNssiName(tnNssi.getServiceInstanceName())
JsonObject json = new JsonObject()
- json.addProperty("deAllocateNssi", objectMapper.writeValueAsString(deallocateNssi))
- json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
- json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+ Gson jsonConverter = new Gson()
+ json.add("deAllocateNssi", jsonConverter.toJsonTree(deallocateNssi))
+ json.add("esrInfo", esrInfo)
+ json.add("serviceInfo", jsonConverter.toJsonTree(serviceInfo))
return json.toString()
}
private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) {
try {
- AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(instanceId))
- getAAIClient().delete(serviceInstanceUri)
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(instanceId))
+ client.delete(serviceInstanceUri)
logger.debug("${Prefix} Exited deleteServiceInstance")
}catch(Exception e){
logger.debug("Error occured within deleteServiceInstance method: " + e)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
index c559845e12..11058748fd 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSI.groovy
@@ -238,6 +238,22 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
+
+ // NSI
+ String nsiId = currentNSSI['nsiId']
+ ServiceInstance nsi = null
+ AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
+ Optional<ServiceInstance> nsiOpt = client.get(ServiceInstance.class, nsiUri)
+ if (nsiOpt.isPresent()) {
+ nsi = nsiOpt.get()
+ }
+ else {
+ String msg = "NSI service instance not found in AAI for nsi id " + nsiId
+ LOGGER.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+
//Setting correlator as requestId
String requestId = execution.getVariable("msoRequestId")
execution.setVariable("NSSI_correlator", requestId)
@@ -257,7 +273,7 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
String nxlId = nssi.getServiceInstanceId()
String nxlType = "NSSI"
- String oofRequest = getOofUtils().buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, nssi.getServiceInstanceId())
+ String oofRequest = getOofUtils().buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, nsi.getServiceInstanceId())
LOGGER.debug("**** Terminate Nxi Request: "+oofRequest)
LOGGER.debug("${PREFIX} Exit buildOOFRequest")
@@ -289,32 +305,31 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
// http://so.onap:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances/de6a0aa2-19f2-41fe-b313-a5a9f159acd7/vnfs/3abbb373-8d33-4977-aa4b-2bfee496b6d5
String url = String.format("${nsmfЕndPoint}/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), constituteVnf.getVnfId())
+ LOGGER.debug("url = " + url)
+
currentNSSI['deleteServiceOrderURL'] = url
String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
String basicAuth = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
- /*String basicAuthValue = encryptBasicAuth(basicAuth, msoKey)
- def authHeader = ""
- if (basicAuthValue != null) {
- String responseAuthHeader = getAuthHeader(execution, basicAuthValue, msoKey)
- String errorCode = jsonUtil.getJsonValue(responseAuthHeader, "errorCode")
- if(errorCode == null || errorCode.isEmpty()) { // No error
- authHeader = responseAuthHeader
- }
- else {
- exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(responseAuthHeader, "errorMessage"))
- }
- } else {
- LOGGER.error( "Unable to obtain BasicAuth - BasicAuth value null")
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
- "value null")
- } */
-
def authHeader = utils.getBasicAuth(basicAuth, msoKey)
- String callDeleteServiceOrderResponse = callDeleteServiceOrder(execution, url, authHeader)
- String errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode")
+ def requestDetails = ""
+
+ String prepareRequestDetailsResponse = prepareRequestDetails(execution)
+ LOGGER.debug("deleteServiceOrder: prepareRequestDetailsResponse=" + prepareRequestDetailsResponse)
+
+ String errorCode = jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorCode")
+ LOGGER.debug("deleteServiceOrder: errorCode=" + errorCode)
+ if(errorCode == null || errorCode.isEmpty()) { // No error
+ requestDetails = prepareRequestDetailsResponse
+ }
+ else {
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(errorCode), jsonUtil.getJsonValue(prepareRequestDetailsResponse, "errorMessage"))
+ }
+
+ String callDeleteServiceOrderResponse = callDeleteServiceOrder(url, authHeader, requestDetails)
+ errorCode = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "errorCode")
if(errorCode == null || errorCode.isEmpty()) { // No error
String macroOperationId = jsonUtil.getJsonValue(callDeleteServiceOrderResponse, "requestReferences.requestId")
@@ -339,21 +354,24 @@ class DoDeallocateCoreNSSI extends DoCommonCoreNSSI {
}
- String callDeleteServiceOrder(DelegateExecution execution, String url, String authHeader) {
+ String callDeleteServiceOrder(String url, String authHeader, String requestDetailsStr) {
LOGGER.debug("${PREFIX} Start callDeleteServiceOrder")
String errorCode = ""
String errorMessage = ""
String response = ""
+ LOGGER.debug("callDeleteServiceOrder: url = " + url)
+ LOGGER.debug("callDeleteServiceOrder: authHeader = " + authHeader)
+
try {
HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
httpClient.addAdditionalHeader("Authorization", authHeader)
httpClient.addAdditionalHeader("Accept", "application/json")
- Response httpResponse = httpClient.delete()
+ Response httpResponse = httpClient.delete(requestDetailsStr)
int soResponseCode = httpResponse.getStatus()
- LOGGER.debug("callDeleteServiceInstance: soResponseCode = " + soResponseCode)
+ LOGGER.debug("callDeleteServiceOrder: soResponseCode = " + soResponseCode)
if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
response = httpResponse.readEntity(String.class)
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 3bb1c0bef5..a08eb570c9 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
@@ -609,7 +609,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
def prepareTnMhDeallocateRequest = { DelegateExecution execution ->
logger.debug(Prefix+"prepareTnFhDeallocateRequest method start")
- String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_FH")
+ String nssmfRequest = anNssmfUtils.buildDeallocateNssiRequest(execution, "TN_MH")
String nssiId = execution.getVariable("TNFH_NSSI")
execution.setVariable("tnFHNSSIId", nssiId)
String urlString = "/api/rest/provMns/v1/NSS/SliceProfiles/" + nssiId
@@ -758,8 +758,9 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
}
private void deleteServiceInstanceInAAI(DelegateExecution execution,String instanceId) {
try {
- AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("serviceType")).serviceInstance(instanceId))
- getAAIClient().delete(serviceInstanceUri)
+ AAIResourcesClient client = getAAIClient()
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(instanceId))
+ client.delete(serviceInstanceUri)
logger.debug("${Prefix} Exited deleteServiceInstance")
}catch(Exception e){
logger.debug("Error occured within deleteServiceInstance method: " + e)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
index 5bf4f40e50..acace8c1c7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateCoreNSSITest.groovy
@@ -95,6 +95,9 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
String nssiId = "5G-999"
currentNSSI.put("nssiId", nssiId)
+ String nsiId = "ns-777"
+ currentNSSI.put("nsiId", nsiId)
+
when(mockExecution.getVariable("currentNSSI")).thenReturn(currentNSSI)
when(mockExecution.getVariable("mso.oof.endpoint")).thenReturn("http://oof.onap:8088")
@@ -127,6 +130,14 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
when(client.get(ServiceInstance.class, nssiUri)).thenReturn(nssiOpt)
+ AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(nsiId))
+
+ ServiceInstance nsi = new ServiceInstance()
+ nsi.setServiceInstanceId("5G-777")
+ Optional<ServiceInstance> nsiOpt = Optional.of(nsi)
+
+ when(client.get(ServiceInstance.class, nsiUri)).thenReturn(nsiOpt)
+
String urlString = "http://oof.onap:8088"
String httpRequest = "{\n" +
@@ -143,7 +154,7 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
String nxlId = nssi.getServiceInstanceId()
String nxlType = "NSSI"
String messageType = "cn"
- String serviceInstanceId = nssi.getServiceInstanceId()
+ String serviceInstanceId = nsi.getServiceInstanceId()
when(mockExecution.getVariable("msoRequestId")).thenReturn(requestId)
when(oofUtilsMock.buildTerminateNxiRequest(requestId, nxlId, nxlType, messageType, serviceInstanceId)).thenReturn(httpRequest)
@@ -213,6 +224,7 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
genericVnf.setVnfName("vnf-name")
genericVnf.setVnfId("vnf-id")
+
currentNSSI.put("constituteVnf", genericVnf)
String urlString = String.format("http://mso.onap:8088/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s", networkServiceInstance.getServiceInstanceId(), genericVnf.getVnfId())
@@ -235,7 +247,7 @@ class DoDeallocateCoreNSSITest extends MsoGroovyTest {
when(httpClientFactoryMock.newJsonClient(any(), any())).thenReturn(httpClientMock)
- when(httpClientMock.delete()).thenReturn(responseMock)
+ when(httpClientMock.delete(requestDetailsStr)).thenReturn(responseMock)
when(responseMock.getStatus()).thenReturn(200)
when(responseMock.hasEntity()).thenReturn(true)
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn
index 5e4b73070d..4debe1fe21 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateAccessNSSI.bpmn
@@ -639,7 +639,7 @@ deallocator.deleteANNSSI(execution)</bpmn:script>
<bpmn:callActivity id="Activity_0umktii" name="Modify RAN NF NSSI" calledElement="DoModifyRanNfNssi">
<bpmn:extensionElements>
<camunda:in source="anNfNssiId" target="serviceInstanceID" />
- <camunda:in source="anNfSliceProfileId" target="SliceProfileId" />
+ <camunda:in source="anNfSliceProfileId" target="sliceProfileId" />
<camunda:in source="msoRequestId" target="msoRequestId" />
<camunda:in source="globalSubscriberId" target="globalSubscriberId" />
<camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
index bfc45f26b7..3966caeba5 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateCoreNSSI.bpmn
@@ -20,11 +20,11 @@ def dcnssi= new DoDeallocateCoreNSSI()
dcnssi.getNetworkServiceInstance(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:exclusiveGateway id="Gateway_1dqw1bg" name="Is terminateNSSI=true?" default="Flow_0e3yvck">
- <bpmn:incoming>Flow_16192dm</bpmn:incoming>
+ <bpmn:incoming>Flow_01q7kcf</bpmn:incoming>
<bpmn:outgoing>Flow_15ew9rs</bpmn:outgoing>
<bpmn:outgoing>Flow_0e3yvck</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="Flow_16192dm" sourceRef="Activity_0wswwhj" targetRef="Gateway_1dqw1bg" />
+ <bpmn:sequenceFlow id="Flow_16192dm" sourceRef="Activity_0wswwhj" targetRef="Activity_1anr9ry" />
<bpmn:scriptTask id="Activity_1kne6ot" name="Invoke DeleteServiceOrder API" scriptFormat="groovy">
<bpmn:incoming>Flow_15ew9rs</bpmn:incoming>
<bpmn:outgoing>Flow_1b14can</bpmn:outgoing>
@@ -33,14 +33,14 @@ def dcnssi= new DoDeallocateCoreNSSI()
dcnssi.deleteServiceOrder(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="Activity_1anr9ry" name="Get constitute VNF from Network Service Instance" scriptFormat="groovy">
- <bpmn:incoming>Flow_1v68jns</bpmn:incoming>
- <bpmn:outgoing>Flow_1eev81t</bpmn:outgoing>
+ <bpmn:incoming>Flow_16192dm</bpmn:incoming>
+ <bpmn:outgoing>Flow_01q7kcf</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi= new DoDeallocateCoreNSSI()
dcnssi.getConstituteVNFFromNetworkServiceInst(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="Activity_16wfqhu" name="Get NSSI associated profiles" scriptFormat="groovy">
- <bpmn:incoming>Flow_1eev81t</bpmn:incoming>
+ <bpmn:incoming>Flow_1v68jns</bpmn:incoming>
<bpmn:outgoing>Flow_0xrq94a</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcnssi= new DoDeallocateCoreNSSI()
@@ -113,8 +113,7 @@ def dcnssi= new DoDeallocateCoreNSSI()
<bpmn:sequenceFlow id="Flow_15ew9rs" name="yes" sourceRef="Gateway_1dqw1bg" targetRef="Activity_1kne6ot">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isTerminateNSSI" ) == true)}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
- <bpmn:sequenceFlow id="Flow_1v68jns" sourceRef="Event_1mk9pgp" targetRef="Activity_1anr9ry" />
- <bpmn:sequenceFlow id="Flow_1eev81t" sourceRef="Activity_1anr9ry" targetRef="Activity_16wfqhu" />
+ <bpmn:sequenceFlow id="Flow_1v68jns" sourceRef="Event_1mk9pgp" targetRef="Activity_16wfqhu" />
<bpmn:sequenceFlow id="Flow_0xrq94a" sourceRef="Activity_16wfqhu" targetRef="Activity_0es9or8" />
<bpmn:sequenceFlow id="Flow_1qwi2ka" sourceRef="Activity_0es9or8" targetRef="Activity_0mnkgd6" />
<bpmn:sequenceFlow id="Flow_0e3yvck" name="no" sourceRef="Gateway_1dqw1bg" targetRef="Event_016dxue" />
@@ -282,9 +281,18 @@ dcnssi.timeDelay(execution)</bpmn:script>
<bpmn:sequenceFlow id="Flow_0eigzrb" sourceRef="Activity_03j1rrj" targetRef="Event_0zbwefx" />
<bpmn:sequenceFlow id="Flow_16bwdkl" sourceRef="Activity_13qnpcn" targetRef="Activity_0wswwhj" />
<bpmn:sequenceFlow id="Flow_0zxtlgn" sourceRef="Activity_1ym1op6" targetRef="Activity_1a5fd5v" />
+ <bpmn:sequenceFlow id="Flow_01q7kcf" sourceRef="Activity_1anr9ry" targetRef="Gateway_1dqw1bg" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeallocateCoreNSSI">
+ <bpmndi:BPMNEdge id="Flow_0zxtlgn_di" bpmnElement="Flow_0zxtlgn">
+ <di:waypoint x="1010" y="320" />
+ <di:waypoint x="1010" y="270" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_16bwdkl_di" bpmnElement="Flow_16bwdkl">
+ <di:waypoint x="500" y="117" />
+ <di:waypoint x="540" y="117" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0eigzrb_di" bpmnElement="Flow_0eigzrb">
<di:waypoint x="1470" y="670" />
<di:waypoint x="1532" y="670" />
@@ -295,8 +303,8 @@ dcnssi.timeDelay(execution)</bpmn:script>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0att74c_di" bpmnElement="Flow_0att74c">
<di:waypoint x="990" y="560" />
- <di:waypoint x="930" y="560" />
- <di:waypoint x="930" y="490" />
+ <di:waypoint x="850" y="560" />
+ <di:waypoint x="850" y="490" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0afgah7_di" bpmnElement="Flow_0afgah7">
<di:waypoint x="1040" y="475" />
@@ -326,14 +334,14 @@ dcnssi.timeDelay(execution)</bpmn:script>
<di:waypoint x="1100" y="710" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0pvh1x9_di" bpmnElement="Flow_0pvh1x9">
- <di:waypoint x="980" y="450" />
+ <di:waypoint x="900" y="450" />
<di:waypoint x="1015" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1j1en2h_di" bpmnElement="Flow_1j1en2h">
<di:waypoint x="1105" y="350" />
- <di:waypoint x="1000" y="350" />
+ <di:waypoint x="1060" y="350" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1019" y="352" width="18" height="14" />
+ <dc:Bounds x="1063" y="352" width="18" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1mrr969_di" bpmnElement="Flow_1mrr969">
@@ -344,13 +352,13 @@ dcnssi.timeDelay(execution)</bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1h8q1h1_di" bpmnElement="Flow_1h8q1h1">
- <di:waypoint x="1000" y="230" />
+ <di:waypoint x="1060" y="230" />
<di:waypoint x="1130" y="230" />
<di:waypoint x="1130" y="325" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0g84uy5_di" bpmnElement="Flow_0g84uy5">
<di:waypoint x="360" y="117" />
- <di:waypoint x="440" y="117" />
+ <di:waypoint x="400" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_15rk73d_di" bpmnElement="Flow_15rk73d">
<di:waypoint x="1150" y="670" />
@@ -376,41 +384,37 @@ dcnssi.timeDelay(execution)</bpmn:script>
<di:waypoint x="260" y="670" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1b14can_di" bpmnElement="Flow_1b14can">
- <di:waypoint x="820" y="230" />
- <di:waypoint x="900" y="230" />
+ <di:waypoint x="890" y="230" />
+ <di:waypoint x="960" y="230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_178myd8_di" bpmnElement="Flow_178myd8">
- <di:waypoint x="820" y="450" />
- <di:waypoint x="880" y="450" />
+ <di:waypoint x="710" y="450" />
+ <di:waypoint x="800" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0e3yvck_di" bpmnElement="Flow_0e3yvck">
- <di:waypoint x="795" y="117" />
- <di:waypoint x="885" y="117" />
+ <di:waypoint x="865" y="117" />
+ <di:waypoint x="962" y="117" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="807" y="95" width="13" height="14" />
+ <dc:Bounds x="879" y="95" width="13" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1qwi2ka_di" bpmnElement="Flow_1qwi2ka">
- <di:waypoint x="680" y="450" />
- <di:waypoint x="720" y="450" />
+ <di:waypoint x="540" y="450" />
+ <di:waypoint x="610" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0xrq94a_di" bpmnElement="Flow_0xrq94a">
- <di:waypoint x="510" y="450" />
- <di:waypoint x="580" y="450" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_1eev81t_di" bpmnElement="Flow_1eev81t">
<di:waypoint x="360" y="450" />
- <di:waypoint x="410" y="450" />
+ <di:waypoint x="440" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1v68jns_di" bpmnElement="Flow_1v68jns">
<di:waypoint x="215" y="450" />
<di:waypoint x="260" y="450" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_15ew9rs_di" bpmnElement="Flow_15ew9rs">
- <di:waypoint x="770" y="142" />
- <di:waypoint x="770" y="190" />
+ <di:waypoint x="840" y="142" />
+ <di:waypoint x="840" y="190" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="751" y="157" width="17" height="14" />
+ <dc:Bounds x="831" y="167" width="17" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0nvtepd_di" bpmnElement="Flow_0nvtepd">
@@ -418,20 +422,16 @@ dcnssi.timeDelay(execution)</bpmn:script>
<di:waypoint x="410" y="670" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_16192dm_di" bpmnElement="Flow_16192dm">
- <di:waypoint x="691" y="117" />
- <di:waypoint x="745" y="117" />
+ <di:waypoint x="640" y="117" />
+ <di:waypoint x="680" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0xxq2h8_di" bpmnElement="Flow_0xxq2h8">
<di:waypoint x="215" y="117" />
<di:waypoint x="260" y="117" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_16bwdkl_di" bpmnElement="Flow_16bwdkl">
- <di:waypoint x="540" y="117" />
- <di:waypoint x="591" y="117" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="Flow_0zxtlgn_di" bpmnElement="Flow_0zxtlgn">
- <di:waypoint x="950" y="310" />
- <di:waypoint x="950" y="270" />
+ <bpmndi:BPMNEdge id="Flow_01q7kcf_di" bpmnElement="Flow_01q7kcf">
+ <di:waypoint x="780" y="117" />
+ <di:waypoint x="815" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
@@ -442,18 +442,6 @@ dcnssi.timeDelay(execution)</bpmn:script>
<bpmndi:BPMNShape id="Activity_0u06qij_di" bpmnElement="Activity_0u06qij">
<dc:Bounds x="260" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1anr9ry_di" bpmnElement="Activity_1anr9ry">
- <dc:Bounds x="260" y="410" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_16wfqhu_di" bpmnElement="Activity_16wfqhu">
- <dc:Bounds x="410" y="410" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0es9or8_di" bpmnElement="Activity_0es9or8">
- <dc:Bounds x="580" y="410" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_0mnkgd6_di" bpmnElement="Activity_0mnkgd6">
- <dc:Bounds x="720" y="410" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_19z90sm_di" bpmnElement="Activity_19z90sm">
<dc:Bounds x="260" y="630" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -493,32 +481,47 @@ dcnssi.timeDelay(execution)</bpmn:script>
<dc:Bounds x="160" y="695" width="88" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_16wfqhu_di" bpmnElement="Activity_16wfqhu">
+ <dc:Bounds x="260" y="410" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0mnkgd6_di" bpmnElement="Activity_0mnkgd6">
+ <dc:Bounds x="610" y="410" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_07qrjro_di" bpmnElement="Activity_07qrjro">
+ <dc:Bounds x="800" y="410" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0es9or8_di" bpmnElement="Activity_0es9or8">
+ <dc:Bounds x="440" y="410" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_13qnpcn_di" bpmnElement="Activity_13qnpcn">
- <dc:Bounds x="440" y="77" width="100" height="80" />
+ <dc:Bounds x="400" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0wswwhj_di" bpmnElement="Activity_0wswwhj">
- <dc:Bounds x="591" y="77" width="100" height="80" />
+ <dc:Bounds x="540" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Gateway_1dqw1bg_di" bpmnElement="Gateway_1dqw1bg" isMarkerVisible="true">
- <dc:Bounds x="745" y="92" width="50" height="50" />
+ <bpmndi:BPMNShape id="Event_016dxue_di" bpmnElement="Event_016dxue">
+ <dc:Bounds x="962" y="99" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="728" y="53" width="86" height="40" />
+ <dc:Bounds x="951" y="140" width="74" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Event_016dxue_di" bpmnElement="Event_016dxue">
- <dc:Bounds x="885" y="99" width="36" height="36" />
+ <bpmndi:BPMNShape id="Gateway_1dqw1bg_di" bpmnElement="Gateway_1dqw1bg" isMarkerVisible="true">
+ <dc:Bounds x="815" y="92" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="874" y="140" width="74" height="40" />
+ <dc:Bounds x="799" y="53" width="85" height="40" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1ym1op6_di" bpmnElement="Activity_1ym1op6">
- <dc:Bounds x="900" y="310" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_1a5fd5v_di" bpmnElement="Activity_1a5fd5v">
+ <dc:Bounds x="960" y="190" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1kne6ot_di" bpmnElement="Activity_1kne6ot">
- <dc:Bounds x="720" y="190" width="100" height="80" />
+ <dc:Bounds x="790" y="190" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_1a5fd5v_di" bpmnElement="Activity_1a5fd5v">
- <dc:Bounds x="900" y="190" width="100" height="80" />
+ <bpmndi:BPMNShape id="Activity_1anr9ry_di" bpmnElement="Activity_1anr9ry">
+ <dc:Bounds x="680" y="77" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1ym1op6_di" bpmnElement="Activity_1ym1op6">
+ <dc:Bounds x="960" y="320" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_14l5j2f_di" bpmnElement="Activity_14l5j2f" isExpanded="true">
<dc:Bounds x="250" y="910" width="781" height="196" />
@@ -563,9 +566,6 @@ dcnssi.timeDelay(execution)</bpmn:script>
<dc:Bounds x="1165" y="336" width="54" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="Activity_07qrjro_di" bpmnElement="Activity_07qrjro">
- <dc:Bounds x="880" y="410" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Gateway_1yftwt8_di" bpmnElement="Gateway_1yftwt8" isMarkerVisible="true">
<dc:Bounds x="1015" y="425" width="50" height="50" />
<bpmndi:BPMNLabel>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn
index 3844770023..d3b67432fa 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyAccessNSSI.bpmn
@@ -236,7 +236,7 @@ nss.createFhAllocateNssiJobQuery(execution)</bpmn:script>
<camunda:in source="esrInfo" target="esrInfo" />
<camunda:in source="serviceInfo" target="serviceInfo" />
<camunda:in source="TN_FH_jobId" target="jobId" />
- <camunda:out source="jobResponse" target="TNFH_jobResponse" />
+ <camunda:out source="responseDescriptor" target="TNFH_jobResponse" />
<camunda:in source="responseId" target="responseId" />
<camunda:in source="job_timeout" target="timeout" />
</bpmn:extensionElements>
@@ -280,7 +280,7 @@ nss.createMhAllocateNssiJobQuery(execution)</bpmn:script>
<camunda:in source="esrInfo" target="esrInfo" />
<camunda:in source="serviceInfo" target="serviceInfo" />
<camunda:in source="TN_MH_jobId" target="jobId" />
- <camunda:out source="jobResponse" target="TNMH_jobResponse" />
+ <camunda:out source="responseDescriptor" target="TNMH_jobResponse" />
<camunda:in source="responseId" target="responseId" />
<camunda:in source="job_timeout" target="timeout" />
</bpmn:extensionElements>
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
index 78b9bf1ee6..228e1bd0d8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -59,6 +59,8 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.client.RequestsDbClient;
import org.springframework.core.env.Environment;
+// deprecated because of task SO-3772, this class will be deleted after all its usage is removed
+@Deprecated
@RunWith(MockitoJUnitRunner.Silent.class)
public abstract class BaseTaskTest extends TestDataSetup {
@Mock
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
index cb46d2de8a..6a94ee9990 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
@@ -37,7 +37,6 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.data.TestDataSetup;
@@ -45,29 +44,34 @@ import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIVnfResources;
-import org.springframework.beans.factory.annotation.Autowired;
-
-
-public class AAIFlagTasksTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AAIFlagTasksTest extends TestDataSetup {
+ @Mock
+ protected AAIResourcesClient MOCK_aaiResourcesClient;
+ @Mock
+ protected InjectionHelper MOCK_injectionHelper;
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+ @Mock
+ protected AAIVnfResources aaiVnfResources;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBBMock;
@InjectMocks
- private AAIFlagTasks aaiFlagTasks = new AAIFlagTasks();
-
- private GenericVnf genericVnf;
+ private AAIFlagTasks aaiFlagTasks;
@Before
public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
+ GenericVnf genericVnf = setGenericVnf();
doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
- when(extractPojosForBB.extractByKey(any(), any())).thenReturn(genericVnf);
+ when(extractPojosForBBMock.extractByKey(any(), any())).thenReturn(genericVnf);
}
@Test
- public void checkVnfInMaintTestTrue() throws Exception {
+ public void checkVnfInMaintTestTrue() {
doThrow(new BpmnError("VNF is in maintenance in A&AI")).when(exceptionUtil)
.buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class));
@@ -82,7 +86,7 @@ public class AAIFlagTasksTest extends BaseTaskTest {
}
@Test
- public void checkVnfInMaintTestFalse() throws Exception {
+ public void checkVnfInMaintTestFalse() {
doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class));
aaiFlagTasks.checkVnfInMaintFlag(execution);
verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class),
@@ -106,7 +110,7 @@ public class AAIFlagTasksTest extends BaseTaskTest {
}
@Test
- public void modifyVnfInMaintFlagTest() throws Exception {
+ public void modifyVnfInMaintFlagTest() {
doNothing().when(aaiVnfResources).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
aaiFlagTasks.modifyVnfInMaintFlag(execution, true);
verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
@@ -128,7 +132,7 @@ public class AAIFlagTasksTest extends BaseTaskTest {
}
@Test
- public void checkVnfClosedLoopDisabledTestTrue() throws Exception {
+ public void checkVnfClosedLoopDisabledTestTrue() {
doThrow(new BpmnError("VNF Closed Loop Disabled in A&AI")).when(exceptionUtil)
.buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
@@ -142,7 +146,7 @@ public class AAIFlagTasksTest extends BaseTaskTest {
}
@Test
- public void checkVnfClosedLoopDisabledTestFalse() throws Exception {
+ public void checkVnfClosedLoopDisabledTestFalse() {
doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class),
@@ -165,7 +169,7 @@ public class AAIFlagTasksTest extends BaseTaskTest {
}
@Test
- public void modifyVnfClosedLoopDisabledFlagTest() throws Exception {
+ public void modifyVnfClosedLoopDisabledFlagTest() {
doNothing().when(aaiVnfResources).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index e1d3a7cbc4..857807ef2e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -37,19 +37,21 @@ import java.util.List;
import java.util.Optional;
import java.util.TreeSet;
import java.util.stream.Collectors;
-import com.google.common.base.Strings;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.mockito.Mockito;
-import org.onap.so.bpmn.BaseTaskTest;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
@@ -68,14 +70,50 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
+import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIPnfResources;
+import org.onap.so.client.orchestration.AAIServiceInstanceResources;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+import org.onap.so.client.orchestration.AAIVpnBindingResources;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-
-public class AAICreateTasksTest extends BaseTaskTest {
-
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AAICreateTasksTest extends TestDataSetup {
+
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+ @Mock
+ protected AAIServiceInstanceResources aaiServiceInstanceResources;
+ @Mock
+ protected AAIVolumeGroupResources aaiVolumeGroupResources;
+ @Mock
+ protected AAIVnfResources aaiVnfResources;
+ @Mock
+ protected AAINetworkResources aaiNetworkResources;
+ @Mock
+ protected AAIVfModuleResources aaiVfModuleResources;
+ @Mock
+ protected AAIPnfResources aaiPnfResources;
+ @Mock
+ protected AAIVpnBindingResources aaiVpnBindingResources;
+ @Mock
+ protected AAIInstanceGroupResources aaiInstanceGroupResources;
+ @Mock
+ protected AAIConfigurationResources aaiConfigurationResources;
+ @Mock
+ protected Environment env;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBBMock;
@InjectMocks
- private AAICreateTasks aaiCreateTasks = new AAICreateTasks();
-
+ private AAICreateTasks aaiCreateTasks;
private ServiceInstance serviceInstance;
private L3Network network;
@@ -107,17 +145,19 @@ public class AAICreateTasksTest extends BaseTaskTest {
configuration = setConfiguration();
instanceGroup = setInstanceGroupVnf();
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
.thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)))
+ .thenReturn(vfModule);
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID)))
+ .thenReturn(network);
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
.thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
.thenReturn(configuration);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
.thenReturn(instanceGroup);
@@ -129,7 +169,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createServiceInstanceTest() throws Exception {
+ public void createServiceInstanceTest() {
doReturn(false).when(aaiServiceInstanceResources).checkInstanceServiceNameInUse(serviceInstance);
doNothing().when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer);
aaiCreateTasks.createServiceInstance(execution);
@@ -137,7 +177,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createServiceInstanceExceptionTest() throws Exception {
+ public void createServiceInstanceExceptionTest() {
expectedException.expect(BpmnError.class);
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound");
@@ -147,7 +187,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createVolumeGroupTest() throws Exception {
+ public void createVolumeGroupTest() {
volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
execution.setVariable("aLaCarte", Boolean.FALSE);
doNothing().when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion);
@@ -161,7 +201,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createVolumeGroupExceptionTest() throws Exception {
+ public void createVolumeGroupExceptionTest() {
expectedException.expect(BpmnError.class);
volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
@@ -181,7 +221,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createPlatformTest() throws Exception {
+ public void createPlatformTest() {
doNothing().when(aaiVnfResources).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf);
aaiCreateTasks.createPlatform(execution);
ArgumentCaptor<Platform> platformCaptor = ArgumentCaptor.forClass(Platform.class);
@@ -197,7 +237,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createPlatformNetworkTest() throws Exception {
+ public void createPlatformNetworkTest() {
doNothing().when(aaiNetworkResources).createPlatformAndConnectNetwork(network.getPlatform(), network);
aaiCreateTasks.createPlatformForNetwork(execution);
ArgumentCaptor<Platform> platformCaptor = ArgumentCaptor.forClass(Platform.class);
@@ -221,7 +261,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createLineOfBusinessTest() throws Exception {
+ public void createLineOfBusinessTest() {
doNothing().when(aaiVnfResources).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf);
aaiCreateTasks.createLineOfBusiness(execution);
@@ -243,7 +283,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void splitCDL_Test() throws Exception {
+ public void splitCDL_Test() {
List<String> strings = aaiCreateTasks.splitCDL("Test");
assertEquals(strings.get(0), "Test");
@@ -252,7 +292,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createProjectExceptionTest() throws Exception {
+ public void createProjectExceptionTest() {
expectedException.expect(BpmnError.class);
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound");
@@ -262,7 +302,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createProjectNullProjectNameTest() throws Exception {
+ public void createProjectNullProjectNameTest() {
serviceInstance.getProject().setProjectName(null);
doNothing().when(aaiServiceInstanceResources)
.createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
@@ -272,7 +312,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createProjectEmptyProjectNameTest() throws Exception {
+ public void createProjectEmptyProjectNameTest() {
serviceInstance.getProject().setProjectName("");
doNothing().when(aaiServiceInstanceResources)
.createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance);
@@ -282,7 +322,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createOwningEntityTest() throws Exception {
+ public void createOwningEntityTest() {
doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
doNothing().when(aaiServiceInstanceResources)
.connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(), serviceInstance);
@@ -293,7 +333,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createOwningEntityNotExistsOwningEntityTest() throws Exception {
+ public void createOwningEntityNotExistsOwningEntityTest() {
doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
doNothing().when(aaiServiceInstanceResources)
.createOwningEntityandConnectServiceInstance(serviceInstance.getOwningEntity(), serviceInstance);
@@ -320,7 +360,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createOwningEntityNullOwningEntityNameTest() throws Exception {
+ public void createOwningEntityNullOwningEntityNameTest() {
expectedException.expect(BpmnError.class);
serviceInstance.getOwningEntity().setOwningEntityName(null);
@@ -331,7 +371,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createOwningEntityEmptyOwningEntityNameTest() throws Exception {
+ public void createOwningEntityEmptyOwningEntityNameTest() {
expectedException.expect(BpmnError.class);
serviceInstance.getOwningEntity().setOwningEntityName("");
@@ -342,7 +382,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createOwningEntityExceptionTest() throws Exception {
+ public void createOwningEntityExceptionTest() {
expectedException.expect(BpmnError.class);
doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity());
@@ -354,7 +394,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createVnfTest() throws Exception {
+ public void createVnfTest() {
doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
execution.setVariable("aLaCarte", Boolean.FALSE);
aaiCreateTasks.createVnf(execution);
@@ -365,7 +405,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
public void createVnfExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound");
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(any(),
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBBMock).extractByKey(any(),
ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID));
doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance);
aaiCreateTasks.createVnf(execution);
@@ -374,7 +414,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
@Test
public void createPnfShouldCallCreatePnfAndConnectServiceInstance() throws BBObjectNotFoundException {
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.PNF))).thenReturn(pnf);
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.PNF))).thenReturn(pnf);
aaiCreateTasks.createPnf(execution);
verify(aaiPnfResources, times(1)).createPnfAndConnectServiceInstance(pnf, serviceInstance);
}
@@ -382,7 +422,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
@Test
public void createPnfShouldThrowBpmnErrorWhenPnfIsNotFound() throws BBObjectNotFoundException {
expectedException.expect(BpmnError.class);
- doThrow(BBObjectNotFoundException.class).when(extractPojosForBB).extractByKey(execution, ResourceKey.PNF);
+ doThrow(BBObjectNotFoundException.class).when(extractPojosForBBMock).extractByKey(execution, ResourceKey.PNF);
aaiCreateTasks.createPnf(execution);
}
@@ -393,7 +433,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
newVfModule.setModuleIndex(null);
newVfModule.getModelInfoVfModule().setModelInvariantUUID("testModelInvariantUUID1");
doNothing().when(aaiVfModuleResources).createVfModule(newVfModule, genericVnf);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)))
.thenReturn(newVfModule);
assertEquals(null, newVfModule.getModuleIndex());
@@ -425,7 +465,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createVfModuleExceptionTest() throws Exception {
+ public void createVfModuleExceptionTest() {
expectedException.expect(BpmnError.class);
doThrow(RuntimeException.class).when(aaiVfModuleResources).createVfModule(vfModule, genericVnf);
@@ -433,7 +473,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectVfModuleToVolumeGroupTest() throws Exception {
+ public void connectVfModuleToVolumeGroupTest() {
doNothing().when(aaiVfModuleResources).connectVfModuleToVolumeGroup(genericVnf, vfModule, volumeGroup,
cloudRegion);
aaiCreateTasks.connectVfModuleToVolumeGroup(execution);
@@ -442,7 +482,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createNetworkTest() throws Exception {
+ public void createNetworkTest() {
network.getModelInfoNetwork().setNeutronNetworkType("PROVIDER");
execution.setVariable("aLaCarte", Boolean.FALSE);
doNothing().when(aaiNetworkResources).createNetworkConnectToServiceInstance(network, serviceInstance);
@@ -451,7 +491,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createNetworkExceptionTest() throws Exception {
+ public void createNetworkExceptionTest() {
expectedException.expect(BpmnError.class);
lookupKeyMap.put(ResourceKey.NETWORK_ID, "notfound");
@@ -479,7 +519,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createNetworkCollectionTest() throws Exception {
+ public void createNetworkCollectionTest() {
doNothing().when(aaiNetworkResources).createNetworkCollection(serviceInstance.getCollection());
execution.setVariable("networkCollectionName", "testNetworkCollectionName");
aaiCreateTasks.createNetworkCollection(execution);
@@ -487,7 +527,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createNetworkCollectionInstanceGroupTest() throws Exception {
+ public void createNetworkCollectionInstanceGroupTest() {
doNothing().when(aaiNetworkResources)
.createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
execution.setVariable("aLaCarte", Boolean.FALSE);
@@ -497,7 +537,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception {
+ public void connectNetworkToNetworkCollectionServiceInstanceTest() {
doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionServiceInstance(network,
serviceInstance);
aaiCreateTasks.connectNetworkToNetworkCollectionServiceInstance(execution);
@@ -506,7 +546,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception {
+ public void connectNetworkToNetworkCollectionInstanceGroupTest() {
doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionInstanceGroup(network,
serviceInstance.getCollection().getInstanceGroup());
aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution);
@@ -526,9 +566,9 @@ public class AAICreateTasksTest extends BaseTaskTest {
gBBInput.setServiceInstance(serviceInstance);
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId());
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID)))
.thenReturn(serviceInstance);
// verify connection call was not executednetwork
exception.expect(BpmnError.class);
@@ -537,7 +577,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectNetworkToCloudRegionTest() throws Exception {
+ public void connectNetworkToCloudRegionTest() {
gBBInput = execution.getGeneralBuildingBlock();
doNothing().when(aaiNetworkResources).connectNetworkToCloudRegion(network, gBBInput.getCloudRegion());
aaiCreateTasks.connectNetworkToCloudRegion(execution);
@@ -545,7 +585,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectNetworkToTenantTest() throws Exception {
+ public void connectNetworkToTenantTest() {
gBBInput = execution.getGeneralBuildingBlock();
doNothing().when(aaiNetworkResources).connectNetworkToTenant(network, gBBInput.getCloudRegion());
aaiCreateTasks.connectNetworkToTenant(execution);
@@ -553,7 +593,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createConfigurationTest() throws Exception {
+ public void createConfigurationTest() {
gBBInput = execution.getGeneralBuildingBlock();
doNothing().when(aaiConfigurationResources).createConfiguration(configuration);
execution.setVariable("aLaCarte", Boolean.FALSE);
@@ -562,7 +602,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectVnfToCloudRegionTest() throws Exception {
+ public void connectVnfToCloudRegionTest() {
gBBInput = execution.getGeneralBuildingBlock();
doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion());
aaiCreateTasks.connectVnfToCloudRegion(execution);
@@ -570,7 +610,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectNoneToVnfToCloudRegionTest() throws Exception {
+ public void connectNoneToVnfToCloudRegionTest() {
String[] arr = new String[1];
arr[0] = "test25Region2";
doReturn(arr).when(env).getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
@@ -582,7 +622,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void connectVnfTenantTest() throws Exception {
+ public void connectVnfTenantTest() {
gBBInput = execution.getGeneralBuildingBlock();
doNothing().when(aaiVnfResources).connectVnfToTenant(genericVnf, gBBInput.getCloudRegion());
aaiCreateTasks.connectVnfToTenant(execution);
@@ -590,7 +630,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createInstanceGroupVnfTest() throws Exception {
+ public void createInstanceGroupVnfTest() {
doReturn(false).when(aaiInstanceGroupResources)
.checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName());
doNothing().when(aaiInstanceGroupResources).createInstanceGroupandConnectServiceInstance(instanceGroup,
@@ -602,7 +642,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createInstanceGroupVnfExceptionTest() throws Exception {
+ public void createInstanceGroupVnfExceptionTest() {
expectedException.expect(BpmnError.class);
doThrow(RuntimeException.class).when(aaiInstanceGroupResources)
.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
@@ -610,7 +650,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createNetworkPolicyNeedToCreateAllTest() throws Exception {
+ public void createNetworkPolicyNeedToCreateAllTest() {
execution.setVariable("heatStackId", "testHeatStackId");
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123,ED456");
Optional<NetworkPolicy> networkPolicy = Optional.empty();
@@ -625,7 +665,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createNetworkPolicyNeedToCreateNoneTest() throws Exception {
+ public void createNetworkPolicyNeedToCreateNoneTest() {
execution.setVariable("heatStackId", "testHeatStackId");
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
NetworkPolicy networkPolicy = new NetworkPolicy();
@@ -636,14 +676,14 @@ public class AAICreateTasksTest extends BaseTaskTest {
}
@Test
- public void createNetworkPolicyNoNetworkPoliciesTest() throws Exception {
+ public void createNetworkPolicyNoNetworkPoliciesTest() {
execution.setVariable("heatStackId", "testHeatStackId");
aaiCreateTasks.createNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
}
@Test
- public void createVfModuleGetLowestIndexTest() throws Exception {
+ public void createVfModuleGetLowestIndexTest() {
GenericVnf vnf = new GenericVnf();
ModelInfoGenericVnf vnfInfo = new ModelInfoGenericVnf();
vnf.setModelInfoGenericVnf(vnfInfo);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 243b452d18..60dbadd426 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -35,13 +35,16 @@ import java.util.Optional;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.NetworkPolicies;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -53,14 +56,41 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIBaseResourceUri;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
-
-
-public class AAIDeleteTasksTest extends BaseTaskTest {
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
+import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.onap.so.client.orchestration.AAINetworkResources;
+import org.onap.so.client.orchestration.AAIServiceInstanceResources;
+import org.onap.so.client.orchestration.AAIVfModuleResources;
+import org.onap.so.client.orchestration.AAIVnfResources;
+import org.onap.so.client.orchestration.AAIVolumeGroupResources;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AAIDeleteTasksTest extends TestDataSetup {
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+ @Mock
+ protected AAIVfModuleResources aaiVfModuleResources;
+ @Mock
+ protected AAIServiceInstanceResources aaiServiceInstanceResources;
+ @Mock
+ protected AAIVnfResources aaiVnfResources;
+ @Mock
+ protected AAINetworkResources aaiNetworkResources;
+ @Mock
+ protected AAIVolumeGroupResources aaiVolumeGroupResources;
+ @Mock
+ protected AAIConfigurationResources aaiConfigurationResources;
+ @Mock
+ protected AAIInstanceGroupResources aaiInstanceGroupResources;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBBMock;
@InjectMocks
- private AAIDeleteTasks aaiDeleteTasks = new AAIDeleteTasks();
+ private AAIDeleteTasks aaiDeleteTasks;
private L3Network network;
private ServiceInstance serviceInstance;
@@ -85,17 +115,19 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
configuration = setConfiguration();
instanceGroup = setInstanceGroupVnf();
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
.thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID))).thenReturn(network);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID)))
+ .thenReturn(vfModule);
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.NETWORK_ID)))
+ .thenReturn(network);
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VOLUME_GROUP_ID)))
.thenReturn(volumeGroup);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
.thenReturn(configuration);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.INSTANCE_GROUP_ID)))
.thenReturn(instanceGroup);
@@ -195,7 +227,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
}
@Test
- public void deleteConfigurationTest() throws Exception {
+ public void deleteConfigurationTest() {
gBBInput = execution.getGeneralBuildingBlock();
doNothing().when(aaiConfigurationResources).deleteConfiguration(configuration);
aaiDeleteTasks.deleteConfiguration(execution);
@@ -203,7 +235,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
}
@Test
- public void deleteInstanceGroupVnfTest() throws Exception {
+ public void deleteInstanceGroupVnfTest() {
doNothing().when(aaiInstanceGroupResources).deleteInstanceGroup(instanceGroup);
aaiDeleteTasks.deleteInstanceGroupVnf(execution);
verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(instanceGroup);
@@ -231,7 +263,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
}
@Test
- public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {
+ public void deleteNetworkPolicyNeedToDeleteNoneTest() {
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
Optional<NetworkPolicies> networkPolicies = Optional.empty();
doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIBaseResourceUri.class));
@@ -240,7 +272,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
}
@Test
- public void deleteNetworkPolicyNoNetworkPoliciesTest() throws Exception {
+ public void deleteNetworkPolicyNoNetworkPoliciesTest() {
aaiDeleteTasks.deleteNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index 1fde3f4fbc..5917bd5e36 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.activity;
-
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
@@ -33,19 +32,22 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Spy;
-import org.onap.so.bpmn.BaseTaskTest;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.client.exception.ExceptionBuilder;
-public class ExecuteActivityTest extends BaseTaskTest {
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class ExecuteActivityTest extends TestDataSetup {
@InjectMocks
- protected ExecuteActivity executeActivity = new ExecuteActivity();
+ protected ExecuteActivity executeActivity;
@InjectMocks
@Spy
@@ -105,7 +107,7 @@ public class ExecuteActivityTest extends BaseTaskTest {
}
@Test
- public void buildAndThrowException_Test() throws Exception {
+ public void buildAndThrowException_Test() {
doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution);
doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
thrown.expect(BpmnError.class);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
index f23bbd8c91..ab0704430c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
@@ -35,21 +35,37 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
+import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
import org.onap.appc.client.lcm.model.Action;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
-
-public class GenericVnfHealthCheckTest extends BaseTaskTest {
-
+import org.onap.so.db.catalog.client.CatalogDbClient;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class GenericVnfHealthCheckTest extends TestDataSetup {
+
+ @Mock
+ protected ExceptionBuilder exceptionUtil;
+ @Mock
+ protected CatalogDbClient catalogDbClient;
+ @Mock
+ protected ApplicationControllerAction appCClient;
+ @Mock
+ protected ExtractPojosForBB extractPojosForBBMock;
@InjectMocks
- private GenericVnfHealthCheck genericVnfHealthCheck = new GenericVnfHealthCheck();
+ private GenericVnfHealthCheck genericVnfHealthCheck;
private GenericVnf genericVnf;
private RequestContext requestContext;
@@ -65,12 +81,12 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
.buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ when(extractPojosForBBMock.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
.thenReturn(genericVnf);
}
@Test
- public void setParamsForGenericVnfHealthCheckTest() throws Exception {
+ public void setParamsForGenericVnfHealthCheckTest() {
ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
controllerSelectionReference.setControllerName("testName");
controllerSelectionReference.setActionCategory("testAction");
@@ -91,12 +107,12 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
}
@Test
- public void callAppcClientTest() throws Exception {
+ public void callAppcClientTest() {
Action action = Action.HealthCheck;
String vnfId = genericVnf.getVnfId();
String payload = "{\"testName\":\"testValue\",}";
String controllerType = "testType";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ HashMap<String, String> payloadInfo = new HashMap<>();
payloadInfo.put("vnfName", "testVnfName");
payloadInfo.put("vfModuleId", "testVfModuleId");
payloadInfo.put("oamIpAddress", "testOamIpAddress");
@@ -120,13 +136,13 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
}
@Test
- public void callAppcClientExceptionTest() throws Exception {
+ public void callAppcClientExceptionTest() {
expectedException.expect(BpmnError.class);
Action action = Action.HealthCheck;
String vnfId = genericVnf.getVnfId();
String payload = "{\"testName\":\"testValue\",}";
String controllerType = "testType";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ HashMap<String, String> payloadInfo = new HashMap<>();
payloadInfo.put("vnfName", "testVnfName");
payloadInfo.put("vfModuleId", "testVfModuleId");
payloadInfo.put("oamIpAddress", "testOamIpAddress");
@@ -160,7 +176,7 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
String vnfId = genericVnf.getVnfId();
String payload = "{\"testName\":\"testValue\",}";
String controllerType = "testType";
- HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ HashMap<String, String> payloadInfo = new HashMap<>();
payloadInfo.put("vnfName", "testVnfName");
payloadInfo.put("vfModuleId", "testVfModuleId");
payloadInfo.put("oamIpAddress", "testOamIpAddress");