diff options
Diffstat (limited to 'bpmn')
16 files changed, 222 insertions, 130 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java index 9e95e79b70..8608fee244 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ResourceKey.java @@ -21,5 +21,15 @@ package org.onap.so.bpmn.servicedecomposition.entities; public enum ResourceKey { - SERVICE_INSTANCE_ID, GENERIC_VNF_ID, NETWORK_ID, VOLUME_GROUP_ID, VF_MODULE_ID, ALLOTTED_RESOURCE_ID, CONFIGURATION_ID, NETWORK_COLLECTION_ID, VPN_ID, VPN_BONDING_LINK_ID, INSTANCE_GROUP_ID; + SERVICE_INSTANCE_ID, + GENERIC_VNF_ID, + NETWORK_ID, + VOLUME_GROUP_ID, + VF_MODULE_ID, + ALLOTTED_RESOURCE_ID, + CONFIGURATION_ID, + NETWORK_COLLECTION_ID, + VPN_ID, + VPN_BONDING_LINK_ID, + INSTANCE_GROUP_ID; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java index 7ca6076b21..2d6ce0fad7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/AssignFlows.java @@ -22,10 +22,14 @@ package org.onap.so.bpmn.servicedecomposition.tasks; public enum AssignFlows { - SERVICE_INSTANCE("AssignServiceInstanceBB"), VNF("AssignVnfBB"), VF_MODULE("AssignVfModuleBB"), NETWORK_A_LA_CARTE( - "AssignNetwork1802BB"), NETWORK_MACRO("AssignNetworkBB"), VOLUME_GROUP( - "AssignVolumeGroupBB"), NETWORK_COLLECTION( - "CreateNetworkCollectionBB"), FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); + SERVICE_INSTANCE("AssignServiceInstanceBB"), + VNF("AssignVnfBB"), + VF_MODULE("AssignVfModuleBB"), + NETWORK_A_LA_CARTE("AssignNetwork1802BB"), + NETWORK_MACRO("AssignNetworkBB"), + VOLUME_GROUP("AssignVolumeGroupBB"), + NETWORK_COLLECTION("CreateNetworkCollectionBB"), + FABRIC_CONFIGURATION("AssignFabricConfigurationBB"); private final String flowName; 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-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn index b774c052cc..33335ab2c4 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn @@ -82,7 +82,7 @@ <bpmn:sequenceFlow id="SequenceFlow_0qfmmgt" sourceRef="Audit_Inventory" targetRef="auditSuccessfulCheck" /> <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="aaiThrow" /> <bpmn:sequenceFlow id="SequenceFlow_1mgunf3" name="No" sourceRef="ExclusiveGateway_1h2ystu" targetRef="ExclusiveGateway_1pydilb" /> - <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isDeleteAuditNeeded(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1v3jgqe</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1odt2wt</bpmn:outgoing> </bpmn:serviceTask> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java index 21b14c35f9..2418479da6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java +++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilder.java @@ -38,31 +38,23 @@ public abstract class AbstractBuilder<I, O> { public static final String RESOURCE_TYPE = "resourceType"; public enum RequestAction { - CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), ACTIVATE_NETWORK_INSTANCE(1, - "ActivateNetworkInstance"), CREATE_SERVICE_INSTANCE(2, - "CreateServiceInstance"), DELETE_SERVICE_INSTANCE(3, - "DeleteServiceInstance"), DELETE_NETWORK_INSTANCE(4, - "DeleteNetworkInstance"), CREATE_VNF_INSTANCE(5, - "CreateVnfInstance"), ACTIVATE_VNF_INSTANCE(6, - "ActivateVnfInstance"), DELETE_VNF_INSTANCE(7, - "DeleteVnfInstance"), CREATE_VF_MODULE_INSTANCE(8, - "CreateVfModuleInstance"), ACTIVATE_VF_MODULE_INSTANCE( - 9, - "ActivateVfModuleInstance"), DELETE_VF_MODULE_INSTANCE( - 10, - "DeleteVfModuleInstance"), CREATE_CONTRAIL_ROUTE_INSTANCE( - 11, - "CreateContrailRouteInstance"), DELETE_CONTRAIL_ROUTE_INSTANCE( - 12, - "DeleteContrailRouteInstance"), CREATE_SECURITY_ZONE_INSTANCE( - 13, - "CreateSecurityZoneInstance"), DELETE_SECURITY_ZONE_INSTANCE( - 14, - "DeleteSecurityZoneInstance"), ACTIVATE_DCI_NETWORK_INSTANCE( - 15, - "ActivateDCINetworkInstance"), DEACTIVATE_DCI_NETWORK_INSTANCE( - 16, - "DeActivateDCINetworkInstance"); + CREATE_NETWORK_INSTANCE(0, "CreateNetworkInstance"), + ACTIVATE_NETWORK_INSTANCE(1, "ActivateNetworkInstance"), + CREATE_SERVICE_INSTANCE(2, "CreateServiceInstance"), + DELETE_SERVICE_INSTANCE(3, "DeleteServiceInstance"), + DELETE_NETWORK_INSTANCE(4, "DeleteNetworkInstance"), + CREATE_VNF_INSTANCE(5, "CreateVnfInstance"), + ACTIVATE_VNF_INSTANCE(6, "ActivateVnfInstance"), + DELETE_VNF_INSTANCE(7, "DeleteVnfInstance"), + CREATE_VF_MODULE_INSTANCE(8, "CreateVfModuleInstance"), + ACTIVATE_VF_MODULE_INSTANCE(9, "ActivateVfModuleInstance"), + DELETE_VF_MODULE_INSTANCE(10, "DeleteVfModuleInstance"), + CREATE_CONTRAIL_ROUTE_INSTANCE(11, "CreateContrailRouteInstance"), + DELETE_CONTRAIL_ROUTE_INSTANCE(12, "DeleteContrailRouteInstance"), + CREATE_SECURITY_ZONE_INSTANCE(13, "CreateSecurityZoneInstance"), + DELETE_SECURITY_ZONE_INSTANCE(14, "DeleteSecurityZoneInstance"), + ACTIVATE_DCI_NETWORK_INSTANCE(15, "ActivateDCINetworkInstance"), + DEACTIVATE_DCI_NETWORK_INSTANCE(16, "DeActivateDCINetworkInstance"); String name; int value; @@ -82,9 +74,16 @@ public abstract class AbstractBuilder<I, O> { } public enum SvcAction { - RESERVE(0, "reserve"), ASSIGN(1, "assign"), ACTIVATE(2, "activate"), DELETE(3, "delete"), CHANGEASSIGN(4, - "changeassign"), CHANGEDELETE(5, "changedelete"), ROLLBACK(6, - "rollback"), DEACTIVATE(7, "deactivate"), UNASSIGN(8, "unassign"), CREATE(9, "create"); + RESERVE(0, "reserve"), + ASSIGN(1, "assign"), + ACTIVATE(2, "activate"), + DELETE(3, "delete"), + CHANGEASSIGN(4, "changeassign"), + CHANGEDELETE(5, "changedelete"), + ROLLBACK(6, "rollback"), + DEACTIVATE(7, "deactivate"), + UNASSIGN(8, "unassign"), + CREATE(9, "create"); String name; int value; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java index a223259d4d..62878fd4f7 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java @@ -60,6 +60,16 @@ public class AuditTasks { } } + public void isDeleteAuditNeeded(BuildingBlockExecution execution) { + try { + logger.debug("deleteAuditInventoryNeeded Value: {}", env.getProperty("mso.infra.deleteAuditInventory")); + execution.setVariable("auditInventoryNeeded", + Boolean.parseBoolean(env.getProperty("mso.infra.deleteAuditInventory"))); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void setupAuditVariable(BuildingBlockExecution execution) { try { execution.setVariable("auditInventory", createAuditInventory(execution)); 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/bpmn/infrastructure/workflow/tasks/WorkflowType.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java index af8f93b92b..05a51797dd 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowType.java @@ -22,9 +22,15 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; public enum WorkflowType { - SERVICE("Service"), VNF("Vnf"), VFMODULE("VfModule"), VOLUMEGROUP("VolumeGroup"), NETWORK("Network"), VIRTUAL_LINK( - "VirtualLink"), NETWORKCOLLECTION( - "NetworkCollection"), CONFIGURATION("Configuration"), INSTANCE_GROUP("InstanceGroup"); + SERVICE("Service"), + VNF("Vnf"), + VFMODULE("VfModule"), + VOLUMEGROUP("VolumeGroup"), + NETWORK("Network"), + VIRTUAL_LINK("VirtualLink"), + NETWORKCOLLECTION("NetworkCollection"), + CONFIGURATION("Configuration"), + INSTANCE_GROUP("InstanceGroup"); private final String type; 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/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java index 1718de9fe0..d6216c509d 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java @@ -23,22 +23,17 @@ package org.onap.so.client.sdnc.beans; import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; public enum SDNCSvcAction { - ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE), DELETE("delete", - GenericResourceApiSvcActionEnumeration.DELETE), ASSIGN("assign", - GenericResourceApiSvcActionEnumeration.ASSIGN), ROLLBACK("rollback", - GenericResourceApiSvcActionEnumeration.ROLLBACK), UNASSIGN("unassign", - GenericResourceApiSvcActionEnumeration.UNASSIGN), DEACTIVATE("deactivate", - GenericResourceApiSvcActionEnumeration.DEACTIVATE), CHANGE_DELETE( - "changedelete", - GenericResourceApiSvcActionEnumeration.CHANGEDELETE), CHANGE_ASSIGN( - "changeassign", - GenericResourceApiSvcActionEnumeration.CHANGEASSIGN), CREATE( - "create", - GenericResourceApiSvcActionEnumeration.CREATE), ENABLE( - "enable", - GenericResourceApiSvcActionEnumeration.ENABLE), DISABLE( - "disable", - GenericResourceApiSvcActionEnumeration.DISABLE); + ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE), + DELETE("delete", GenericResourceApiSvcActionEnumeration.DELETE), + ASSIGN("assign", GenericResourceApiSvcActionEnumeration.ASSIGN), + ROLLBACK("rollback", GenericResourceApiSvcActionEnumeration.ROLLBACK), + UNASSIGN("unassign", GenericResourceApiSvcActionEnumeration.UNASSIGN), + DEACTIVATE("deactivate", GenericResourceApiSvcActionEnumeration.DEACTIVATE), + CHANGE_DELETE("changedelete", GenericResourceApiSvcActionEnumeration.CHANGEDELETE), + CHANGE_ASSIGN("changeassign", GenericResourceApiSvcActionEnumeration.CHANGEASSIGN), + CREATE("create", GenericResourceApiSvcActionEnumeration.CREATE), + ENABLE("enable", GenericResourceApiSvcActionEnumeration.ENABLE), + DISABLE("disable", GenericResourceApiSvcActionEnumeration.DISABLE); private final String name; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java index b9b04bc7b7..4edbf37bad 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java @@ -22,14 +22,14 @@ package org.onap.so.client.sdnc.beans; public enum SDNCSvcOperation { - VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), NETWORK_TOPOLOGY_OPERATION( - "network-topology-operation"), VNF_TOPOLOGY_OPERATION( - "vnf-topology-operation"), CONTRAIL_ROUTE_TOPOLOGY_OPERATION( - "contrail-route-topology-operation"), SECURITY_ZONE_TOPOLOGY_OPERATION( - "security-zone-topology-operation"), PORT_MIRROR_TOPOLOGY_OPERATION( - "port-mirror-topology-operation"), SERVICE_TOPOLOGY_OPERATION( - "service-topology-operation"), GENERIC_CONFIGURATION_TOPOLOGY_OPERATION( - "generic-configuration-topology-operation"); + VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"), + NETWORK_TOPOLOGY_OPERATION("network-topology-operation"), + VNF_TOPOLOGY_OPERATION("vnf-topology-operation"), + CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"), + SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"), + PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"), + SERVICE_TOPOLOGY_OPERATION("service-topology-operation"), + GENERIC_CONFIGURATION_TOPOLOGY_OPERATION("generic-configuration-topology-operation"); private final String name; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java index fb5f24694b..ae9fe6ad70 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java @@ -22,11 +22,14 @@ package org.onap.so.client.sdnc.endpoint; public enum SDNCTopology { - SERVICE("service-topology-operation"), VNF("vnf-topology-operation"), VFMODULE( - "vf-module-topology-operation"), CONTRAILROUTE("contrail-route-topology-operation"), PORTMIRROR( - "port-mirror-topology-operation"), NETWORK("network-topology-operation"), SECURITYZONE( - "security-zone-topology-operation"), CONFIGURATION( - "generic-configuration-topology-operation"); + SERVICE("service-topology-operation"), + VNF("vnf-topology-operation"), + VFMODULE("vf-module-topology-operation"), + CONTRAILROUTE("contrail-route-topology-operation"), + PORTMIRROR("port-mirror-topology-operation"), + NETWORK("network-topology-operation"), + SECURITYZONE("security-zone-topology-operation"), + CONFIGURATION("generic-configuration-topology-operation"); private final String topology; 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 |