diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-10-11 13:55:37 -0400 |
---|---|---|
committer | Rob Daugherty <rd472p@att.com> | 2018-10-12 10:10:16 -0400 |
commit | 6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (patch) | |
tree | 9046e63bccb77ca3e2df4ae7ceab44cc238dd074 /bpmn/MSOCommonBPMN/src/test/java | |
parent | 58c1d90a787979e507f559d7075aac8a1428df42 (diff) |
Dynamic Cloud Owner Support
added in cloud configuration object to request params
Fix Bean scanning so it picks up the resttemplate
removed unnecessary RestTemplate Bean configurations
corrected typo in CloudConfiguration class
updated gr api test cases with dynamic cloud owner
updated groovy files to allow for dynamic cloud owner values
updated GR API layer to include cloud owner
added enum for default cloud owner
add cloud owner variable to camunda in mapping
removed references to att-aic from BBInputSetup
updated aai schema dependency to 1.3.1 from 1.3.0
Fixed incorrect type AAIUri and updated logging in the method.
use existing service instance id instead of generating
Pass cloudOwner to process to propagate to subprocesses.
NOTE: our aai-schema dependency is 1.3.1-SNAPSHOT to be
compatible with the cloud owner changes here. The
releaesed 1.3.0 version is NOT compatible.
Change-Id: I43b46774b77981d1c8bfe7c7a79b9434889e62ae
Issue-ID: SO-1128
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java')
4 files changed, 33 insertions, 62 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java index 3b41ff8337..38be9f3790 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java @@ -984,31 +984,6 @@ public class StubResponseAAI { .willReturn(aResponse() .withStatus(404))); } - @Deprecated - public static void MockGENPSIPutServiceInstance(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); - } - - @Deprecated - public static void MockGENPSIPutServiceSubscription(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET")) - .willReturn(aResponse() - .withStatus(200) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/GenericPutServiceInstance_PutServiceInstance_AAIResponse_Success.xml"))); - } - @Deprecated - public static void MockGENPSIPutServiceInstance_get500(){ - stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/1604-MVM-26/service-subscriptions/service-subscription/SDN-ETHERNET-INTERNET/service-instances/service-instance/MIS%252F1604%252F0026%252FSW_INTERNET")) - .willReturn(aResponse() - .withStatus(500) - .withHeader("Content-Type", "text/xml") - .withBodyFile("GenericPutServiceInstance/aaiFault.xml"))); - } @Deprecated public static void MockGetGenericVnfById(){ diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index 33e1390b9c..e5138b394c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -561,7 +561,7 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapLocationContext() { CloudRegion expected = new CloudRegion(); - expected.setCloudOwner("att-aic"); + expected.setCloudOwner("test-owner-name"); expected.setLcpCloudRegionId("cloudRegionId"); expected.setComplex("complexName"); expected.setTenantId("tenantId"); @@ -570,11 +570,11 @@ public class BBInputSetupMapperLayerTest { cloudConfig.setLcpCloudRegionId("cloudRegionId"); cloudConfig.setAicNodeClli("aicNodeClli"); org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); - cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudOwner("test-owner-name"); cloudRegion.setCloudRegionId("cloudRegionId"); cloudRegion.setComplexName("complexName"); - CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion); assertThat(actual, sameBeanAs(expected)); } @@ -582,7 +582,7 @@ public class BBInputSetupMapperLayerTest { @Test public void testMapCloudRegion() { CloudRegion expected = new CloudRegion(); - expected.setCloudOwner("att-aic"); + expected.setCloudOwner("test-owner-name"); expected.setLcpCloudRegionId("cloudRegionId"); expected.setTenantId("tenantId"); expected.setCloudRegionVersion("cloudRegionVersion"); @@ -593,11 +593,11 @@ public class BBInputSetupMapperLayerTest { cloudConfig.setAicNodeClli("aicNodeClli"); org.onap.aai.domain.yang.CloudRegion cloudRegion = new org.onap.aai.domain.yang.CloudRegion(); - cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudOwner("test-owner-name"); cloudRegion.setCloudRegionId("cloudRegionId"); cloudRegion.setCloudRegionVersion("cloudRegionVersion"); - CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion, "att-aic"); + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(cloudConfig, cloudRegion); assertThat(actual, sameBeanAs(expected)); } @@ -606,7 +606,7 @@ public class BBInputSetupMapperLayerTest { public void testMapCloudRegionWithNullCheck() { CloudRegion expected = new CloudRegion(); - CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null, null); + CloudRegion actual = bbInputSetupMapperLayer.mapCloudRegion(null, null); assertThat(actual, sameBeanAs(expected)); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java index d0ecedf878..eed4b1411f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java @@ -84,6 +84,7 @@ import org.onap.so.client.aai.AAIObjectType; 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.onap.so.constants.Defaults; import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.CollectionResource; import org.onap.so.db.catalog.beans.CollectionResourceCustomization; @@ -317,6 +318,9 @@ public class BBInputSetupTest { RequestInfo requestInfo = new RequestInfo(); requestInfo.setSuppressRollback(true); requestDetails.setRequestInfo(requestInfo); + CloudConfiguration cloudConfiguration = new CloudConfiguration(); + cloudConfiguration.setLcpCloudRegionId("myRegionId"); + requestDetails.setCloudConfiguration(cloudConfiguration); doReturn(requestDetails).when(SPY_bbInputSetupUtils).getRequestDetails(executeBB.getRequestId()); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); String resourceId = "123"; @@ -351,7 +355,7 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType); @@ -404,7 +408,7 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId"); doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId()); doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId"); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType); @@ -448,7 +452,7 @@ public class BBInputSetupTest { doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); doReturn(owningEntity).when(bbInputSetupMapperLayer) .mapRequestOwningEntity(requestDetails.getOwningEntity()); @@ -497,7 +501,7 @@ public class BBInputSetupTest { .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelVersionAndModelInvariantUUID( requestDetails.getModelInfo().getModelVersion(), requestDetails.getModelInfo().getModelInvariantId()); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(project).when(bbInputSetupMapperLayer).mapRequestProject(requestDetails.getProject()); doReturn(owningEntity).when(bbInputSetupMapperLayer) .mapRequestOwningEntity(requestDetails.getOwningEntity()); @@ -543,7 +547,7 @@ public class BBInputSetupTest { .getURIKeysFromServiceInstance(resourceId); doReturn(service).when(SPY_bbInputSetupUtils) .getCatalogServiceByModelUUID(requestDetails.getModelInfo().getModelVersionId()); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId); doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer); @@ -769,7 +773,7 @@ public class BBInputSetupTest { orchestrationContext.setIsRollbackEnabled(false); CloudRegion cloudRegion = new CloudRegion(); - cloudRegion.setCloudOwner("att-aic"); + cloudRegion.setCloudOwner("test-owner-name"); cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); cloudRegion.setComplex("complexName"); cloudRegion.setTenantId("tenantId"); @@ -792,11 +796,10 @@ public class BBInputSetupTest { doReturn(uriKeys).when(SPY_bbInputSetupUtils).getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId()); doReturn(customer).when(SPY_bbInputSetup).mapCustomer(uriKeys.get("global-customer-id"),uriKeys.get("service-type")); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails); doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails); - doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion, - "att-aic"); + doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion); GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); @@ -1769,11 +1772,12 @@ public class BBInputSetupTest { new File(RESOURCE_PATH + "ServiceMacroVfModules.json"), org.onap.so.serviceinstancebeans.Service.class); CloudConfiguration cloudConfig = null; org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = new org.onap.aai.domain.yang.CloudRegion(); + aaiCloudRegion.setCloudOwner("test-owner-name"); Resources resources = serviceMacro.getResources(); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class), eq("att-aic")); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(any(CloudConfiguration.class)); CloudRegion expected = new CloudRegion(); expected.setLcpCloudRegionId("mdt1"); - expected.setCloudOwner("att-aic"); + expected.setCloudOwner("test-owner-name"); expected.setTenantId("88a6ca3ee0394ade9403f075db23167e"); CloudRegion actual = SPY_bbInputSetup.getCloudRegionFromMacroRequest(cloudConfig, resources); @@ -2124,8 +2128,7 @@ public class BBInputSetupTest { cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); requestDetails.setCloudConfiguration(cloudConfig); org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), - "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB"); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); @@ -2273,14 +2276,13 @@ public class BBInputSetupTest { any(Service.class), any(String.class)); org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class); - doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration(), - "att-aic"); + doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration()); VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("volumeGroupId"); gBB.getServiceInstance().getVnfs().get(0).getVolumeGroups().add(volumeGroup); org.onap.aai.domain.yang.VolumeGroup aaiVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); aaiVolumeGroup.setModelCustomizationId("modelCustId"); - doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup("att-aic", + doReturn(aaiVolumeGroup).when(SPY_bbInputSetupUtils).getAAIVolumeGroup(Defaults.CLOUD_OWNER.toString(), cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB"); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java index eb74ab804e..e1efe1c9c5 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java @@ -174,27 +174,25 @@ public class BBInputSetupUtilsTest { @Test public void testGetCloudRegion() { - String cloudOwner = "cloudOwnerId"; CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); Optional<org.onap.aai.domain.yang.CloudRegion> expected = Optional.of(new org.onap.aai.domain.yang.CloudRegion()); - expected.get().setCloudOwner(cloudOwner); + expected.get().setCloudOwner("cloudOwner"); expected.get().setCloudRegionId("lcpCloudRegionId"); doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.CloudRegion.class, - AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId())); - AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner, + AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId()); - bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + bbInputSetupUtils.getCloudRegion(cloudConfig); verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri); } @Test public void testGetCloudRegionExceptionTest() { - String cloudOwner = "cloudOwnerId"; - + CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); @@ -203,33 +201,29 @@ public class BBInputSetupUtilsTest { doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig); assertNull(cloudRegion); } @Test public void testGetCloudRegionEmptyId() { - String cloudOwner = "cloudOwnerId"; - CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId(""); RequestDetails requestDetails = new RequestDetails(); requestDetails.setCloudConfiguration(cloudConfig); - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig, cloudOwner); + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig); assertNull(cloudRegion); } @Test public void testGetCloudRegionEmptyConfiguration() { - String cloudOwner = "cloudOwnerId"; - RequestDetails requestDetails = new RequestDetails(); - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration(), cloudOwner); + CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration()); assertNull(cloudRegion); } |