diff options
author | Gamboa, Gilbert <gilbert.g.gamboa@att.com> | 2019-07-18 11:28:01 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-07-18 11:28:02 -0400 |
commit | ebe2f6e4b58c78aad50008d6556436a1bf86bcad (patch) | |
tree | ca17b86e41ae331976fc1a83954e1f04ed7d6c6e | |
parent | 582c5624b4947c14116477297bb4535043281bed (diff) |
Remove duplicate name check in createAAITasks.
Remove duplicate name check in createAAITasks. This hould be done prior
to status check in WorkflowAction or BBInputSetup.
Issue-ID: SO-2119
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Change-Id: I0d6d34476b1ab2b351314c9a23926f2fff0e4f89
2 files changed, 0 insertions, 96 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index e3540ecc58..583e3e172a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -77,7 +77,6 @@ public class AAICreateTasks { private static final Logger logger = LoggerFactory.getLogger(AAICreateTasks.class); private static final String networkTypeProvider = "PROVIDER"; - private static final String A_LA_CARTE = "aLaCarte"; private static String NETWORK_COLLECTION_NAME = "networkCollectionName"; private static String CONTRAIL_NETWORK_POLICY_FQDN_LIST = "contrailNetworkPolicyFqdnList"; private static String HEAT_STACK_ID = "heatStackId"; @@ -107,12 +106,8 @@ public class AAICreateTasks { public void createServiceInstance(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); - if (Boolean.TRUE.equals(alaCarte) && aaiSIResources.checkInstanceServiceNameInUse(serviceInstance)) { - throw new DuplicateNameException("service-instance", serviceInstance.getServiceInstanceName()); - } Customer customer = execution.getGeneralBuildingBlock().getCustomer(); aaiSIResources.createServiceInstance(serviceInstance, customer); } catch (Exception ex) { @@ -199,11 +194,7 @@ public class AAICreateTasks { public void createVnf(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - if (Boolean.TRUE.equals(alaCarte) && aaiVnfResources.checkNameInUse(vnf.getVnfName())) { - throw new DuplicateNameException("generic-vnf", vnf.getVnfName()); - } ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); execution.setVariable("homing", Boolean.TRUE.equals(vnf.isCallHoming())); @@ -262,10 +253,6 @@ public class AAICreateTasks { GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); CloudRegion cloudRegion = gBBInput.getCloudRegion(); - Boolean alaCarte = execution.getVariable(A_LA_CARTE); - if (Boolean.TRUE.equals(alaCarte) && aaiVolumeGroupResources.checkNameInUse(volumeGroup)) { - throw new DuplicateNameException("volume-group", volumeGroup.getVolumeGroupName()); - } aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion); aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion); @@ -278,10 +265,6 @@ public class AAICreateTasks { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - Boolean alaCarte = execution.getVariable(A_LA_CARTE); - if (Boolean.TRUE.equals(alaCarte) && aaiVfModuleResources.checkNameInUse(vfModule)) { - throw new DuplicateNameException("vf-module", vfModule.getVfModuleName()); - } int moduleIndex = 0; if (vfModule.getModelInfoVfModule() != null && !Boolean.TRUE.equals(vfModule.getModelInfoVfModule().getIsBaseBoolean())) { @@ -327,14 +310,9 @@ public class AAICreateTasks { */ public void createNetwork(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); - if (Boolean.TRUE.equals(alaCarte) - && aaiNetworkResources.checkNetworkNameInUse(l3network.getNetworkName())) { - throw new DuplicateNameException("l3Network", l3network.getNetworkName()); - } // set default to false. ToBe updated by SDNC l3network.setIsBoundToVpn(false); // define is bound to vpn flag as true if NEUTRON_NETWORK_TYPE is PROVIDER @@ -385,16 +363,11 @@ public class AAICreateTasks { */ public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup(); // set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME)); - if (Boolean.TRUE.equals(alaCarte) - && aaiInstanceGroupResources.checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName())) { - throw new DuplicateNameException("instance-group", instanceGroup.getInstanceGroupName()); - } // put shell in AAI aaiNetworkResources.createNetworkInstanceGroup(instanceGroup); } catch (Exception ex) { @@ -511,12 +484,7 @@ public class AAICreateTasks { public void createConfiguration(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID); - if (Boolean.TRUE.equals(alaCarte) - && aaiConfigurationResources.checkConfigurationNameInUse(configuration.getConfigurationName())) { - throw new DuplicateNameException("configuration", configuration.getConfigurationName()); - } aaiConfigurationResources.createConfiguration(configuration); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -525,14 +493,9 @@ public class AAICreateTasks { public void createInstanceGroupVnf(BuildingBlockExecution execution) { try { - Boolean alaCarte = execution.getVariable(A_LA_CARTE); ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID); InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID); - if (Boolean.TRUE.equals(alaCarte) - && aaiInstanceGroupResources.checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName())) { - throw new DuplicateNameException("instance-group", instanceGroup.getInstanceGroupName()); - } aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance); } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java index b889493d2e..ed3ec759c3 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -60,7 +60,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; -import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.onap.so.client.aai.entities.uri.AAIResourceUri; @@ -130,14 +129,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createServiceInstanceNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiServiceInstanceResources).checkInstanceServiceNameInUse(serviceInstance); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createServiceInstance(execution); - } - - @Test public void createServiceInstanceExceptionTest() throws Exception { expectedException.expect(BpmnError.class); @@ -162,14 +153,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createVolumeGroupDuplicateNameTest() throws Exception { - expectedException.expect(BpmnError.class); - execution.setVariable("aLaCarte", Boolean.TRUE); - doReturn(true).when(aaiVolumeGroupResources).checkNameInUse(volumeGroup); - aaiCreateTasks.createVolumeGroup(execution); - } - - @Test public void createVolumeGroupExceptionTest() throws Exception { expectedException.expect(BpmnError.class); @@ -349,14 +332,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createVnfDuplicateNameTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiVnfResources).checkNameInUse(genericVnf.getVnfName()); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createVnf(execution); - } - - @Test public void createVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound"); @@ -386,14 +361,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createVfModuleDuplicateNameTest() throws Exception { - expectedException.expect(BpmnError.class); - execution.setVariable("aLaCarte", Boolean.TRUE); - doReturn(true).when(aaiVfModuleResources).checkNameInUse(vfModule); - aaiCreateTasks.createVfModule(execution); - } - - @Test public void createServiceSubscriptionTest() { doNothing().when(aaiServiceInstanceResources).createServiceSubscription(customer); aaiCreateTasks.createServiceSubscription(execution); @@ -441,14 +408,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createNetworkNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - execution.setVariable("aLaCarte", Boolean.TRUE); - doReturn(true).when(aaiNetworkResources).checkNetworkNameInUse(network.getNetworkName()); - aaiCreateTasks.createNetwork(execution); - } - - @Test public void createNetworkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); @@ -560,15 +519,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createConfigurationNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiConfigurationResources) - .checkConfigurationNameInUse(configuration.getConfigurationName()); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createConfiguration(execution); - } - - @Test public void connectVnfToCloudRegionTest() throws Exception { gBBInput = execution.getGeneralBuildingBlock(); doNothing().when(aaiVnfResources).connectVnfToCloudRegion(genericVnf, gBBInput.getCloudRegion()); @@ -609,15 +559,6 @@ public class AAICreateTasksTest extends BaseTaskTest { } @Test - public void createInstanceGroupVnfNameInUseExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - doReturn(true).when(aaiInstanceGroupResources) - .checkInstanceGroupNameInUse(instanceGroup.getInstanceGroupName()); - execution.setVariable("aLaCarte", Boolean.TRUE); - aaiCreateTasks.createInstanceGroupVnf(execution); - } - - @Test public void createInstanceGroupVnfExceptionTest() throws Exception { expectedException.expect(BpmnError.class); doThrow(RuntimeException.class).when(aaiInstanceGroupResources) |