diff options
Diffstat (limited to 'bpmn')
13 files changed, 365 insertions, 167 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index b814d6c595..8d02fa3e4f 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -113,7 +113,17 @@ public class ResourceRequestBuilder { if (resource.getResourceType() == ResourceType.VNF) { for (String eachResource : resourceList) { String resCusUuid = JsonUtils.getJsonValue(eachResource, "resourceCustomizationUuid"); - if ((null != resCusUuid) && resCusUuid.equals(resource.getModelInfo().getModelCustomizationUuid())) { + // in case of external api invocation customizatoin id is coming null + if (resCusUuid == null || resCusUuid.contains("null") || resCusUuid.isEmpty()) { + logger.info("resource resolved using model uuid"); + String uuid = (String) JsonUtils.getJsonValue(eachResource, "resourceUuid"); + if ((null != uuid) && uuid.equals(resource.getModelInfo().getModelUuid())) { + logger.info("found resource uuid" + uuid); + String resourceParameters = JsonUtils.getJsonValue(eachResource, "parameters"); + locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); + } + } else if (resCusUuid.equals(resource.getModelInfo().getModelCustomizationUuid())) { + logger.info("resource resolved using customization-id"); String resourceParameters = JsonUtils.getJsonValue(eachResource, "parameters"); locationConstraints = JsonUtils.getJsonValue(resourceParameters, "locationConstraints"); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index e8e4b85cae..ace6e1937d 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -101,7 +101,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { try { MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables)); processor.startProcess(processKey, variableMap); - WorkflowResponse response = waitForResponse(getRequestId(inputVariables)); + WorkflowResponse response = waitForResponse(inputVariables); return Response.status(202).entity(response).build(); } catch (WorkflowProcessorException e) { WorkflowResponse response = e.getWorkflowResponse(); @@ -112,9 +112,12 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { } } - private WorkflowResponse waitForResponse(String requestId) throws Exception { + private WorkflowResponse waitForResponse(Map<String, Object> inputVariables) throws Exception { + String requestId = getRequestId(inputVariables); long currentWaitTime = 0; - while (DEFAULT_WAIT_TIME > currentWaitTime) { + long waitTime = getWaitTime(inputVariables); + logger.debug("WorkflowAsyncResource.waitForResponse using timeout: " + waitTime); + while (waitTime > currentWaitTime) { Thread.sleep(workflowPollInterval); currentWaitTime = currentWaitTime + workflowPollInterval; WorkflowContext foundContext = contextHolder.getWorkflowContext(requestId); @@ -123,7 +126,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { return buildResponse(foundContext); } } - throw new Exception("TimeOutOccured"); + throw new Exception("TimeOutOccured in WorkflowAsyncResource.waitForResponse for time " + waitTime + "ms"); } private WorkflowResponse buildUnkownError(String requestId, String error) { @@ -171,4 +174,25 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { return inputVariables; } + /** + * Returns the wait time, this is used by the resource on how long it should wait to send a response If none + * specified DEFAULT_WAIT_TIME is used + * + * @param inputVariables + * @return + */ + private long getWaitTime(Map<String, Object> inputVariables) { + String timeout = inputVariables.get("mso-service-request-timeout") == null ? null + : inputVariables.get("mso-service-request-timeout").toString(); + + if (timeout != null) { + try { + return Long.parseLong(timeout) * 1000; + } catch (NumberFormatException nex) { + logger.debug("Invalid input for mso-service-request-timeout"); + } + } + return DEFAULT_WAIT_TIME; + } + } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index 20f3eb4fee..bcc3739c32 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -116,7 +116,7 @@ public class WorkflowResource extends ProcessEngineAwareService { long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000; AtomicLong timeProcessEnded = new AtomicLong(0); boolean endedWithNoResponse = false; - + logger.debug(LOGMARKER + "WorkflowResource.startProcessInstanceByKey using timeout: " + waitTime); while (now <= endTime) { Thread.sleep(pollingInterval); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy index 044f0b462b..8bb48a203b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts +import com.google.gson.JsonObject import org.json.JSONArray import org.json.JSONObject import org.json.XML @@ -93,11 +94,12 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso // set local resourceInput execution.setVariable(Prefix + "ResourceInput", resourceInputObj) + String spPartnerModelName = UrnPropertiesReader.getVariable("sp-partner.modelName") boolean is3rdONAPExist = false - if(inputParameters.has("sppartner_url")) + if(inputParameters.has(spPartnerModelName + "_url")) { - String sppartnerUrl = inputParameters.get("sppartner_url") + String sppartnerUrl = inputParameters.get(spPartnerModelName + "_url") if(!isBlank(sppartnerUrl)) { execution.setVariable(Prefix + "SppartnerUrl", sppartnerUrl) is3rdONAPExist = true @@ -108,9 +110,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso logger.debug(msg) } } - if(inputParameters.has("sppartner_providingServiceUuid")) + if(inputParameters.has(spPartnerModelName + "_providingServiceUuid")) { - String sppartnerUUID= inputParameters.get("sppartner_providingServiceUuid") + String sppartnerUUID= inputParameters.get(spPartnerModelName + "_providingServiceUuid") execution.setVariable(Prefix + "SppartnerUUID", sppartnerUUID) is3rdONAPExist = true } @@ -119,9 +121,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String msg = "sppartner providingServiceUuid is blank." logger.debug(msg) } - if(inputParameters.has("sppartner_providingServiceInvariantUuid")) + if(inputParameters.has(spPartnerModelName + "_providingServiceInvariantUuid")) { - String sppartnerInvarianteUUID = inputParameters.get("sppartner_providingServiceInvariantUuid") + String sppartnerInvarianteUUID = inputParameters.get(spPartnerModelName + "_providingServiceInvariantUuid") execution.setVariable(Prefix + "SppartnerInvarianteUUID", sppartnerInvarianteUUID) is3rdONAPExist = true } @@ -131,9 +133,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso logger.debug(msg) } - if(inputParameters.has("sppartner_handoverMode")) + if(inputParameters.has(spPartnerModelName + "_handoverMode")) { - String handoverMode = inputParameters.get("sppartner_handoverMode") + String handoverMode = inputParameters.get(spPartnerModelName + "_handoverMode") execution.setVariable(Prefix + "HandoverMode", handoverMode) is3rdONAPExist = true } @@ -167,7 +169,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") JSONObject inputParameters = new JSONObject(requestInputs) - execution.setVariable(Prefix + "ServiceParameters", inputParameters) + execution.setVariable(Prefix + "ServiceParameters", inputParameters.toString()) // CallSource is added only when ONAP SO calling 3rdONAP(External API) SO(Remote call) boolean isLocalCall = true @@ -182,7 +184,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } } execution.setVariable(Prefix + "CallSource", callSource) - logger.debug("callSource is: " + callSource ) + logger.info("callSource is: " + callSource ) execution.setVariable("IsLocalCall", isLocalCall) @@ -308,39 +310,39 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso String handoverMode = execution.getVariable(Prefix + "HandoverMode") if("SOTN".equalsIgnoreCase(handoverMode)) { // Put TP Link info into serviceParameters - JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") + JSONObject inputParameters = new JSONObject(execution.getVariable(Prefix + "ServiceParameters")) if(inputParameters.has("remote-access-provider-id")) { Map<String, Object> crossTPs = new HashMap<String, Object>(); - crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id")); - crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id")); - crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id")); - crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id")); - crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id")); - crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id")); - crossTPs.put("remote-access-client-id", inputParameters.get("local-access-client-id")); - crossTPs.put("remote-access-topology-id", inputParameters.get("local-access-topology-id")); - crossTPs.put("remote-access-node-id", inputParameters.get("local-access-node-id")); - crossTPs.put("remote-access-ltp-id", inputParameters.get("local-access-ltp-id")); - - inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")); - inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")); - inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")); - inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id")); - inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); - inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); - inputParameters.put("remote-access-client-id", crossTPs.get("remote-access-client-id")); - inputParameters.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id")); - inputParameters.put("remote-access-node-id", crossTPs.get("remote-access-node-id")); - inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id")); - - execution.setVariable(Prefix + "ServiceParameters", inputParameters) + crossTPs.put("local-access-provider-id", inputParameters.get("remote-access-provider-id")) + crossTPs.put("local-access-client-id", inputParameters.get("remote-access-client-id")) + crossTPs.put("local-access-topology-id", inputParameters.get("remote-access-topology-id")) + crossTPs.put("local-access-node-id", inputParameters.get("remote-access-node-id")) + crossTPs.put("local-access-ltp-id", inputParameters.get("remote-access-ltp-id")) + crossTPs.put("remote-access-provider-id", inputParameters.get("local-access-provider-id")) + crossTPs.put("remote-access-client-id", inputParameters.get("local-access-client-id")) + crossTPs.put("remote-access-topology-id", inputParameters.get("local-access-topology-id")) + crossTPs.put("remote-access-node-id", inputParameters.get("local-access-node-id")) + crossTPs.put("remote-access-ltp-id", inputParameters.get("local-access-ltp-id")) + + inputParameters.put("local-access-provider-id", crossTPs.get("local-access-provider-id")) + inputParameters.put("local-access-client-id", crossTPs.get("local-access-client-id")) + inputParameters.put("local-access-topology-id", crossTPs.get("local-access-topology-id")) + inputParameters.put("local-access-node-id", crossTPs.get("local-access-node-id")) + inputParameters.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")) + inputParameters.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")) + inputParameters.put("remote-access-client-id", crossTPs.get("remote-access-client-id")) + inputParameters.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id")) + inputParameters.put("remote-access-node-id", crossTPs.get("remote-access-node-id")) + inputParameters.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id")) + + execution.setVariable(Prefix + "ServiceParameters", inputParameters.toString()) } else { logger.error("No allocated CrossONAPResource found in ServiceParameters") } } - logger.info("Exit " + allocateCrossONAPResource) + logger.info("Exit allocateCrossONAPResource") } public void prepare3rdONAPRequest(DelegateExecution execution) { @@ -409,7 +411,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso _requestInputs_ += ",\n" + externalAPIUtil.setTemplate(ExternalAPIUtil.RequestInputsTemplate, requestInputsMap) // Transfer all uuiRequest incomeParameters to ExternalAPI format - JSONObject inputParameters = execution.getVariable(Prefix + "ServiceParameters") + JSONObject inputParameters = new JSONObject(execution.getVariable(Prefix + "ServiceParameters")) for(String key : inputParameters.keySet()) { String inputName = key String inputValue = inputParameters.opt(key) @@ -506,7 +508,7 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso } JSONArray items = responseObj.getJSONArray("orderItem") - JSONObject item = items[0] + JSONObject item = items.get(0) JSONObject service = item.get("service") String sppartnerServiceId = service.get("id") if(sppartnerServiceId == null || sppartnerServiceId.equals("null")) { @@ -572,7 +574,9 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso */ public void timeDelay(DelegateExecution execution) { try { + logger.debug("going to sleep for 5 sec") Thread.sleep(5000) + logger.debug("wakeup after 5 sec") } catch(InterruptedException e) { logger.error("Time Delay exception" + e) } @@ -601,6 +605,8 @@ public class Create3rdONAPE2EServiceInstance extends AbstractServiceTaskProcesso AAIResourcesClient client = new AAIResourcesClient() AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SP_PARTNER, sppartnerId) + logger.info("sending request to create sp-partner: " + uri.toString()) + logger.info("requestbody: " + partner) client.create(uri, partner) AAIResourceUri siUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index b0419be7cb..bcd33530b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -276,9 +276,10 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*SOTN-Attachment[\w\s\W]*/ : // fill attachment TP in networkInputParamJson - def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName" - fillAttachmentTPInfo(resourceInputObj, modelName, execution, vpnName) + def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : (StringUtils.containsIgnoreCase(modelName, "SOTN-Attachment") ? "elinesotnattachmentvf0_elinesotnattachmentvfc0_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName") + fillAttachmentTPInfo(resourceInputObj, execution, vpnName) break default: @@ -286,27 +287,36 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { // in case name is different as expected if ("ALLOTTED_RESOURCE".equals(resourceInputObj.getResourceModelInfo().getModelType())) { def vpnName = modelName + "_sotnVpnName" - fillAttachmentTPInfo(resourceInputObj, modelName, execution, vpnName) + fillAttachmentTPInfo(resourceInputObj, execution, vpnName) } break } return resourceInputObj } - private void fillAttachmentTPInfo(ResourceInput resourceInputObj, String modelName, DelegateExecution execution, String vpnName) { - String customer = resourceInputObj.getGlobalSubscriberId() - String serviceType = resourceInputObj.getServiceType() + private void fillAttachmentTPInfo(ResourceInput resourceInputObj, DelegateExecution execution, String vpnName) { String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer, serviceType).queryParam("service-instance-name", parentServiceName) - ServiceInstances sis = client.get(uri).asBean(ServiceInstances.class).get() - logger.debug("Fetched AAI ServiceInstances for the vpnName:" + vpnName + " is " + sis.getServiceInstance().toString()) - ServiceInstance si = sis.getServiceInstance().get(0) - - def parentServiceInstanceId = si.getServiceInstanceId() - execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + logger.info("sending request to resolve vpn-name:" + vpnName) + AAIResourceUri uri = AAIUriFactory.createResourceUri(new AAIObjectPlurals("/nodes", "/service-instances", "queryByName")).queryParam("service-instance-name", parentServiceName) + Optional<ServiceInstances> serviceInstancesOpt = client.get(ServiceInstances.class, uri) + + if(serviceInstancesOpt.isPresent()) { + List<ServiceInstance> serviceInstanceList = serviceInstancesOpt.get().getServiceInstance() + logger.info("response from aai:" + serviceInstanceList.toString()) + if (serviceInstanceList.size() > 0) { + ServiceInstance si = serviceInstanceList.get(0) + String parentServiceInstanceId = si.getServiceInstanceId() + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + logger.info("setting parentService id:" + parentServiceInstanceId) + } else { + logger.error("No service instance found for given name.") + } + } else { + logger.error("No nodes found with this name" + vpnName) + } } /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index d9f9299616..0191439dac 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -584,6 +584,13 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { List<Resource> addResourceList = serviceDecomposition.getServiceResources() execution.setVariable("addResourceList", addResourceList) + boolean isCreateResourceListValid = true + if (addResourceList == null || addResourceList.isEmpty()) { + isCreateResourceListValid = false + } + + execution.setVariable("isCreateResourceListValid", isCreateResourceListValid) + logger.trace("COMPLETED preProcessForAddResource Process ") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java index 9319353e5a..95be6ba7fc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.io.InputStream; import java.net.SocketTimeoutException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -56,6 +57,8 @@ import org.camunda.bpm.engine.runtime.Execution; import org.onap.aai.domain.yang.LogicalLink; import org.onap.aai.domain.yang.LogicalLinks; import org.onap.aai.domain.yang.PInterface; +import org.onap.aai.domain.yang.Pnf; +import org.onap.aai.domain.yang.Relationship; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.bpmn.core.domain.Resource; import org.onap.so.bpmn.core.domain.ServiceDecomposition; @@ -166,8 +169,7 @@ public class ServicePluginFactory { } private boolean isNeedProcessSite(String uuiRequest) { - return uuiRequest.toLowerCase().contains("site_address") - && uuiRequest.toLowerCase().contains("sotncondition_clientsignal"); + return uuiRequest.toLowerCase().contains("address") && uuiRequest.toLowerCase().contains("clientsignal"); } @SuppressWarnings("unchecked") @@ -178,6 +180,7 @@ public class ServicePluginFactory { return true; } String host = (String) tpInfoMap.get("host"); + logger.info("host string from tpinfo:" + host); // host is empty means TP is in local, not empty means TP is in remote ONAP if (!host.isEmpty()) { return false; @@ -191,17 +194,33 @@ public class ServicePluginFactory { accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id")); // change resources + boolean flgResourceFound = false; String resourceName = (String) tpInfoMap.get("resourceName"); for (Object curResource : resources) { Map<String, Object> resource = (Map<String, Object>) curResource; String curResourceName = (String) resource.get("resourceName"); curResourceName = curResourceName.replaceAll(" ", ""); if (resourceName.equalsIgnoreCase(curResourceName)) { + flgResourceFound = true; + logger.info("found match to add site tp info using uui template resource name"); putResourceRequestInputs(resource, accessTPInfo); break; } } + if (!flgResourceFound) { + String attacmentResName = UrnPropertiesReader.getVariable("sp-partner.attachment-resource-name"); + for (Object curResource : resources) { + Map<String, Object> resource = (Map<String, Object>) curResource; + String curResourceName = (String) resource.get("resourceName"); + + if (attacmentResName.equals(curResourceName)) { + logger.info("found match to add site tp info using customized resource name"); + putResourceRequestInputs(resource, accessTPInfo); + } + } + } + return true; } @@ -215,10 +234,10 @@ public class ServicePluginFactory { // logic for R2 uuiRequest params in service level for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) { String key = entry.getKey(); - if (key.toLowerCase().contains("site_address")) { + if (key.toLowerCase().contains("address")) { location = entry.getValue(); } - if (key.toLowerCase().contains("sotncondition_clientsignal")) { + if (key.toLowerCase().contains("clientsignal")) { clientSignal = entry.getValue(); vpnAttachmentResourceName = key.substring(0, key.indexOf("_")); } @@ -242,10 +261,12 @@ public class ServicePluginFactory { tpInfoMap = tpJson; // add resourceName tpInfoMap.put("resourceName", vpnAttachmentResourceName); + logger.info("*** we will try to find resourcename(" + vpnAttachmentResourceName + + ") to add resource input ***"); break; } } - logger.debug("Get Terminal TP from InventoryOSS"); + logger.info("Get Terminal TP from InventoryOSS: " + tpInfoMap); return tpInfoMap; } @@ -330,10 +351,40 @@ public class ServicePluginFactory { return false; } + public static String CUSTOM_RESOURCE_TP = "custom-resource-tp"; + public static String VS_MONITORED = "VS_assured"; + public static String VS_UNMONITORED = "VS_besteffort"; + public static String TS_MONITORED = "TS1"; + public static String TS_UNMONITORED = "TS2"; + public static String CUSTOM_TP_LIST[] = new String[] {VS_MONITORED, VS_UNMONITORED, TS_MONITORED, TS_UNMONITORED}; + + private void customizeTP(Map<String, Object> crossTps, String svcName, DelegateExecution execution) { + Optional<String> customType = Arrays.stream(CUSTOM_TP_LIST).filter(svcName::contains).findFirst(); + if (customType.isPresent()) { + logger.info("customizing TP"); + String localTPs = UrnPropertiesReader.getVariable(CUSTOM_RESOURCE_TP + "." + customType.get() + ".local"); + String remoteTPs = UrnPropertiesReader.getVariable(CUSTOM_RESOURCE_TP + "." + customType.get() + ".remote"); + + String localTP = (String) crossTps.get("local-access-ltp-id"); + String remoteTP = (String) crossTps.get("remote-access-ltp-id"); + + if (localTPs.contains(localTP) && remoteTPs.contains(remoteTP)) { + logger.info("using same tp returned from AAI"); + return; + } + + crossTps.put("local-access-ltp-id", localTPs.split(",")[0]); + crossTps.put("remote-access-ltp-id", remoteTPs.split(",")[0]); + } + logger.info("cross TP info:" + crossTps); + } + @SuppressWarnings("unchecked") private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) { - Map<String, Object> crossTPs = this.getTPsfromAAI(); + String serviceName = (String) execution.getVariable("serviceInstanceName"); + Map<String, Object> crossTPs = this.getTPsfromAAI(serviceName); + // customizeTP(crossTPs, serviceName, execution); if (crossTPs == null || crossTPs.isEmpty()) { serviceRequestInputs.put("local-access-provider-id", ""); @@ -353,17 +404,45 @@ public class ServicePluginFactory { serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id")); serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id")); serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id")); - serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id")); - serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id")); - serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id")); - serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id")); + serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-access-client-id")); + serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-access-topology-id")); + serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-access-node-id")); + serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-access-ltp-id")); } return; } + private LogicalLink selectLogicalLink(List<LogicalLink> logicalLinks, String svcName) { + Optional<String> customType = Arrays.stream(CUSTOM_TP_LIST).filter(svcName::contains).findFirst(); + if (customType.isPresent()) { + + String[] allowedList = + UrnPropertiesReader.getVariable(CUSTOM_RESOURCE_TP + "." + customType.get() + ".local").split(","); + + for (String localTp : allowedList) { + for (LogicalLink link : logicalLinks) { + for (Relationship relationship : link.getRelationshipList().getRelationship()) { + if (relationship.getRelatedTo().equals("p-interface") + && relationship.getRelatedLink().contains("-ltpId-" + localTp) + && link.getOperationalStatus().equalsIgnoreCase("up")) { + logger.info("linkname:" + link.getLinkName() + " is matching with allowed list"); + return link; + } + } + } + } + + logger.error("There is no matching logical link for allowed list :" + allowedList.toString()); + return null; + } else { + logger.info("link customization is not required"); + return logicalLinks.get(0); + } + } + // This method returns Local and remote TPs information from AAI - public Map getTPsfromAAI() { + public Map getTPsfromAAI(String serviceName) { Map<String, Object> tpInfo = new HashMap<>(); AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.LOGICAL_LINK); @@ -372,11 +451,11 @@ public class ServicePluginFactory { if (result.isPresent()) { LogicalLinks links = result.get(); - boolean isRemoteLink = false; + LogicalLink link = selectLogicalLink(links.getLogicalLink(), serviceName); - links.getLogicalLink(); - - for (LogicalLink link : links.getLogicalLink()) { + if (link != null) { + boolean isRemoteLink = false; + logger.info("processing link :" + link.getLinkName()); AAIResultWrapper wrapper = new AAIResultWrapper(link); Optional<Relationships> optRelationships = wrapper.getRelationships(); List<AAIResourceUri> pInterfaces = new ArrayList<>(); @@ -386,57 +465,85 @@ public class ServicePluginFactory { isRemoteLink = true; } pInterfaces.addAll(relationships.getRelatedAAIUris(AAIObjectType.P_INTERFACE)); - } - - if (isRemoteLink) { - // find remote p interface - AAIResourceUri localTP = null; - AAIResourceUri remoteTP = null; - - AAIResourceUri pInterface0 = pInterfaces.get(0); - - if (isRemotePInterface(client, pInterface0)) { - remoteTP = pInterfaces.get(0); - localTP = pInterfaces.get(1); - } else { - localTP = pInterfaces.get(0); - remoteTP = pInterfaces.get(1); - } - - if (localTP != null && remoteTP != null) { - // give local tp - String tpUrl = localTP.build().toString(); - PInterface intfLocal = client.get(PInterface.class, localTP).get(); - tpInfo.put("local-access-node-id", tpUrl.split("/")[6]); - - String[] networkRef = intfLocal.getNetworkRef().split("/"); - if (networkRef.length == 6) { - tpInfo.put("local-access-provider-id", networkRef[1]); - tpInfo.put("local-access-client-id", networkRef[3]); - tpInfo.put("local-access-topology-id", networkRef[5]); - } - String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); - if (ltpIdStr.contains("-")) { - tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1)); + if (isRemoteLink) { + // find remote p interface + AAIResourceUri localTP = null; + AAIResourceUri remoteTP = null; + + AAIResourceUri pInterface0 = pInterfaces.get(0); + + if (isRemotePInterface(client, pInterface0)) { + remoteTP = pInterfaces.get(0); + localTP = pInterfaces.get(1); + } else { + localTP = pInterfaces.get(0); + remoteTP = pInterfaces.get(1); } - // give remote tp - tpUrl = remoteTP.build().toString(); - PInterface intfRemote = client.get(PInterface.class, remoteTP).get(); - tpInfo.put("remote-access-node-id", tpUrl.split("/")[6]); - - String[] networkRefRemote = intfRemote.getNetworkRef().split("/"); - - if (networkRefRemote.length == 6) { - tpInfo.put("remote-access-provider-id", networkRefRemote[1]); - tpInfo.put("remote-access-client-id", networkRefRemote[3]); - tpInfo.put("remote-access-topology-id", networkRefRemote[5]); + if (localTP != null && remoteTP != null) { + // give local tp + String tpUrl = localTP.build().toString(); + String localNodeId = tpUrl.split("/")[4]; + tpInfo.put("local-access-node-id", localNodeId); + + logger.info("Get info for local TP :" + localNodeId); + Optional<Pnf> optLocalPnf = client.get(Pnf.class, + AAIUriFactory.createResourceUri(AAIObjectType.PNF, localNodeId)); + + if (optLocalPnf.isPresent()) { + Pnf localPnf = optLocalPnf.get(); + + for (Relationship rel : localPnf.getRelationshipList().getRelationship()) { + if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) { + String[] networkRef = rel.getRelatedLink() + .substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-"); + if (networkRef.length == 6) { + tpInfo.put("local-access-provider-id", networkRef[1]); + tpInfo.put("local-access-client-id", networkRef[3]); + tpInfo.put("local-access-topology-id", networkRef[5]); + } + } + } + } + String ltpIdStr = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); + if (ltpIdStr.contains("-")) { + tpInfo.put("local-access-ltp-id", ltpIdStr.substring(ltpIdStr.lastIndexOf("-") + 1)); + } + + // give remote tp + tpUrl = remoteTP.build().toString(); + PInterface intfRemote = client.get(PInterface.class, remoteTP).get(); + + String remoteNodeId = tpUrl.split("/")[4]; + tpInfo.put("remote-access-node-id", remoteNodeId); + + logger.info("Get info for remote TP:" + remoteNodeId); + + String[] networkRefRemote = intfRemote.getNetworkRef().split("-"); + Optional<Pnf> optRemotePnf = client.get(Pnf.class, + AAIUriFactory.createResourceUri(AAIObjectType.PNF, remoteNodeId)); + + if (optRemotePnf.isPresent()) { + Pnf remotePnf = optRemotePnf.get(); + + for (Relationship rel : remotePnf.getRelationshipList().getRelationship()) { + if (rel.getRelatedTo().equalsIgnoreCase("network-resource")) { + String[] networkRef = rel.getRelatedLink() + .substring(rel.getRelatedLink().lastIndexOf("/") + 1).split("-"); + if (networkRef.length == 6) { + tpInfo.put("remote-access-provider-id", networkRefRemote[1]); + tpInfo.put("remote-access-client-id", networkRefRemote[3]); + tpInfo.put("remote-access-topology-id", networkRefRemote[5]); + } + } + } + } + + String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); + if (ltpIdStrR.contains("-")) { + tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1)); + } } - String ltpIdStrR = tpUrl.substring(tpUrl.lastIndexOf("/") + 1); - if (ltpIdStrR.contains("-")) { - tpInfo.put("remote-access-ltp-id", ltpIdStrR.substring(ltpIdStr.lastIndexOf("-") + 1)); - } - return tpInfo; } } } @@ -811,5 +918,4 @@ public class ServicePluginFactory { } } } - } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java index 1a75f125f6..6b310773b1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java @@ -110,7 +110,7 @@ public class ServicePluginFactoryTest { @Test public void doTPResourcesAllocation_Success() { - doReturn(null).when(servicePluginFactory).getTPsfromAAI(); + doReturn(null).when(servicePluginFactory).getTPsfromAAI("test"); String result = servicePluginFactory.doTPResourcesAllocation(null, uuiRequest); Assert.assertNotEquals(result, uuiRequest); } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn index cfcd259d7c..082860dd65 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.0"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0"> <bpmn:process id="DeActivateSDNCNetworkResource" name="DeActivateSDNCNetworkResource" isExecutable="true"> <bpmn:startEvent id="deleteNetworkResource_StartEvent_deactivate" name="deleteNetworkResource_StartEvent"> <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> @@ -14,9 +14,9 @@ def dcsi = new DeActivateSDNCNetworkResource() dcsi.prepareSDNCRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:endEvent id="EndEvent_1x6k78c_deactivate" name="delete SDNC call end"> - <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred_deactivate" targetRef="ScriptTask_1emjxm2_deactivate" /> + <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred_deactivate" targetRef="EndEvent_1x6k78c_deactivate" /> <bpmn:scriptTask id="Task_023hred_deactivate" name="post SDNC deactivate call"> <bpmn:incoming>SequenceFlow_13gl3wv</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing> @@ -39,14 +39,6 @@ dcsi.preProcessRequest(execution)</bpmn:script> def dcsi = new DeActivateSDNCNetworkResource() dcsi.prepareUpdateAfterDeActivateSDNCResource(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_1emjxm2_deactivate" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new DeActivateSDNCNetworkResource() -csi.sendSyncResponse(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2_deactivate" targetRef="EndEvent_1x6k78c_deactivate" /> <bpmn:sequenceFlow id="SequenceFlow_1fjtgq7" sourceRef="PreprocessIncomingRequest_deactivate" targetRef="Task_0n0lj30_deactivate" /> <bpmn:callActivity id="Task_0n0lj30_deactivate" name="Call SDNC Adapter V1" calledElement="SDNCAdapterRestV1"> <bpmn:incoming>SequenceFlow_1fjtgq7</bpmn:incoming> @@ -98,85 +90,75 @@ csi.sendSyncResponse(execution)</bpmn:script> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeActivateSDNCNetworkResource"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent_deactivate"> - <dc:Bounds x="-111" y="111" width="36" height="36" /> + <dc:Bounds x="180" y="111" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-135" y="147" width="88" height="40" /> + <dc:Bounds x="156" y="147" width="88" height="40" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> - <di:waypoint x="-75" y="129" /> - <di:waypoint x="5" y="129" /> + <di:waypoint x="216" y="129" /> + <di:waypoint x="296" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="-87.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_deactivate"> - <dc:Bounds x="178" y="89" width="100" height="80" /> + <dc:Bounds x="469" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c_deactivate"> - <dc:Bounds x="964" y="327" width="36" height="36" /> + <dc:Bounds x="1255" y="327" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="928" y="369" width="84" height="27" /> + <dc:Bounds x="1219" y="369" width="84" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0"> - <di:waypoint x="735" y="345" /> - <di:waypoint x="795" y="345" /> + <di:waypoint x="1026" y="345" /> + <di:waypoint x="1255" y="345" /> <bpmndi:BPMNLabel> <dc:Bounds x="719" y="314" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred_deactivate"> - <dc:Bounds x="635" y="305" width="100" height="80" /> + <dc:Bounds x="926" y="305" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb"> - <di:waypoint x="105" y="129" /> - <di:waypoint x="178" y="129" /> + <di:waypoint x="396" y="129" /> + <di:waypoint x="469" y="129" /> <bpmndi:BPMNLabel> <dc:Bounds x="235.5" y="108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp_deactivate"> - <dc:Bounds x="5" y="89" width="100" height="80" /> + <dc:Bounds x="296" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4_deactivate"> - <dc:Bounds x="333" y="305" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2_deactivate"> - <dc:Bounds x="795" y="305" width="100" height="80" /> + <dc:Bounds x="624" y="305" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a"> - <di:waypoint x="895" y="345" /> - <di:waypoint x="964" y="345" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="930" y="313" width="0" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1fjtgq7_di" bpmnElement="SequenceFlow_1fjtgq7"> <di:waypoint x="278" y="129" /> <di:waypoint x="333" y="129" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1pzm7qx_di" bpmnElement="SequenceFlow_1pzm7qx"> - <di:waypoint x="433" y="345" /> - <di:waypoint x="487" y="345" /> + <di:waypoint x="724" y="345" /> + <di:waypoint x="778" y="345" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0k4fp1d_di" bpmnElement="Task_1a6f0p9_deactivate"> - <dc:Bounds x="487" y="305" width="100" height="80" /> + <dc:Bounds x="778" y="305" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_13gl3wv_di" bpmnElement="SequenceFlow_13gl3wv"> - <di:waypoint x="587" y="345" /> - <di:waypoint x="635" y="345" /> + <di:waypoint x="878" y="345" /> + <di:waypoint x="926" y="345" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0a0txik_di" bpmnElement="CallActivity_0a0txik_DeActivate"> - <dc:Bounds x="333" y="89" width="100" height="80" /> + <dc:Bounds x="624" y="89" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0rn8vky_di" bpmnElement="SequenceFlow_0rn8vky"> - <di:waypoint x="383" y="169" /> - <di:waypoint x="383" y="305" /> + <di:waypoint x="674" y="169" /> + <di:waypoint x="674" y="305" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0nmt8ph_di" bpmnElement="SequenceFlow_0nmt8ph"> - <di:waypoint x="278" y="129" /> - <di:waypoint x="333" y="129" /> + <di:waypoint x="569" y="129" /> + <di:waypoint x="624" y="129" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java index 376a27e830..4cde9c1fc8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListener.java @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners; import java.util.Collections; import java.util.List; +import java.util.Optional; import org.onap.so.bpmn.common.BBConstants; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.common.listener.db.PostCompletionRequestsDbListener; @@ -55,7 +56,7 @@ public class MultiStageSkipListener implements FlowManipulator, PostCompletionRe @Override public boolean shouldRunFor(BuildingBlockExecution execution) { - return (boolean) execution.getVariable(G_MULTI_STAGE_DESIGN); + return (boolean) Optional.ofNullable(execution.getVariable(G_MULTI_STAGE_DESIGN)).orElse(false); } @Override diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java index 0a825b8424..62d6a110f6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java @@ -39,12 +39,33 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +/** + * This class is used for creating and deleting the request for VfModule. + * + */ @Component public class VnfAdapterVfModuleResources { @Autowired private VnfAdapterVfModuleObjectMapper vnfAdapterVfModuleObjectMapper; + /** + * This method is used for creating the request for the VfModule. + * + * This method take these parameter and call the VnfAdapterVfModuleObjectMapper to create the request. + * + * @param requestContext + * @param cloudRegion + * @param orchestrationContext + * @param serviceInstance + * @param genericVnf + * @param vfModule + * @param volumeGroup + * @param sdncVnfQueryResponse + * @param sdncVfModuleQueryResponse + * @throws IOException & MissingValueTagException + * @return + */ public CreateVfModuleRequest createVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule, VolumeGroup volumeGroup, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) @@ -54,6 +75,19 @@ public class VnfAdapterVfModuleResources { sdncVfModuleQueryResponse); } + /** + * This method is used for delete the request for the VfModule. + * + * This method take these parameter and call the VnfAdapterVfModuleObjectMapper to delete the request. + * + * @param requestContext + * @param cloudRegion + * @param serviceInstance + * @param genericVnf + * @param vfModule + * @throws IOException + * @return + */ public DeleteVfModuleRequest deleteVfModuleRequest(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, GenericVnf genericVnf, VfModule vfModule) throws IOException { return vnfAdapterVfModuleObjectMapper.deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java index bef4ec3465..fd0af3a4dd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java @@ -55,6 +55,22 @@ public class VnfTopologyOperationRequestMapper { @Autowired private GeneralTopologyObjectMapper generalTopologyObjectMapper; + /** + * This method is used for creating the vnf request. + * + * By these parameter it will get he detailas and prepare the request. + * + * @param svcOperation + * @param svcAction + * @param requestAction + * @param vnf + * @param serviceInstance + * @param customer + * @param cloudRegion + * @param requestContext + * @param homing + * @return request + */ public GenericResourceApiVnfOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration requestAction, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, boolean homing, diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java index 9e2eac416c..82d610fa97 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java @@ -77,6 +77,8 @@ public class MultiStageSkipListenerTest { execution.setVariable("multiStageDesign", false); assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution)); + execution.setVariable("multiStageDesign", null); + assertFalse("should not be triggered", multiStageSkipListener.shouldRunFor(execution)); } |