aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml2
-rw-r--r--bpmn/MSOCoreBPMN/pom.xml2
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml2
-rw-r--r--bpmn/pom.xml2
-rw-r--r--bpmn/so-bpmn-building-blocks/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy91
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn2
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java30
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java28
12 files changed, 98 insertions, 69 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index 9ce0755f49..60a689c04a 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<artifactId>MSOCommonBPMN</artifactId>
<name>MSOCommonBPMN</name>
diff --git a/bpmn/MSOCoreBPMN/pom.xml b/bpmn/MSOCoreBPMN/pom.xml
index 5285e4e79f..34790bb496 100644
--- a/bpmn/MSOCoreBPMN/pom.xml
+++ b/bpmn/MSOCoreBPMN/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>MSOCoreBPMN</artifactId>
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index 7e1ecfc90d..1df4a26246 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>mso-infrastructure-bpmn</artifactId>
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index 6be7eef3dc..9d2231f936 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>so</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<artifactId>bpmn</artifactId>
diff --git a/bpmn/so-bpmn-building-blocks/pom.xml b/bpmn/so-bpmn-building-blocks/pom.xml
index 76e53fea61..dbd954ca64 100644
--- a/bpmn/so-bpmn-building-blocks/pom.xml
+++ b/bpmn/so-bpmn-building-blocks/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-building-blocks</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index e6dfc20db5..90f9a57191 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-common</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
index 9ccc6951ea..897cdfcd7b 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateAccessNSSI.groovy
@@ -49,7 +49,8 @@ import org.slf4j.LoggerFactory
import com.fasterxml.jackson.databind.ObjectMapper
import com.google.gson.JsonObject
-
+import groovy.json.JsonSlurper
+import com.google.gson.Gson
/**
* Internal AN NSSMF to handle NSSI Activation/Deactivation
@@ -78,16 +79,26 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
private static final String ACTIVATE = "activateInstance"
private static final String DEACTIVATE = "deactivateInstance"
- private static final String VENDOR_ONAP = "ONAP"
+ private static final String VENDOR_ONAP = "ONAP_internal"
+
+ enum orchStatusMap {
+ activateInstance("activated"),
+ deactivateInstance("deactivated")
+
+ private String value;
+
+ private orchStatusMap(String value) {
+ this.value = value;
+ }
+ }
- Map<String,String> orchStatusMap = new HashMap<>()
@Override
public void preProcessRequest(DelegateExecution execution) {
logger.debug("${Prefix} - Start preProcessRequest")
String sliceParams = execution.getVariable("sliceParams")
- String sNssaiList = jsonUtil.getJsonValue(sliceParams, "snssaiList")
+ List<String> sNssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "snssaiList"))
String anSliceProfileId = jsonUtil.getJsonValue(sliceParams, "sliceProfileId")
String nsiId = execution.getVariable("nsiId")
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -95,7 +106,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String anNssiId = execution.getVariable("serviceInstanceID")
String operationType = execution.getVariable("operationType")
- if(isBlank(sNssaiList) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
+ if((sNssaiList.empty) || isBlank(anSliceProfileId) || isBlank(nsiId)) {
String msg = "Input fields cannot be null : Mandatory attributes : [snssaiList, sliceProfileId, nsiId]"
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
@@ -112,9 +123,6 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("nsiId", nsiId)
execution.setVariable("anNssiId", anNssiId)
- orchStatusMap.put(ACTIVATE, "activated")
- orchStatusMap.put(DEACTIVATE, "deactivated")
-
logger.debug("${Prefix} - Preprocessing completed with sliceProfileId : ${anSliceProfileId} , nsiId : ${nsiId} , nssiId : ${anNssiId}")
}
@@ -145,11 +153,12 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
ServiceInstance sliceProfileInstance = execution.getVariable(KEY_SLICE_PROFILE)
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeSPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeSPStatus", false)
- }
+ }else {
+ execution.setVariable("shouldChangeSPStatus", true)
+
+ }
logger.debug("${Prefix} - SPOrchStatus : ${orchStatus}")
}
@@ -167,10 +176,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeAN_NF_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeAN_NF_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeAN_NF_SPStatus", true)
}
logger.debug("${Prefix} - getAnNfSPOrchStatus AN_NF SP ID:${anNfSPId} : ${orchStatus}")
}
@@ -181,7 +190,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String action = operationType.equalsIgnoreCase(ACTIVATE) ? "activate":"deactivate"
String anNfNssiId = execution.getVariable("anNfNssiId")
- String sNssai = execution.getVariable("sNssaiList")
+ List<String> sNssai = execution.getVariable("sNssaiList")
String reqId = execution.getVariable("msoRequestId")
String messageType = "SDNRActivateResponse"
StringBuilder callbackURL = new StringBuilder(UrnPropertiesReader.getVariable("mso.workflow.message.endpoint", execution))
@@ -190,7 +199,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject input = new JsonObject()
input.addProperty("RANNFNSSIId", anNfNssiId)
input.addProperty("callbackURL", callbackURL.toString())
- input.addProperty("s-NSSAI", sNssai)
+ input.addProperty("s-NSSAI", sNssai.toString())
JsonObject Payload = new JsonObject()
Payload.addProperty("version", "1.0")
@@ -202,7 +211,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
wrapinput.addProperty("Action", action)
JsonObject CommonHeader = new JsonObject()
- CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-ddTHH:mm:ss.sss", TimeZone.getDefault()))
+ CommonHeader.addProperty("TimeStamp", new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss", TimeZone.getDefault()))
CommonHeader.addProperty("APIver", "1.0")
CommonHeader.addProperty("RequestID", reqId)
CommonHeader.addProperty("SubRequestID", "1")
@@ -211,18 +220,18 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
body.add("input", wrapinput)
JsonObject sdnrRequest = new JsonObject()
- Payload.add("input", input)
+ Payload.addProperty("input", input.toString())
wrapinput.add("Payload", Payload)
wrapinput.add("CommonHeader", CommonHeader)
body.add("input", wrapinput)
sdnrRequest.add("body", body)
String json = sdnrRequest.toString()
- execution.setVariable("sdnrRequest", sdnrRequest)
+ execution.setVariable("sdnrRequest", json)
execution.setVariable("SDNR_messageType", messageType)
execution.setVariable("SDNR_timeout", "PT10M")
- logger.debug("${Prefix} - prepareSdnrActivationRequest : SDNR Request : ${json}")
+ logger.debug("${Prefix} - Exit prepareSdnrActivationRequest ")
}
void processSdnrResponse(DelegateExecution execution) {
@@ -267,10 +276,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeTN_FH_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeTN_FH_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeTN_FH_SPStatus", true)
}
logger.debug("${Prefix} Exit getTnFhSPOrchStatus TN_FH SP ID:${tnFhSPId} : ${orchStatus}")
@@ -283,9 +292,8 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
List<String> sNssaiList = execution.getVariable("sNssaiList")
- String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
-
- String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+ String snssai = sNssaiList.get(0)
+ String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + urlOpType
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -307,10 +315,10 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String orchStatus = sliceProfileInstance.getOrchestrationStatus()
String operationType = execution.getVariable("operationType")
- if(orchStatusMap.get(operationType).equalsIgnoreCase(orchStatus)) {
- execution.setVariable("shouldChangeTN_MH_SPStatus", true)
- }else {
+ if(orchStatusMap.valueOf(operationType).toString().equalsIgnoreCase(orchStatus)) {
execution.setVariable("shouldChangeTN_MH_SPStatus", false)
+ }else {
+ execution.setVariable("shouldChangeTN_MH_SPStatus", true)
}
logger.debug("${Prefix} Exit getTnMhSPOrchStatus TN_MH SP ID:${tnFhSPId} : ${orchStatus}")
}
@@ -322,9 +330,9 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String urlOpType = operationType.equalsIgnoreCase(ACTIVATE) ? "activation":"deactivation"
List<String> sNssaiList = execution.getVariable("sNssaiList")
- String snssai = sNssaiList != null ? sNssaiList.get(0) : ""
+ String snssai = sNssaiList.get(0)
- String urlString = "/api/rest/provMns/v1/NSS/" + snssai + urlOpType
+ String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + urlOpType
String nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest)
if (nssmfResponse != null) {
String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId")
@@ -378,7 +386,7 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
String anSliceProfileId = execution.getVariable("anSliceProfileId")
updateOrchStatus(execution, anNssiId)
updateOrchStatus(execution, anSliceProfileId)
- logger.debug("${Prefix} Start updateANStatus")
+ logger.debug("${Prefix} Exit updateANStatus")
}
void prepareQueryJobStatus(DelegateExecution execution,String jobId,String networkType,String instanceId) {
@@ -463,7 +471,8 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
roStatus.setProgress(progress)
roStatus.setStatus(status)
roStatus.setStatusDescription(statusDescription)
- requestDBUtil.prepareUpdateResourceOperationStatus(execution, status)
+ requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
+ logger.debug("${Prefix} Exit prepareUpdateJobStatus : ${statusDescription}")
}
@@ -567,20 +576,22 @@ class DoActivateAccessNSSI extends AbstractServiceTaskProcessor {
actDeactNssi.setSliceProfileId(relatedSPs.get(serviceFunction).getServiceInstanceId())
actDeactNssi.setSnssaiList(sNssaiList)
- EsrInfo esrInfo = new EsrInfo()
- esrInfo.setVendor(VENDOR_ONAP)
- esrInfo.setNetworkType("TN")
+ JsonObject esrInfo = new JsonObject()
+ esrInfo.addProperty("networkType", "tn")
+ esrInfo.addProperty("vendor", VENDOR_ONAP)
ServiceInfo serviceInfo = new ServiceInfo()
serviceInfo.setServiceInvariantUuid(tnNssi.getModelInvariantId())
serviceInfo.setServiceUuid(tnNssi.getModelVersionId())
serviceInfo.setGlobalSubscriberId(globalSubscriberId)
serviceInfo.setSubscriptionServiceType(subscriptionServiceType)
+ serviceInfo.setNssiId(nssiId)
JsonObject json = new JsonObject()
- json.addProperty("actDeActNssi", objectMapper.writeValueAsString(actDeactNssi))
- json.addProperty("esrInfo", objectMapper.writeValueAsString(esrInfo))
- json.addProperty("serviceInfo", objectMapper.writeValueAsString(serviceInfo))
+ Gson jsonConverter = new Gson()
+ json.add("actDeActNssi", jsonConverter.toJsonTree(actDeactNssi))
+ json.add("esrInfo", esrInfo)
+ json.add("serviceInfo", jsonConverter.toJsonTree(serviceInfo))
return json.toString()
}
diff --git a/bpmn/so-bpmn-infrastructure-flows/pom.xml b/bpmn/so-bpmn-infrastructure-flows/pom.xml
index 63fef73645..fa45a415ee 100644
--- a/bpmn/so-bpmn-infrastructure-flows/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-flows/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-flows</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
index d81f5465b3..2301b47639 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateAccessNSSI.bpmn
@@ -154,7 +154,7 @@ activator.processSdnrResponse(execution)</bpmn:script>
<bpmn:outgoing>Flow_0rizzsm</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def activator = new DoActivateAccessNSSI()
-activator..prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
+activator.prepareUpdateJobStatus(execution,"processing","40","AN NF NSSI activation completed")</bpmn:script>
</bpmn:scriptTask>
<bpmn:serviceTask id="Activity_08yj5gq" name="Update Resource Operation Status">
<bpmn:extensionElements>
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index 032bd1ebe3..d9bff1dea3 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.7.1-SNAPSHOT</version>
+ <version>1.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-tasks</artifactId>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 4be497c469..f5955d6c7d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -46,10 +46,10 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.excpetion.VnfcMultipleRelationshipException;
import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
-import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
@@ -490,7 +490,7 @@ public class WorkflowAction {
AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(vnfId).vfModule(vfModuleId));
AAIResultWrapper vfModuleResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vfModuleResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
+ if (relationshipsOp.isEmpty()) {
logger.debug("No relationships were found for vfModule in AAI");
} else {
Relationships relationships = relationshipsOp.get();
@@ -503,21 +503,20 @@ public class WorkflowAction {
return vnfcs;
}
- protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name) throws Exception {
+ protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectName name)
+ throws VnfcMultipleRelationshipException {
T configuration = null;
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().vnfc(vnfc.getVnfcName()));
AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
+ if (relationshipsOp.isEmpty()) {
logger.debug("No relationships were found for VNFC in AAI");
} else {
Relationships relationships = relationshipsOp.get();
List<AAIResultWrapper> configurationResultWrappers =
this.getResultWrappersFromRelationships(relationships, name);
if (configurationResultWrappers.size() > 1) {
- String multipleRelationshipsError =
- "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- throw new Exception(multipleRelationshipsError);
+ throw new VnfcMultipleRelationshipException(vnfc.getVnfcName());
}
if (!configurationResultWrappers.isEmpty()) {
Optional<T> configurationOp = configurationResultWrappers.get(0).asBean(resultClass);
@@ -544,7 +543,7 @@ public class WorkflowAction {
}
protected List<ExecuteBuildingBlock> getConfigBuildingBlocks(ConfigBuildingBlocksDataObject dataObj)
- throws Exception {
+ throws AAIEntityNotFoundException, VnfcMultipleRelationshipException {
List<ExecuteBuildingBlock> flowsToExecuteConfigs = new ArrayList<>();
List<OrchestrationFlow> result = dataObj.getOrchFlows().stream()
@@ -658,7 +657,7 @@ public class WorkflowAction {
if (volumeGroupFromVfModule.isPresent()) {
String volumeGroupId = volumeGroupFromVfModule.get().getVolumeGroupId();
volumeGroupName = volumeGroupFromVfModule.get().getVolumeGroupName();
- logger.debug("Volume group id of the existing volume group is: " + volumeGroupId);
+ logger.debug("Volume group id of the existing volume group is: {}", volumeGroupId);
volumeGroupExisted = true;
dataObj.getWorkflowResourceIds().setVolumeGroupId(volumeGroupId);
dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
@@ -675,7 +674,7 @@ public class WorkflowAction {
String newVolumeGroupId = UUID.randomUUID().toString();
dataObj.getWorkflowResourceIds().setVolumeGroupId(newVolumeGroupId);
dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
- logger.debug("newVolumeGroupId: " + newVolumeGroupId);
+ logger.debug("newVolumeGroupId: {}", newVolumeGroupId);
}
}
@@ -702,7 +701,7 @@ public class WorkflowAction {
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
for (Pair<WorkflowType, String> pair : aaiResourceIds) {
- logger.debug(pair.getValue0() + ", " + pair.getValue1());
+ logger.debug("{}, {}", pair.getValue0(), pair.getValue1());
}
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
@@ -1324,15 +1323,6 @@ public class WorkflowAction {
return sortedOrchFlows;
}
- private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) {
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName);
- configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
- configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
- configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
- return configurationResourceKeys;
- }
-
protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java
new file mode 100644
index 0000000000..8ef00655f2
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/excpetion/VnfcMultipleRelationshipException.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (c) 2021 Nokia
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.excpetion;
+
+public class VnfcMultipleRelationshipException extends Exception {
+
+ public VnfcMultipleRelationshipException(String vnfcName) {
+ super("Multiple relationships exist from VNFC " + vnfcName + " to Configurations");
+ }
+}