diff options
Diffstat (limited to 'bpmn')
12 files changed, 371 insertions, 359 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java index 33c48fbe44..91049a8d0c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/recipe/ResourceInput.java @@ -21,6 +21,7 @@ */ package org.onap.so.bpmn.common.recipe; +import java.io.Serializable; import org.onap.so.bpmn.core.domain.ModelInfo; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonPropertyOrder; @@ -43,7 +44,7 @@ import org.slf4j.LoggerFactory; "operationId", "serviceModelInfo", "resourceModelInfo", "resourceInstancenUuid", "resourceParameters", "operationType"}) @JsonRootName("variables") -public class ResourceInput { +public class ResourceInput implements Serializable { private static Logger logger = LoggerFactory.getLogger(ResourceInput.class); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index dabfc81e1f..870b936f5c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -153,65 +153,67 @@ public class ExceptionBuilder { } public void processAuditException(DelegateExecutionImpl execution, boolean flowShouldContinue) { - logger.info("Building a WorkflowException for Subflow"); + logger.debug("Processing Audit Results"); + String auditListString = (String) execution.getVariable("auditInventoryResult"); + if (auditListString != null) { + StringBuilder errorMessage = new StringBuilder(); + String processKey = getProcessKey(execution.getDelegateExecution()); + try { + ExtractPojosForBB extractPojosForBB = getExtractPojosForBB(); + VfModule module = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + String cloudRegionId = execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId(); + + GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); + AAIObjectAuditList auditList = + objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class); + + errorMessage = errorMessage.append(auditList.getAuditType() + " VF-Module " + module.getVfModuleId() + + " failed due to incomplete AAI vserver inventory population after stack " + + auditList.getHeatStackName() + " was successfully " + auditList.getAuditType() + + "d in cloud region " + cloudRegionId + ". MSO Audit indicates that the following was not " + + auditList.getAuditType() + "d in AAI: "); + + Stream<AAIObjectAudit> vServerLInterfaceAuditStream = auditList.getAuditList().stream() + .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName()) + || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())); + List<AAIObjectAudit> filteredAuditStream = + vServerLInterfaceAuditStream.filter(a -> !a.isDoesObjectExist()).collect(Collectors.toList()); + + for (AAIObjectAudit object : filteredAuditStream) { + if (object.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())) { + LInterface li = objectMapper.getMapper().convertValue(object.getAaiObject(), LInterface.class); + errorMessage = errorMessage + .append(AAIObjectType.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", "); + } else { + Vserver vs = objectMapper.getMapper().convertValue(object.getAaiObject(), Vserver.class); + errorMessage = + errorMessage.append(AAIObjectType.VSERVER.typeName() + " " + vs.getVserverId() + ", "); + } + } - StringBuilder errorMessage = new StringBuilder(); - String processKey = getProcessKey(execution.getDelegateExecution()); - try { - ExtractPojosForBB extractPojosForBB = getExtractPojosForBB(); - VfModule module = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - String cloudRegionId = execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId(); - - GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider(); - String auditListString = (String) execution.getVariable("auditInventoryResult"); - AAIObjectAuditList auditList = - objectMapper.getMapper().readValue(auditListString, AAIObjectAuditList.class); - - errorMessage = errorMessage.append(auditList.getAuditType() + " VF-Module " + module.getVfModuleId() - + " failed due to incomplete A&AI vserver inventory population after stack " - + auditList.getHeatStackName() + " was successfully " + auditList.getAuditType() - + "d in cloud region " + cloudRegionId + ". MSO Audit indicates that AIC RO did not " - + auditList.getAuditType() + " "); - - Stream<AAIObjectAudit> vServerLInterfaceAuditStream = auditList.getAuditList().stream() - .filter(auditObject -> auditObject.getAaiObjectType().equals(AAIObjectType.VSERVER.typeName()) - || auditObject.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())); - List<AAIObjectAudit> filteredAuditStream = - vServerLInterfaceAuditStream.filter(a -> !a.isDoesObjectExist()).collect(Collectors.toList()); - - for (AAIObjectAudit object : filteredAuditStream) { - if (object.getAaiObjectType().equals(AAIObjectType.L_INTERFACE.typeName())) { - LInterface li = objectMapper.getMapper().convertValue(object.getAaiObject(), LInterface.class); - errorMessage = errorMessage - .append(AAIObjectType.L_INTERFACE.typeName() + " " + li.getInterfaceId() + ", "); - } else { - Vserver vs = objectMapper.getMapper().convertValue(object.getAaiObject(), Vserver.class); - errorMessage = - errorMessage.append(AAIObjectType.VSERVER.typeName() + " " + vs.getVserverId() + ", "); + if (errorMessage.length() > 0) { + errorMessage.setLength(errorMessage.length() - 2); + errorMessage = errorMessage.append("."); } - } - if (errorMessage.length() > 0) { - errorMessage.setLength(errorMessage.length() - 2); - errorMessage = errorMessage.append(" in AAI. "); + } catch (IOException | BBObjectNotFoundException e) { + errorMessage = errorMessage.append("process objects in AAI. "); } - } catch (IOException | BBObjectNotFoundException e) { - errorMessage = errorMessage.append("process objects in AAI. "); - } - - errorMessage.append( - "Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops."); + if (flowShouldContinue) { + execution.setVariable("StatusMessage", errorMessage.toString()); + } else { + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString()); + execution.setVariable("WorkflowException", exception); + execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); + logger.info("Outgoing WorkflowException is {}", exception); + logger.info("Throwing MSOWorkflowException"); + throw new BpmnError("AAIInventoryFailure"); + } - if (flowShouldContinue) { - execution.setVariable("StatusMessage", errorMessage.toString()); } else { - WorkflowException exception = new WorkflowException(processKey, 400, errorMessage.toString()); - execution.setVariable("WorkflowException", exception); - execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); - logger.info("Outgoing WorkflowException is {}", exception); - logger.info("Throwing MSOWorkflowException"); - throw new BpmnError("AAIInventoryFailure"); + logger.debug("Unable to process audit results due to auditInventoryResult being null"); } } + } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java index 549f16b6f6..5f9aef67e6 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderTest.java @@ -138,7 +138,7 @@ public class ExceptionBuilderTest extends BaseTest { WorkflowException we = execution.getVariable("WorkflowException"); assertNotNull(we); assertEquals( - "create VF-Module testVfModuleId1 failed due to incomplete A&AI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that AIC RO did not create vserver testVServerId in AAI. Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops.", + "create VF-Module testVfModuleId1 failed due to incomplete AAI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that the following was not created in AAI: vserver testVServerId.", we.getErrorMessage()); } } @@ -151,7 +151,7 @@ public class ExceptionBuilderTest extends BaseTest { String sm = execution.getVariable("StatusMessage"); assertNotNull(sm); assertEquals( - "create VF-Module testVfModuleId1 failed due to incomplete A&AI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that AIC RO did not create vserver testVServerId in AAI. Recommendation - Wait for nightly RO Audit to run and fix the data issue and resume vf-module creation in VID. If problem persists then report problem to AIC/RO Ops.", + "create VF-Module testVfModuleId1 failed due to incomplete AAI vserver inventory population after stack testStackName was successfully created in cloud region testLcpCloudRegionId. MSO Audit indicates that the following was not created in AAI: vserver testVServerId.", sm); } catch (BpmnError bpmnException) { fail(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 20134a77a9..714348e535 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -152,6 +152,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { logger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } + logger.info(" ***** Exit preProcessRequest *****") } /** @@ -174,6 +175,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") + String resourceInput = execution.getVariable(Prefix + "resourceInput") + logger.info("The resourceInput is: " + resourceInput) ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() @@ -373,6 +376,8 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) { + logger.debug(" *** prepareUpdateBeforeDeleteSDNCResource *** ") + String resourceInput = execution.getVariable(Prefix + "resourceInput"); ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -402,10 +407,13 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </soapenv:Envelope>"""; setProgressUpdateVariables(execution, body) + logger.debug(" ***** Exit prepareUpdateBeforeDeleteSDNCResource *****") } public void prepareUpdateAfterDeleteSDNCResource(DelegateExecution execution) { + logger.debug(" *** prepareUpdateAfterDeleteSDNCResource *** ") + String resourceInput = execution.getVariable(Prefix + "resourceInput"); ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() @@ -435,15 +443,16 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { </soapenv:Envelope>"""; setProgressUpdateVariables(execution, body) + logger.debug(" ***** Exit prepareUpdateAfterDeleteSDNCResource *****") } public void postDeleteSDNCCall(DelegateExecution execution){ - logger.info(" ***** Started prepareSDNCRequest *****") + logger.info(" ***** Started postDeleteSDNCCall *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - logger.info(" ***** Exit prepareSDNCRequest *****") + logger.info(" ***** Exit postDeleteSDNCCall *****") } public void sendSyncResponse (DelegateExecution execution) { diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index f2af481f66..305e4f3f1c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -28,27 +28,32 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONArray import org.json.JSONObject +import org.onap.aai.domain.yang.RelatedToProperty +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipData +import org.onap.aai.domain.yang.ServiceInstance import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.domain.Resource import org.onap.so.bpmn.core.domain.ServiceDecomposition import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.utils.TargetEntity import org.springframework.web.util.UriUtils -import org.w3c.dom.Document -import org.w3c.dom.Node -import org.xml.sax.InputSource +import javax.ws.rs.NotFoundException import javax.ws.rs.core.Response -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory + import static org.apache.commons.lang3.StringUtils.isBlank @@ -113,7 +118,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) + String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" logger.info(msg) @@ -161,80 +166,48 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String msg = "" try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") - String serviceType = "" - - if(foundInAAI){ + String serviceInstanceId = execution.getVariable('serviceInstanceId') + String globalSubscriberId = execution.getVariable('globalSubscriberId') + String serviceType = execution.getVariable('serviceType') + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId) + if (!resourceClient.exists(serviceInstanceUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") + } + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + // found in AAI + if (si.isPresent() && StringUtils.isNotEmpty(si.get().getServiceInstanceName())) { logger.debug("Found Service-instance in AAI") - - String siData = execution.getVariable("GENGS_service") - logger.debug("SI Data") - if (isBlank(siData)) - { - msg = "Could not retrive ServiceInstance data from AAI to delete id:" + serviceInstanceId - logger.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - else - { - InputSource source = new InputSource(new StringReader(siData)); - DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder = docFactory.newDocumentBuilder() - Document serviceXml = docBuilder.parse(source) - serviceXml.getDocumentElement().normalize() - // get model invariant id - // Get Template uuid and version - if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { - logger.debug("SI Data model-invariant-id and model-version-id exist") - def modelInvariantId = serviceXml.getElementsByTagName("model-invariant-id").item(0).getTextContent() - def modelVersionId = serviceXml.getElementsByTagName("model-version-id").item(0).getTextContent() - - // Set Original Template info - execution.setVariable("model-invariant-id-original", modelInvariantId) - execution.setVariable("model-version-id-original", modelVersionId) - } - - logger.debug("SI Data" + siData) - //Confirm there are no related service instances (vnf/network or volume) - if (utils.nodeExists(siData, "relationship-list")) { - logger.debug("SI Data relationship-list exists") - JSONArray jArray = new JSONArray() - - XmlParser xmlParser = new XmlParser() - Node root = xmlParser.parseText(siData) - def relation_list = utils.getChildNode(root, 'relationship-list') - def relationships = utils.getIdenticalChildren(relation_list, 'relationship') - - for (def relation: relationships) { - def jObj = getRelationShipData(relation, isDebugEnabled) - jArray.put(jObj) - } - - execution.setVariable("serviceRelationShip", jArray.toString()) - execution.setVariable("serviceRelationShip", jArray.toString()) - } + execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName()) + // get model invariant id + // Get Template uuid and version + if ((null != si.get().getModelInvariantId()) && (null != si.get().getModelVersionId())) { + logger.debug("SI Data model-invariant-id and model-version-id exist") + // Set Original Template info + execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId()) + execution.setVariable("model-version-id-original", si.get().getModelVersionId()) } - }else{ - boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") - if(!succInAAI){ - logger.debug("Error getting Service-instance from AAI :" + serviceInstanceId) - WorkflowException workflowException = execution.getVariable("WorkflowException") - if(workflowException != null){ - logger.error("workflowException: " + workflowException) - exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) - } - else { - msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI - logger.error(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + if ((null != si.get().getRelationshipList()) && (null != si.get().getRelationshipList().getRelationship())) { + logger.debug("SI Data relationship-list exists") + List<Relationship> relationshipList = si.get().getRelationshipList().getRelationship() + JSONArray jArray = new JSONArray() + for (Relationship relationship : relationshipList) { + def jObj = getRelationShipData(relationship) + jArray.put(jObj) } + execution.setVariable("serviceRelationShip", jArray.toString()) } - - logger.debug("Service-instance NOT found in AAI. Silent Success") + } else { + msg = "Service-instance: " + serviceInstanceId + " NOT found in AAI." + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) } - }catch (BpmnError e) { + } catch (BpmnError e) { throw e + } catch (NotFoundException e) { + logger.debug("Service Instance does not exist AAI") + exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance was not found in aai") } catch (Exception ex) { msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() logger.debug(msg) @@ -243,50 +216,42 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { logger.debug(" *** Exit postProcessAAIGET *** ") } - private JSONObject getRelationShipData(node, isDebugEnabled){ - JSONObject jObj = new JSONObject() - - def relation = utils.nodeToString(node) - def rt = utils.getNodeText(relation, "related-to") - - def rl = utils.getNodeText(relation, "related-link") - logger.debug("ServiceInstance Related NS/Configuration :" + rl) - - def rl_datas = utils.getIdenticalChildren(node, "relationship-data") - for(def rl_data : rl_datas) { - def eKey = utils.getChildNodeText(rl_data, "relationship-key") - def eValue = utils.getChildNodeText(rl_data, "relationship-value") - - if ((rt == "service-instance" && eKey.equals("service-instance.service-instance-id")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-id") - )){ - jObj.put("resourceInstanceId", eValue) - } - // for sp-partner and others - else if(eKey.endsWith("-id")){ - jObj.put("resourceInstanceId", eValue) - String resourceName = rt + eValue; - jObj.put("resourceType", resourceName) - } - - jObj.put("resourceLinkUrl", rl) - } - - def rl_props = utils.getIdenticalChildren(node, "related-to-property") - for(def rl_prop : rl_props) { - def eKey = utils.getChildNodeText(rl_prop, "property-key") - def eValue = utils.getChildNodeText(rl_prop, "property-value") - if((rt == "service-instance" && eKey.equals("service-instance.service-instance-name")) - //for overlay/underlay - || (rt == "configuration" && eKey.equals("configuration.configuration-type"))){ - jObj.put("resourceType", eValue) - } - } - - logger.debug("Relationship related to Resource:" + jObj.toString()) - return jObj - } + private JSONObject getRelationShipData(Relationship relationship) { + JSONObject jObj = new JSONObject() + def rt = relationship.getRelatedTo() + def rl = relationship.getRelatedLink() + logger.debug("ServiceInstance Related NS/Configuration :" + rl) + List<RelationshipData> rl_datas = relationship.getRelationshipData() + for (RelationshipData rl_data : rl_datas) { + def eKey = rl_data.getRelationshipKey() + def eValue = rl_data.getRelationshipValue() + if ((rt.equals("service-instance") && eKey.equals("service-instance.service-instance-id")) + //for overlay/underlay + || (rt.equals("configuration") && eKey.equals("configuration.configuration-id") + )) { + jObj.put("resourceInstanceId", eValue) + } + // for sp-partner and others + else if (eKey.endsWith("-id")) { + jObj.put("resourceInstanceId", eValue) + String resourceName = rt + eValue; + jObj.put("resourceType", resourceName) + } + jObj.put("resourceLinkUrl", rl) + } + List<RelatedToProperty> rl_props = relationship.getRelatedToProperty() + for (RelatedToProperty rl_prop : rl_props) { + def eKey = rl_prop.getPropertyKey() + def eValue = rl_prop.getPropertyValue() + if ((rt.equals("service-instance") && eKey.equals("service-instance.service-instance-name")) + //for overlay/underlay + || (rt.equals("configuration") && eKey.equals("configuration.configuration-type"))) { + jObj.put("resourceType", eValue) + } + } + logger.debug("Relationship related to Resource:" + jObj.toString()) + return jObj + } public void getCurrentNS(DelegateExecution execution){ logger.info( "======== Start getCurrentNS Process ======== ") @@ -392,7 +357,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { } public void postDecomposeService(DelegateExecution execution) { - logger.debug(" ***** Inside processDecomposition() of delete generic e2e service flow ***** ") + logger.debug(" ***** Inside postDecomposeService() of delete generic e2e service flow ***** ") try { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") @@ -452,7 +417,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { logger.error(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - logger.debug( " ***** exit processDecomposition() of delete generic e2e service flow ***** ") + logger.debug(" ***** exit postDecomposeService() of delete generic e2e service flow ***** ") } public void preInitResourcesOperStatus(DelegateExecution execution){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 7e194657fb..616c654a6e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -102,7 +102,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } - String sdncCallbackUrl = UrnPropertiesReader.getVariable('URN_mso_workflow_sdncadapter_callback', execution) + String sdncCallbackUrl = UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback', execution) if (isBlank(sdncCallbackUrl)) { msg = "URN_mso_workflow_sdncadapter_callback is null" logger.error(msg) @@ -235,45 +235,47 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { */ public void executeResourceDelete(DelegateExecution execution) { logger.debug("======== Start executeResourceDelete Process ======== ") - try { - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - - String resourceInstanceId = execution.getVariable("resourceInstanceId") - - Resource currentResource = execution.getVariable("currentResource") - String action = "deleteInstance" - JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) - String recipeUri = resourceRecipe.getString("orchestrationUri") - int recipeTimeout = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - - - ResourceInput resourceInput = new ResourceInput(); - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) - resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) - resourceInput.setOperationId(execution.getVariable("operationId")) - resourceInput.setOperationType(execution.getVariable("operationType")) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setResourceModelInfo(currentResource.getModelInfo()); - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); - resourceInput.setServiceType(serviceType) - - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri - - HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - logger.debug(" ======== END executeResourceDelete Process ======== ") - }catch(BpmnError b){ - logger.error("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog") - } + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + + String resourceInstanceId = execution.getVariable("resourceInstanceId") + + Resource currentResource = execution.getVariable("currentResource") + String action = "deleteInstance" + JSONObject resourceRecipe = catalogDbUtils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) + String recipeUri = resourceRecipe.getString("orchestrationUri") + int recipeTimeout = resourceRecipe.getInt("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + + + ResourceInput resourceInput = new ResourceInput(); + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) + resourceInput.setResourceInstancenUuid(currentResource.getResourceId()) + resourceInput.setOperationId(execution.getVariable("operationId")) + resourceInput.setOperationType(execution.getVariable("operationType")) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); + resourceInput.setServiceType(serviceType) + + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri + + BpmnRestClient bpmnRestClient = new BpmnRestClient() + + HttpResponse resp = bpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + logger.debug(" ======== END executeResourceDelete Process ======== ") + } catch (BpmnError b) { + logger.error("Rethrowing MSOWorkflowException") + throw b + } catch (Exception e) { + logger.error("Error occured within DoDeleteResourcesV1 executeResourceDelete method: " + e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured during DoDeleteResourcesV1 executeResourceDelete Catalog") + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 9f9d58fa19..4d0324e478 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeleteE2EServiceInstance.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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3"> +<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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.0"> <bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true"> <bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow"> <bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing> @@ -7,28 +7,28 @@ <bpmn:scriptTask id="ScriptTask_06phzgv" name="PreProcess Incoming Request" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0vz7cd9</bpmn:incoming> <bpmn:outgoing>SequenceFlow_11e6bfy</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteE2EServiceInstance() ddsi.preProcessRequest(execution) -]]></bpmn:script> +</bpmn:script> </bpmn:scriptTask> <bpmn:endEvent id="EndEvent_1uqzt26"> <bpmn:incoming>SequenceFlow_0e7inkl</bpmn:incoming> </bpmn:endEvent> <bpmn:scriptTask id="ScriptTask_1rtnsh8" name="Post Process AAI GET" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_188ejvu</bpmn:incoming> + <bpmn:incoming>SequenceFlow_11e6bfy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0vi0sv6</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteE2EServiceInstance() -ddsi.postProcessAAIGET(execution)]]></bpmn:script> +ddsi.postProcessAAIGET(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_01erufg" name=" AAI Delete (svc instance) " scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1cevtpy</bpmn:incoming> <bpmn:incoming>SequenceFlow_12rr1yy</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0e7inkl</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoCustomDeleteE2EServiceInstance() -ddsi.deleteServiceInstance(execution)]]></bpmn:script> +ddsi.deleteServiceInstance(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:subProcess id="SubProcess_1u8zt9i" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> <bpmn:startEvent id="StartEvent_0sf5lpt"> @@ -41,22 +41,22 @@ ddsi.deleteServiceInstance(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_0nha3pr" name="Log / Print Unexpected Error" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1921mo3</bpmn:incoming> <bpmn:outgoing>SequenceFlow_18vlzfo</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.common.scripts.* + <bpmn:script>import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() -ex.processJavaException(execution)]]></bpmn:script> +ex.processJavaException(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1921mo3" name="" sourceRef="StartEvent_0sf5lpt" targetRef="ScriptTask_0nha3pr" /> <bpmn:sequenceFlow id="SequenceFlow_18vlzfo" name="" sourceRef="ScriptTask_0nha3pr" targetRef="EndEvent_06utmg4" /> </bpmn:subProcess> <bpmn:sequenceFlow id="SequenceFlow_0vz7cd9" sourceRef="StartEvent_0212h2r" targetRef="ScriptTask_06phzgv" /> - <bpmn:sequenceFlow id="SequenceFlow_11e6bfy" sourceRef="ScriptTask_06phzgv" targetRef="CallActivity_076pc2z" /> + <bpmn:sequenceFlow id="SequenceFlow_11e6bfy" sourceRef="ScriptTask_06phzgv" targetRef="ScriptTask_1rtnsh8" /> <bpmn:sequenceFlow id="SequenceFlow_0e7inkl" sourceRef="ScriptTask_01erufg" targetRef="EndEvent_1uqzt26" /> <bpmn:scriptTask id="ScriptTask_146jt8v" name="Prepare Resource Oper Status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1961633</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ym9otf</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def ddsi = new DoDeleteE2EServiceInstance() -ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> +ddsi.preInitResourcesOperStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:serviceTask id="ServiceTask_00tg69u" name="Init Resource Oper Status"> <bpmn:extensionElements> @@ -81,22 +81,6 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <bpmn:outgoing>SequenceFlow_1j08ko3</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1ym9otf" sourceRef="ScriptTask_146jt8v" targetRef="ServiceTask_00tg69u" /> - <bpmn:callActivity id="CallActivity_076pc2z" name="Call AAI Generic GetService" calledElement="GenericGetService"> - <bpmn:extensionElements> - <camunda:in source="serviceInstanceId" target="GENGS_serviceInstanceId" /> - <camunda:in sourceExpression="service-instance" target="GENGS_type" /> - <camunda:out source="GENGS_FoundIndicator" target="GENGS_FoundIndicator" /> - <camunda:out source="GENGS_SuccessIndicator" target="GENGS_SuccessIndicator" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="GENGS_siResourceLink" target="GENGS_siResourceLink" /> - <camunda:out source="GENGS_service" target="GENGS_service" /> - <camunda:in source="globalSubscriberId" target="GENGS_globalCustomerId" /> - <camunda:in source="serviceType" target="GENGS_serviceType" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_11e6bfy</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_188ejvu</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_188ejvu" sourceRef="CallActivity_076pc2z" targetRef="ScriptTask_1rtnsh8" /> <bpmn:sequenceFlow id="SequenceFlow_1j08ko3" sourceRef="ServiceTask_00tg69u" targetRef="Task_1f5dlsv" /> <bpmn:sequenceFlow id="SequenceFlow_0fo5vw5" sourceRef="Task_1ldvug1" targetRef="Task_0mhdfuu" /> <bpmn:sequenceFlow id="SequenceFlow_0orw2f8" sourceRef="Task_0mhdfuu" targetRef="Task_1yx1n05" /> @@ -108,9 +92,9 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> <bpmn:scriptTask id="Task_1ldvug1" name="Prepare Decompose Service" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1q2mqnm</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0fo5vw5</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoDeleteE2EServiceInstance() -dcsi.prepareDecomposeService(execution)]]></bpmn:script> +dcsi.prepareDecomposeService(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:callActivity id="Task_0mhdfuu" name="Call Decompose Service" calledElement="DecomposeService"> <bpmn:extensionElements> @@ -130,9 +114,9 @@ dcsi.prepareDecomposeService(execution)]]></bpmn:script> <bpmn:scriptTask id="Task_1yx1n05" name="Post Decompose Service" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0orw2f8</bpmn:incoming> <bpmn:outgoing>SequenceFlow_013rime</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi= new DoDeleteE2EServiceInstance() -dcsi.postDecomposeService(execution)]]></bpmn:script> +dcsi.postDecomposeService(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:callActivity id="Task_1f5dlsv" name="Delete Resources" calledElement="DoDeleteResourcesV1"> <bpmn:extensionElements> @@ -177,7 +161,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <bpmn:linkEventDefinition name="EndDeleteProcess" /> </bpmn:intermediateThrowEvent> <bpmn:sequenceFlow id="SequenceFlow_1fozgqz" name="Yes" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_00pyc0n"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("isDeleteResourceListValid" ) == true)}]]></bpmn:conditionExpression> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isDeleteResourceListValid" ) == true)}</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="SequenceFlow_1ncja2b" sourceRef="ExclusiveGateway_156mc3h" targetRef="IntermediateThrowEvent_1g4uc66" /> <bpmn:sequenceFlow id="SequenceFlow_013rime" sourceRef="Task_1yx1n05" targetRef="ExclusiveGateway_156mc3h" /> @@ -206,12 +190,12 @@ dcsi.postDecomposeService(execution)]]></bpmn:script> <bpmn:scriptTask id="ScriptTask_0f3tjbn" name="prepare update service operation status" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0h5c1bd</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ab3vex</bpmn:outgoing> - <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.* + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* execution.setVariable("progress", "100") execution.setVariable("result", "finished") execution.setVariable("operationContent", "No actual resoure in service instance") def csi= new DoDeleteE2EServiceInstance() -csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script> +csi.prepareUpdateServiceOperationStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0hrkmxb" name="End Delete Process"> <bpmn:outgoing>SequenceFlow_0h5c1bd</bpmn:outgoing> @@ -224,263 +208,249 @@ csi.prepareUpdateServiceOperationStatus(execution)]]></bpmn:script> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteE2EServiceInstance"> <bpmndi:BPMNShape id="StartEvent_0212h2r_di" bpmnElement="StartEvent_0212h2r"> - <dc:Bounds x="-537" y="-51" width="36" height="36" /> + <dc:Bounds x="168" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-544" y="-10" width="52" height="12" /> + <dc:Bounds x="162" y="144" width="50" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_06phzgv_di" bpmnElement="ScriptTask_06phzgv"> - <dc:Bounds x="-449" y="-73" width="100" height="80" /> + <dc:Bounds x="256" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_1uqzt26_di" bpmnElement="EndEvent_1uqzt26"> - <dc:Bounds x="543" y="472" width="36" height="36" /> + <dc:Bounds x="1248" y="626" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="471" y="513" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1rtnsh8_di" bpmnElement="ScriptTask_1rtnsh8"> - <dc:Bounds x="-109" y="-73" width="100" height="80" /> + <dc:Bounds x="596" y="81" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_01erufg_di" bpmnElement="ScriptTask_01erufg"> - <dc:Bounds x="254" y="450" width="100" height="80" /> + <dc:Bounds x="959" y="604" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="SubProcess_1u8zt9i_di" bpmnElement="SubProcess_1u8zt9i" isExpanded="true"> - <dc:Bounds x="-161" y="980" width="467" height="193" /> + <dc:Bounds x="544" y="1134" width="467" height="193" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vz7cd9_di" bpmnElement="SequenceFlow_0vz7cd9"> - <di:waypoint xsi:type="dc:Point" x="-501" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-475" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-475" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-449" y="-33" /> + <di:waypoint x="204" y="121" /> + <di:waypoint x="230" y="121" /> + <di:waypoint x="230" y="121" /> + <di:waypoint x="256" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="-505" y="-39" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_11e6bfy_di" bpmnElement="SequenceFlow_11e6bfy"> - <di:waypoint xsi:type="dc:Point" x="-349" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-318" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-318" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-286" y="-33" /> + <di:waypoint x="356" y="121" /> + <di:waypoint x="596" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="-348" y="-39" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0e7inkl_di" bpmnElement="SequenceFlow_0e7inkl"> - <di:waypoint xsi:type="dc:Point" x="354" y="490" /> - <di:waypoint xsi:type="dc:Point" x="543" y="490" /> + <di:waypoint x="1059" y="644" /> + <di:waypoint x="1248" y="644" /> <bpmndi:BPMNLabel> <dc:Bounds x="403.5" y="469" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="StartEvent_0sf5lpt_di" bpmnElement="StartEvent_0sf5lpt"> - <dc:Bounds x="-93" y="1047" width="36" height="36" /> + <dc:Bounds x="612" y="1201" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="-165" y="1088" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_06utmg4_di" bpmnElement="EndEvent_06utmg4"> - <dc:Bounds x="200" y="1047" width="36" height="36" /> + <dc:Bounds x="905" y="1201" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="128" y="1088" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0nha3pr_di" bpmnElement="ScriptTask_0nha3pr"> - <dc:Bounds x="11" y="1025" width="100" height="80" /> + <dc:Bounds x="716" y="1179" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1921mo3_di" bpmnElement="SequenceFlow_1921mo3"> - <di:waypoint xsi:type="dc:Point" x="-57" y="1065" /> - <di:waypoint xsi:type="dc:Point" x="11" y="1065" /> + <di:waypoint x="648" y="1219" /> + <di:waypoint x="716" y="1219" /> <bpmndi:BPMNLabel> <dc:Bounds x="-113" y="1050" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_18vlzfo_di" bpmnElement="SequenceFlow_18vlzfo"> - <di:waypoint xsi:type="dc:Point" x="111" y="1065" /> - <di:waypoint xsi:type="dc:Point" x="200" y="1065" /> + <di:waypoint x="816" y="1219" /> + <di:waypoint x="905" y="1219" /> <bpmndi:BPMNLabel> <dc:Bounds x="67" y="1050" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_146jt8v_di" bpmnElement="ScriptTask_146jt8v"> - <dc:Bounds x="-422" y="450" width="100" height="80" /> + <dc:Bounds x="283" y="604" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_00tg69u_di" bpmnElement="ServiceTask_00tg69u"> - <dc:Bounds x="-229" y="450" width="100" height="80" /> + <dc:Bounds x="476" y="604" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ym9otf_di" bpmnElement="SequenceFlow_1ym9otf"> - <di:waypoint xsi:type="dc:Point" x="-322" y="490" /> - <di:waypoint xsi:type="dc:Point" x="-229" y="490" /> + <di:waypoint x="383" y="644" /> + <di:waypoint x="476" y="644" /> <bpmndi:BPMNLabel> <dc:Bounds x="-320.5" y="469" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_076pc2z_di" bpmnElement="CallActivity_076pc2z"> - <dc:Bounds x="-286" y="-73" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_188ejvu_di" bpmnElement="SequenceFlow_188ejvu"> - <di:waypoint xsi:type="dc:Point" x="-186" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-154" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-154" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="-109" y="-33" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="-184" y="-39" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1j08ko3_di" bpmnElement="SequenceFlow_1j08ko3"> - <di:waypoint xsi:type="dc:Point" x="-129" y="490" /> - <di:waypoint xsi:type="dc:Point" x="-1" y="490" /> + <di:waypoint x="576" y="644" /> + <di:waypoint x="704" y="644" /> <bpmndi:BPMNLabel> <dc:Bounds x="-110" y="469" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0fo5vw5_di" bpmnElement="SequenceFlow_0fo5vw5"> - <di:waypoint xsi:type="dc:Point" x="-278" y="198" /> - <di:waypoint xsi:type="dc:Point" x="-254" y="198" /> - <di:waypoint xsi:type="dc:Point" x="-254" y="198" /> - <di:waypoint xsi:type="dc:Point" x="-178" y="198" /> + <di:waypoint x="427" y="352" /> + <di:waypoint x="451" y="352" /> + <di:waypoint x="451" y="352" /> + <di:waypoint x="527" y="352" /> <bpmndi:BPMNLabel> <dc:Bounds x="-284" y="192" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0orw2f8_di" bpmnElement="SequenceFlow_0orw2f8"> - <di:waypoint xsi:type="dc:Point" x="-78" y="198" /> - <di:waypoint xsi:type="dc:Point" x="-49" y="198" /> - <di:waypoint xsi:type="dc:Point" x="-49" y="198" /> - <di:waypoint xsi:type="dc:Point" x="47" y="198" /> + <di:waypoint x="627" y="352" /> + <di:waypoint x="656" y="352" /> + <di:waypoint x="656" y="352" /> + <di:waypoint x="752" y="352" /> <bpmndi:BPMNLabel> <dc:Bounds x="-79" y="192" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_1jcfnjr_di" bpmnElement="startDeleteResources"> - <dc:Bounds x="-537" y="472" width="36" height="36" /> + <dc:Bounds x="168" y="626" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-549" y="512" width="60" height="24" /> + <dc:Bounds x="157" y="666" width="58" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1961633_di" bpmnElement="SequenceFlow_1961633"> - <di:waypoint xsi:type="dc:Point" x="-501" y="490" /> - <di:waypoint xsi:type="dc:Point" x="-422" y="490" /> + <di:waypoint x="204" y="644" /> + <di:waypoint x="283" y="644" /> <bpmndi:BPMNLabel> <dc:Bounds x="-461.5" y="469" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_079nac8_di" bpmnElement="Task_1ldvug1"> - <dc:Bounds x="-378" y="158" width="100" height="80" /> + <dc:Bounds x="327" y="312" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_01b12fk_di" bpmnElement="Task_0mhdfuu"> - <dc:Bounds x="-178" y="158" width="100" height="80" /> + <dc:Bounds x="527" y="312" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0msjtc4_di" bpmnElement="Task_1yx1n05"> - <dc:Bounds x="47" y="158" width="100" height="80" /> + <dc:Bounds x="752" y="312" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_16sm2op_di" bpmnElement="Task_1f5dlsv"> - <dc:Bounds x="-1" y="450" width="100" height="80" /> + <dc:Bounds x="704" y="604" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1cevtpy_di" bpmnElement="SequenceFlow_1cevtpy"> - <di:waypoint xsi:type="dc:Point" x="99" y="490" /> - <di:waypoint xsi:type="dc:Point" x="254" y="490" /> + <di:waypoint x="804" y="644" /> + <di:waypoint x="959" y="644" /> <bpmndi:BPMNLabel> <dc:Bounds x="131.5" y="469" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_0s6bb2d_di" bpmnElement="DecomposeService"> - <dc:Bounds x="-537" y="180" width="36" height="36" /> + <dc:Bounds x="168" y="334" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-550" y="220" width="61" height="24" /> + <dc:Bounds x="156" y="374" width="59" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1q2mqnm_di" bpmnElement="SequenceFlow_1q2mqnm"> - <di:waypoint xsi:type="dc:Point" x="-501" y="198" /> - <di:waypoint xsi:type="dc:Point" x="-378" y="198" /> + <di:waypoint x="204" y="352" /> + <di:waypoint x="327" y="352" /> <bpmndi:BPMNLabel> <dc:Bounds x="-484" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_1j1awcj_di" bpmnElement="StartEvent_1qh5a34"> - <dc:Bounds x="71" y="-51" width="36" height="36" /> + <dc:Bounds x="776" y="103" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="46" y="-11" width="85" height="24" /> + <dc:Bounds x="752" y="143" width="83" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0vi0sv6_di" bpmnElement="SequenceFlow_0vi0sv6"> - <di:waypoint xsi:type="dc:Point" x="-9" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="14" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="14" y="-33" /> - <di:waypoint xsi:type="dc:Point" x="71" y="-33" /> + <di:waypoint x="696" y="121" /> + <di:waypoint x="719" y="121" /> + <di:waypoint x="719" y="121" /> + <di:waypoint x="776" y="121" /> <bpmndi:BPMNLabel> <dc:Bounds x="-16" y="-39" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_00pyc0n_di" bpmnElement="IntermediateThrowEvent_00pyc0n"> - <dc:Bounds x="398" y="180" width="36" height="36" /> + <dc:Bounds x="1103" y="334" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="389" y="220" width="57" height="24" /> + <dc:Bounds x="1094" y="374" width="58" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_156mc3h_di" bpmnElement="ExclusiveGateway_156mc3h" isMarkerVisible="true"> - <dc:Bounds x="279" y="173" width="50" height="50" /> + <dc:Bounds x="984" y="327" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="266" y="145" width="75" height="24" /> + <dc:Bounds x="972" y="299" width="74" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_1g4uc66_di" bpmnElement="IntermediateThrowEvent_1g4uc66"> - <dc:Bounds x="286" y="270" width="36" height="36" /> + <dc:Bounds x="991" y="424" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="279" y="308" width="53" height="24" /> + <dc:Bounds x="983" y="462" width="55" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1fozgqz_di" bpmnElement="SequenceFlow_1fozgqz"> - <di:waypoint xsi:type="dc:Point" x="329" y="198" /> - <di:waypoint xsi:type="dc:Point" x="398" y="198" /> + <di:waypoint x="1034" y="352" /> + <di:waypoint x="1103" y="352" /> <bpmndi:BPMNLabel> - <dc:Bounds x="356.5" y="176" width="19" height="12" /> + <dc:Bounds x="1062" y="330" width="19" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1ncja2b_di" bpmnElement="SequenceFlow_1ncja2b"> - <di:waypoint xsi:type="dc:Point" x="304" y="223" /> - <di:waypoint xsi:type="dc:Point" x="304" y="270" /> + <di:waypoint x="1009" y="377" /> + <di:waypoint x="1009" y="424" /> <bpmndi:BPMNLabel> <dc:Bounds x="274" y="240.5" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_013rime_di" bpmnElement="SequenceFlow_013rime"> - <di:waypoint xsi:type="dc:Point" x="147" y="198" /> - <di:waypoint xsi:type="dc:Point" x="279" y="198" /> + <di:waypoint x="852" y="352" /> + <di:waypoint x="984" y="352" /> <bpmndi:BPMNLabel> <dc:Bounds x="213" y="177" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1lsic7i_di" bpmnElement="ServiceTask_1lsic7i"> - <dc:Bounds x="-121" y="697" width="100" height="80" /> + <dc:Bounds x="584" y="851" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0f3tjbn_di" bpmnElement="ScriptTask_0f3tjbn"> - <dc:Bounds x="-399" y="697" width="100" height="80" /> + <dc:Bounds x="306" y="851" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0hrkmxb_di" bpmnElement="IntermediateCatchEvent_0hrkmxb"> - <dc:Bounds x="-531" y="719" width="36" height="36" /> + <dc:Bounds x="174" y="873" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="-539" y="759" width="53" height="24" /> + <dc:Bounds x="165" y="913" width="55" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ab3vex_di" bpmnElement="SequenceFlow_1ab3vex"> - <di:waypoint xsi:type="dc:Point" x="-299" y="737" /> - <di:waypoint xsi:type="dc:Point" x="-121" y="737" /> + <di:waypoint x="406" y="891" /> + <di:waypoint x="584" y="891" /> <bpmndi:BPMNLabel> <dc:Bounds x="-255" y="715" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h5c1bd_di" bpmnElement="SequenceFlow_0h5c1bd"> - <di:waypoint xsi:type="dc:Point" x="-495" y="737" /> - <di:waypoint xsi:type="dc:Point" x="-399" y="737" /> + <di:waypoint x="210" y="891" /> + <di:waypoint x="306" y="891" /> <bpmndi:BPMNLabel> <dc:Bounds x="-492" y="715" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_12rr1yy_di" bpmnElement="SequenceFlow_12rr1yy"> - <di:waypoint xsi:type="dc:Point" x="-21" y="737" /> - <di:waypoint xsi:type="dc:Point" x="117" y="737" /> - <di:waypoint xsi:type="dc:Point" x="117" y="490" /> - <di:waypoint xsi:type="dc:Point" x="254" y="490" /> + <di:waypoint x="684" y="891" /> + <di:waypoint x="822" y="891" /> + <di:waypoint x="822" y="644" /> + <di:waypoint x="959" y="644" /> <bpmndi:BPMNLabel> <dc:Bounds x="132" y="607.5" width="0" height="12" /> </bpmndi:BPMNLabel> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java index 5f357f5478..35ceef0473 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java @@ -55,7 +55,6 @@ public class WorkflowActionBBFailure { } request.setStatusMessage(errorMsg); request.setProgress(Long.valueOf(100)); - request.setRequestStatus("FAILED"); request.setLastModifiedBy("CamundaBPMN"); request.setEndTime(new Timestamp(System.currentTimeMillis())); requestDbclient.updateInfraActiveRequests(request); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java index 4fee1f909b..173e776af9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java @@ -34,7 +34,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.adapters.nwrest.NetworkTechnology; import org.onap.so.adapters.nwrest.ProviderVlanNetwork; import org.onap.so.adapters.nwrest.RollbackNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; @@ -261,7 +260,7 @@ public class NetworkAdapterObjectMapper { * @param L3Network * @return List<org.onap.so.openstack.beans.Subnet> */ - private List<Subnet> buildOpenstackSubnetList(L3Network l3Network) { + protected List<Subnet> buildOpenstackSubnetList(L3Network l3Network) { List<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet> subnets = l3Network.getSubnets(); List<org.onap.so.openstack.beans.Subnet> subnetList = new ArrayList<org.onap.so.openstack.beans.Subnet>(); @@ -292,9 +291,10 @@ public class NetworkAdapterObjectMapper { .setCidr(subnet.getNetworkStartAddress().concat(FORWARD_SLASH).concat(subnet.getCidrMask())); List<org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute> hostRouteList = subnet.getHostRoutes(); List<org.onap.so.openstack.beans.HostRoute> openstackHostRouteList = new ArrayList<>(); - org.onap.so.openstack.beans.HostRoute openstackHostRoute = new org.onap.so.openstack.beans.HostRoute(); + org.onap.so.openstack.beans.HostRoute openstackHostRoute = null; // TODO only 2 fields available on openstack object. Confirm it is sufficient or add as needed for (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute hostRoute : hostRouteList) { + openstackHostRoute = new org.onap.so.openstack.beans.HostRoute(); openstackHostRoute.setNextHop(hostRoute.getNextHop()); openstackHostRoute.setPrefix(hostRoute.getRoutePrefix()); // add host route to the list diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java index 52a2cf7223..c683303a41 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java @@ -21,16 +21,15 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; import static org.junit.Assert.assertEquals; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.isA; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.when; import java.sql.Timestamp; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; -import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -157,7 +156,6 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest { doReturn(reqMock).when(requestsDbClient).getInfraActiveRequestbyRequestId(reqId); workflowActionBBFailure.updateRequestErrorStatusMessage(execution); Mockito.verify(reqMock, Mockito.times(1)).setStatusMessage("Error Case"); - Mockito.verify(reqMock, Mockito.times(1)).setRequestStatus("FAILED"); Mockito.verify(reqMock, Mockito.times(1)).setProgress(Long.valueOf(100)); Mockito.verify(reqMock, Mockito.times(1)).setLastModifiedBy("CamundaBPMN"); Mockito.verify(reqMock, Mockito.times(1)).setEndTime(any(Timestamp.class)); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index ccd677c80e..d6485bd57f 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -21,8 +21,7 @@ package org.onap.so.client.adapter.network.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; -import static org.junit.Assert.*; -import static org.mockito.ArgumentMatchers.isA; +import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doReturn; import java.io.UnsupportedEncodingException; import java.nio.file.Files; @@ -39,7 +38,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; -import org.onap.so.adapters.nwrest.NetworkTechnology; import org.onap.so.adapters.nwrest.ProviderVlanNetwork; import org.onap.so.adapters.nwrest.RollbackNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; @@ -385,4 +383,19 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup { assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("messageId") .ignoring("msoRequest.requestId").ignoring("networkParams")); } + + @Test + public void buildOpenstackSubnetListMultipleHostRoutesTest() throws Exception { + + ObjectMapper omapper = new ObjectMapper(); + String l3NetworkJson = + new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "l3-network-multiple-subnets.json"))); + L3Network l3Network = omapper.readValue(l3NetworkJson, L3Network.class); + + List<org.onap.so.openstack.beans.Subnet> subnets = + SPY_networkAdapterObjectMapper.buildOpenstackSubnetList(l3Network); + assertEquals("192.168.0.0/16", subnets.get(0).getHostRoutes().get(0).getPrefix()); + assertEquals("192.168.1.5/16", subnets.get(0).getHostRoutes().get(1).getPrefix()); + + } } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json new file mode 100644 index 0000000000..e9b25ff266 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json @@ -0,0 +1,53 @@ +{ + "network-id" : "aNetworkId", + "cascaded" : false, + "cloud-params" : { }, + "network-name" : "aNetworkName", + "neutron-network-id" : null, + "network-type" : "aNetworkType", + "network-technology" : "aNetworkTechnology", + "network-role" : "", + "is-bound-to-vpn" : false, + "service-id" : "aServiceId", + "network-role-instance" : 0, + "orchestration-status" : "ACTIVE", + "heat-stack-id" : null, + "contrail-network-fqdn" : null, + "network-policies" : [ ], + "contrail-network-route-table-references" : [ ], + "widget-model-id" : null, + "widget-model-version" : null, + "physical-network-name" : "pNetworkName", + "is-provider-network" : false, + "is-shared-network" : false, + "is-external-network" : false, + "self-link" : "/", + "operational-status" : null, + "subnets" : [ { + "subnet-id" : "subnetId1", + "subnet-name" : "aSubnetName1", + "neutron-subnet-id" : null, + "gateway-address" : "192.168.1.1", + "network-start-address" : "192.168.1.2", + "cidr-mask" : "10", + "ip-version" : "4", + "orchestration-status" : "ACTIVE", + "dhcp-enabled" : true, + "dhcp-start" : "192.168.1.2", + "dhcp-end" : "192.168.1.16", + "subnet-role" : "", + "ip-assignment-direction" : "true", + "subnet-sequence" : null, + "host-routes": [{ + "host-route-id": "hrId1", + "route-prefix": "192.168.0.0/16", + "next-hop": "192.168.1.1", + "next-hop-type": null + }, { + "host-route-id": "hrId2", + "route-prefix": "192.168.1.5/16", + "next-hop": "192.168.1.1", + "next-hop-type": null + }] + }] +}
\ No newline at end of file |