diff options
Diffstat (limited to 'bpmn')
17 files changed, 1031 insertions, 557 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java index 6b3ad1d528..554e987fc8 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java @@ -100,6 +100,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { private List<AggregateRoute> aggregateRoutes = new ArrayList<>(); @JsonProperty("vpn-binding") private List<VpnBinding> vpnBindings = new ArrayList<>(); + @JsonProperty("line-of-business") + private LineOfBusiness lineOfBusiness; + @JsonProperty("platform") + private Platform platform; public ModelInfoNetwork getModelInfoNetwork() { return modelInfoNetwork; @@ -313,6 +317,22 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> { return vpnBindings; } + public LineOfBusiness getLineOfBusiness() { + return lineOfBusiness; + } + + public void setLineOfBusiness(LineOfBusiness lineOfBusiness) { + this.lineOfBusiness = lineOfBusiness; + } + + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + @Override public boolean equals(final Object other) { if (!(other instanceof L3Network)) { diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index a4793476e4..145d4c83a7 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -915,7 +915,7 @@ public class BBInputSetup implements JavaDelegate { if (network == null && (parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { network = createNetwork(parameter.getLookupKeyMap(), parameter.getInstanceName(), parameter.getResourceId(), - parameter.getInstanceParams()); + parameter.getInstanceParams(), parameter); parameter.getServiceInstance().getNetworks().add(network); } if (network != null) { @@ -924,12 +924,20 @@ public class BBInputSetup implements JavaDelegate { } protected L3Network createNetwork(Map<ResourceKey, String> lookupKeyMap, String instanceName, String networkId, - List<Map<String, String>> instanceParams) { + List<Map<String, String>> instanceParams, BBInputSetupParameter parameter) { lookupKeyMap.put(ResourceKey.NETWORK_ID, networkId); L3Network network = new L3Network(); network.setNetworkId(networkId); network.setNetworkName(instanceName); network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + if (parameter != null) { + if (parameter.getLineOfBusiness() != null) { + network.setLineOfBusiness(this.mapperLayer.mapRequestLineOfBusiness(parameter.getLineOfBusiness())); + } + if (parameter.getLineOfBusiness() != null) { + network.setPlatform(this.mapperLayer.mapRequestPlatform(parameter.getPlatform())); + } + } if (instanceParams != null) { for (Map<String, String> params : instanceParams) { network.getCloudParams().putAll(params); @@ -1284,7 +1292,7 @@ public class BBInputSetup implements JavaDelegate { if (collectionNetworkResourceCust != null) { if ((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString()) || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) { - L3Network network = createNetwork(lookupKeyMap, null, networkId, null); + L3Network network = createNetwork(lookupKeyMap, null, networkId, null, null); serviceInstance.getNetworks().add(network); return network; } else { 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 a45e803cf0..1acf4edb4a 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 @@ -1262,7 +1262,7 @@ public class BBInputSetupTest { verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network, modelInfo, service); instanceName = "networkName2"; - L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); + L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null, parameter); SPY_bbInputSetup.populateL3Network(parameter); verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service); } @@ -2832,17 +2832,32 @@ public class BBInputSetupTest { expected.setNetworkId(networkId); expected.setNetworkName(instanceName); expected.setCloudParams(cloudParams); + Platform platform = new Platform(); + platform.setPlatformName("platformName"); + expected.setPlatform(platform); + LineOfBusiness lineOfBusiness = new LineOfBusiness(); + lineOfBusiness.setLineOfBusinessName("lineOfBusiness"); + expected.setLineOfBusiness(lineOfBusiness); expected.setOrchestrationStatus(OrchestrationStatus.PRECREATED); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); List<Map<String, String>> instanceParams = new ArrayList<>(); instanceParams.add(cloudParams); - L3Network actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams); + org.onap.so.serviceinstancebeans.Platform platformRequest = new org.onap.so.serviceinstancebeans.Platform(); + org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusinessRequest = + new org.onap.so.serviceinstancebeans.LineOfBusiness(); + lineOfBusinessRequest.setLineOfBusinessName("lineOfBusiness"); + platformRequest.setPlatformName("platformName"); + BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID) + .setPlatform(platformRequest).setLineOfBusiness(lineOfBusinessRequest).build(); + L3Network actual = + SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, instanceParams, parameter); assertThat(actual, sameBeanAs(expected)); assertEquals("LookupKeyMap is populated", networkId, lookupKeyMap.get(ResourceKey.NETWORK_ID)); expected.getCloudParams().clear(); - actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null); + + actual = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, networkId, null, parameter); assertThat(actual, sameBeanAs(expected)); } 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 0bb92e32ff..fcc59c3340 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 @@ -9,9 +9,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,6 +27,7 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; @@ -36,6 +37,9 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.Arrays; import java.util.List; import java.util.Optional; @@ -53,6 +57,7 @@ import org.onap.aai.domain.yang.Configuration; import org.onap.aai.domain.yang.Configurations; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; +import org.onap.aai.domain.yang.InstanceGroup; import org.onap.aai.domain.yang.L3Network; import org.onap.aai.domain.yang.L3Networks; import org.onap.aai.domain.yang.ServiceInstance; @@ -74,20 +79,13 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; -import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; -import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization; -import org.onap.so.db.catalog.beans.VfModuleCustomization; -import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.beans.RequestProcessingData; import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; -import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.RequestDetails; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(MockitoJUnitRunner.class) @@ -119,296 +117,192 @@ public class BBInputSetupUtilsTest { } @Test - public void testGetCatalogServiceByModelUUID() throws JsonParseException, JsonMappingException, IOException { + public void getCatalogServiceByModelUUIDTest() throws IOException { Service expected = mapper.readValue(new File(RESOURCE_PATH + "CatalogServiceExpected.json"), Service.class); + final String modelUUID = "modelUUIDTest"; - RequestDetails requestDetails = new RequestDetails(); - ModelInfo modelInfo = new ModelInfo(); - modelInfo.setModelVersionId("modelUUID"); - requestDetails.setModelInfo(modelInfo); - doReturn(expected).when(MOCK_catalogDbClient).getServiceByID("modelUUID"); - Service actual = bbInputSetupUtils.getCatalogServiceByModelUUID(modelInfo.getModelVersionId()); + doReturn(expected).when(MOCK_catalogDbClient).getServiceByID(modelUUID); - assertThat(actual, sameBeanAs(expected)); + assertThat(bbInputSetupUtils.getCatalogServiceByModelUUID(modelUUID), sameBeanAs(expected)); } @Test - public void testGetCatalogServiceByModelVersionAndModelInvariantUUID() - throws JsonParseException, JsonMappingException, IOException { - String modelVersion = "modelVersion"; - String modelInvariantUUID = "modelInvariantUUID"; + public void getCatalogServiceByModelVersionAndModelInvariantUUIDTest() throws IOException { + final String modelVersion = "modelVersionTest"; + final String modelInvariantUUID = "modelInvariantUUIDTest"; Service expectedService = mapper.readValue(new File(RESOURCE_PATH + "CatalogServiceExpected.json"), Service.class); - doReturn(expectedService).when(MOCK_catalogDbClient) - .getServiceByModelVersionAndModelInvariantUUID(isA(String.class), isA(String.class)); - - Service actualService = bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID(modelVersion, + doReturn(expectedService).when(MOCK_catalogDbClient).getServiceByModelVersionAndModelInvariantUUID(modelVersion, modelInvariantUUID); - assertThat(actualService, sameBeanAs(expectedService)); + assertThat(bbInputSetupUtils.getCatalogServiceByModelVersionAndModelInvariantUUID(modelVersion, + modelInvariantUUID), sameBeanAs(expectedService)); } @Test - public void testGetVnfcInstanceGroups() throws JsonParseException, JsonMappingException, IOException { + public void getVnfcInstanceGroupsTest() throws IOException { + final String modelCustomizationUUID = "modelCustomizationUUIDTest"; VnfcInstanceGroupCustomization vnfc = mapper.readValue( new File(RESOURCE_PATH + "VnfcInstanceGroupCustomization.json"), VnfcInstanceGroupCustomization.class); - String modelCustomizationUUID = "modelCustomizationUUID"; doReturn(Arrays.asList(vnfc)).when(MOCK_catalogDbClient) - .getVnfcInstanceGroupsByVnfResourceCust(isA(String.class)); - - List<VnfcInstanceGroupCustomization> actualVnfcList = - bbInputSetupUtils.getVnfcInstanceGroups(modelCustomizationUUID); + .getVnfcInstanceGroupsByVnfResourceCust(modelCustomizationUUID); - assertThat(actualVnfcList, sameBeanAs(Arrays.asList(vnfc))); + assertThat(bbInputSetupUtils.getVnfcInstanceGroups(modelCustomizationUUID), sameBeanAs(Arrays.asList(vnfc))); } @Test - public void testGetRequestDetails() throws JsonParseException, JsonMappingException, IOException { + public void getRequestDetailsTest() throws IOException { + final String requestId = "requestId"; InfraActiveRequests infraActiveRequest = mapper .readValue(new File(RESOURCE_PATH + "InfraActiveRequestExpected.json"), InfraActiveRequests.class); - RequestDetails expected = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsExpected.json"), RequestDetails.class); - String requestId = "requestId"; + doReturn(infraActiveRequest).when(MOCK_requestsDbClient).getInfraActiveRequestbyRequestId(requestId); - RequestDetails actual = bbInputSetupUtils.getRequestDetails(requestId); - assertThat(actual, sameBeanAs(expected)); + assertThat(bbInputSetupUtils.getRequestDetails(requestId), sameBeanAs(expected)); } @Test public void getRequestDetailsNullTest() throws IOException { - RequestDetails requestDetails = bbInputSetupUtils.getRequestDetails(""); - - assertNull(requestDetails); + assertNull(bbInputSetupUtils.getRequestDetails("")); } @Test - public void testGetCloudRegion() { + public void getCloudRegionTest() { 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().setCloudRegionId("lcpCloudRegionId"); - doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.CloudRegion.class, + Optional<CloudRegion> expected = Optional.of(new CloudRegion()); + + doReturn(expected).when(MOCK_aaiResourcesClient).get(CloudRegion.class, AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO)); - AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, - cloudConfig.getCloudOwner(), cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO); - bbInputSetupUtils.getCloudRegion(cloudConfig); - - verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri); + assertThat(bbInputSetupUtils.getCloudRegion(cloudConfig), sameBeanAs(expected.get())); } @Test - public void testGetCloudRegionExceptionTest() { - + public void getCloudRegionNullTest() { CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId("lcpCloudRegionId"); - RequestDetails requestDetails = new RequestDetails(); - requestDetails.setCloudConfiguration(cloudConfig); - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig); - - assertNull(cloudRegion); + assertNull(bbInputSetupUtils.getCloudRegion(cloudConfig)); } @Test - public void testGetCloudRegionEmptyId() { + public void getCloudRegionEmptyIdTest() { CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId(""); - RequestDetails requestDetails = new RequestDetails(); - requestDetails.setCloudConfiguration(cloudConfig); - - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfig); - - assertNull(cloudRegion); + assertNull(bbInputSetupUtils.getCloudRegion(cloudConfig)); } @Test - public void testGetCloudRegionEmptyConfiguration() { - RequestDetails requestDetails = new RequestDetails(); - - CloudRegion cloudRegion = bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration()); - - assertNull(cloudRegion); - } - - @Test - public void testGetAAIInstanceGroup() { - Optional<org.onap.aai.domain.yang.InstanceGroup> expected = - Optional.of(new org.onap.aai.domain.yang.InstanceGroup()); - String instanceGroupId = "instanceGroupId"; + public void getAAIInstanceGroupTest() { + final String instanceGroupId = "instanceGroupId"; + Optional<InstanceGroup> expected = Optional.of(new InstanceGroup()); expected.get().setId(instanceGroupId); - doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.InstanceGroup.class, + + doReturn(expected).when(MOCK_aaiResourcesClient).get(InstanceGroup.class, AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)); - AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId); - bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); - verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.InstanceGroup.class, expectedUri); + assertThat(bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId), sameBeanAs(expected.get())); } @Test - public void testGetAAIInstanceGroupThrowNotFound() { - String instanceGroupId = "instanceGroupId"; - doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.InstanceGroup.class, - AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)); - - org.onap.aai.domain.yang.InstanceGroup actual = bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); - - assertNull(actual); + public void getAAIInstanceGroupNullTest() { + assertNull(bbInputSetupUtils.getAAIInstanceGroup("")); } @Test - public void testGetAAICustomer() { + public void getAAICustomerTest() { + final String globalSubscriberId = "globalSubscriberId"; Optional<org.onap.aai.domain.yang.Customer> expected = Optional.of(new org.onap.aai.domain.yang.Customer()); - String globalSubscriberId = "globalSubscriberId"; expected.get().setGlobalCustomerId(globalSubscriberId); + doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class, AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)); - AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId); - bbInputSetupUtils.getAAICustomer(globalSubscriberId); - verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Customer.class, expectedUri); + assertThat(bbInputSetupUtils.getAAICustomer(globalSubscriberId), sameBeanAs(expected.get())); } @Test - public void testGetAAICustomerThrowNotFound() { - String globalSubscriberId = "globalSubscriberId"; - doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Customer.class, - AAIUriFactory.createResourceUri(AAIObjectType.CUSTOMER, globalSubscriberId)); - - org.onap.aai.domain.yang.Customer actual = bbInputSetupUtils.getAAICustomer(globalSubscriberId); - - assertNull(actual); + public void getAAICustomerNullTest() { + assertNull(bbInputSetupUtils.getAAICustomer("")); } @Test - public void testGetAAIServiceSubscription() { + public void getAAIServiceSubscriptionTest() { + final String globalSubscriberId = "globalSubscriberId"; + final String subscriptionServiceType = "subscriptionServiceType"; Optional<org.onap.aai.domain.yang.ServiceSubscription> expected = Optional.of(new org.onap.aai.domain.yang.ServiceSubscription()); - String globalSubscriberId = "globalSubscriberId"; - String subscriptionServiceType = "subscriptionServiceType"; + expected.get().setServiceType(subscriptionServiceType); doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class, AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, subscriptionServiceType)); - AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, - globalSubscriberId, subscriptionServiceType); - bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType); - verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceSubscription.class, expectedUri); + assertThat(bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType), + sameBeanAs(expected.get())); } @Test - public void testGetAAIServiceSubscriptionErrors() { - String globalSubId = null; - String subServiceType = null; - org.onap.aai.domain.yang.ServiceSubscription actual = - bbInputSetupUtils.getAAIServiceSubscription(globalSubId, subServiceType); - assertNull(actual); - - String globalSubId2 = ""; - String subServiceType2 = ""; - org.onap.aai.domain.yang.ServiceSubscription actual2 = - bbInputSetupUtils.getAAIServiceSubscription(globalSubId2, subServiceType2); - assertNull(actual2); - - String globalSubId3 = ""; - String subServiceType3 = null; - org.onap.aai.domain.yang.ServiceSubscription actual3 = - bbInputSetupUtils.getAAIServiceSubscription(globalSubId3, subServiceType3); - assertNull(actual3); - - String globalSubId4 = null; - String subServiceType4 = ""; - org.onap.aai.domain.yang.ServiceSubscription actual4 = - bbInputSetupUtils.getAAIServiceSubscription(globalSubId4, subServiceType4); - assertNull(actual4); + public void getAAIServiceSubscriptionErrorsTest() { + assertNull(bbInputSetupUtils.getAAIServiceSubscription(null, null)); + assertNull(bbInputSetupUtils.getAAIServiceSubscription("", "")); + assertNull(bbInputSetupUtils.getAAIServiceSubscription("", null)); + assertNull(bbInputSetupUtils.getAAIServiceSubscription(null, "")); } @Test - public void testGetAAIServiceSubscriptionThrowNotFound() { - String globalSubscriberId = "globalSubscriberId"; - String subscriptionServiceType = "subscriptionServiceType"; - doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.ServiceSubscription.class, - AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_SUBSCRIPTION, globalSubscriberId, - subscriptionServiceType)); - org.onap.aai.domain.yang.ServiceSubscription actual = - bbInputSetupUtils.getAAIServiceSubscription(globalSubscriberId, subscriptionServiceType); - assertNull(actual); - } - - @Test - public void testGetAAIServiceInstanceById() { - String serviceInstanceId = "serviceInstanceId"; - + public void getAAIServiceInstanceByIdTest() { + final String serviceInstanceId = "serviceInstanceId"; ServiceInstance expectedServiceInstance = new ServiceInstance(); doReturn(Optional.of(expectedServiceInstance)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); - - assertThat(actualServiceInstance, sameBeanAs(expectedServiceInstance)); + assertThat(bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId), sameBeanAs(expectedServiceInstance)); } @Test - public void testGetAAIServiceInstanceByIdThrowNotFound() { - String serviceInstanceId = "serviceInstanceId"; - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - - ServiceInstance actualServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId); + public void getAAIServiceInstanceById_ifEmptyReturnNull() { + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(ServiceInstance.class), + any(AAIResourceUri.class)); - assertNull(actualServiceInstance); + assertNull(bbInputSetupUtils.getAAIServiceInstanceById("any")); } @Test - public void testGetAAIServiceInstanceByIdAndCustomer() { - String globalCustomerId = "globalCustomerId"; - String serviceType = "serviceType"; - String serviceInstanceId = "serviceInstanceId"; + public void getAAIServiceInstanceByIdAndCustomerTest() { + final String globalCustomerId = "globalCustomerId"; + final String serviceType = "serviceType"; + final String serviceInstanceId = "serviceInstanceId"; ServiceInstance expected = new ServiceInstance(); expected.setServiceInstanceId(serviceInstanceId); - doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - AAIResourceUri expectedUri = AAIUriFactory - .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId) - .depth(Depth.TWO); - this.bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType, serviceInstanceId); - verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceInstance.class, expectedUri); + doReturn(Optional.of(expected)).when(MOCK_aaiResourcesClient).get(ServiceInstance.class, AAIUriFactory + .createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId, serviceType, serviceInstanceId) + .depth(Depth.TWO)); + assertThat(bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, serviceType, + serviceInstanceId), sameBeanAs(expected)); } @Test - public void testGetAAIServiceInstanceByIdAndCustomerThrowNotFound() { - String globalCustomerId = "globalCustomerId"; - String serviceType = "serviceType"; - String serviceInstanceId = "serviceInstanceId"; - - doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - ServiceInstance actual = this.bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(globalCustomerId, - serviceType, serviceInstanceId); + public void getAAIServiceInstanceByIdAndCustomerNullTest() { + doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(ServiceInstance.class), + any(AAIResourceUri.class)); - assertNull(actual); + assertNull(bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer("", "", "")); } @Test - public void testGetAAIServiceInstanceByName() throws Exception { - String serviceInstanceName = "serviceInstanceName"; + public void getAAIServiceInstanceByNameTest() throws Exception { + final String serviceInstanceName = "serviceInstanceName"; ServiceInstance expectedServiceInstance = new ServiceInstance(); expectedServiceInstance.setServiceInstanceId("serviceInstanceId"); @@ -425,20 +319,17 @@ public class BBInputSetupUtilsTest { doReturn(Optional.of(serviceInstances)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - AAIResourceUri expectedUri = AAIUriFactory - .createResourceUri(AAIObjectPlurals.SERVICE_INSTANCE, customer.getGlobalCustomerId(), - customer.getServiceSubscription().getServiceType()) - .queryParam("service-instance-name", serviceInstanceName).depth(Depth.TWO); - bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); - verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.ServiceInstances.class, expectedUri); + assertThat(bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer), + sameBeanAs(serviceInstances.getServiceInstance().get(0))); } @Test - public void testGetAAIServiceInstanceByNameException() throws Exception { - expectedException.expect(Exception.class); + public void getAAIServiceInstanceByNameExceptionTest() throws Exception { + final String serviceInstanceName = "serviceInstanceName"; - String serviceInstanceName = "serviceInstanceName"; + expectedException.expect(Exception.class); + expectedException.expectMessage("Multiple Service Instances Returned"); ServiceInstance serviceInstance = new ServiceInstance(); serviceInstance.setServiceInstanceId("serviceInstanceId"); @@ -461,45 +352,26 @@ public class BBInputSetupUtilsTest { } @Test - public void testGetAAIServiceInstanceByNameNull() throws Exception { - String serviceInstanceName = "serviceInstanceName"; - - ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("serviceInstanceId"); - - ServiceSubscription serviceSubscription = new ServiceSubscription(); - serviceSubscription.setServiceType("serviceType"); - + public void getAAIServiceInstanceByNameNullTest() throws Exception { Customer customer = new Customer(); - customer.setGlobalCustomerId("globalCustomerId"); - customer.setServiceSubscription(serviceSubscription); - - ServiceInstances serviceInstances = new ServiceInstances(); - serviceInstances.getServiceInstance().add(serviceInstance); - serviceInstances.getServiceInstance().add(serviceInstance); + customer.setServiceSubscription(new ServiceSubscription()); - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - - ServiceInstance actualServiceInstance = - bbInputSetupUtils.getAAIServiceInstanceByName(serviceInstanceName, customer); - - assertNull(actualServiceInstance); + assertNull(bbInputSetupUtils.getAAIServiceInstanceByName("", customer)); } @Test - public void testGetOptionalAAIServiceInstanceByNameException() throws Exception { + public void getOptionalAAIServiceInstanceByNameExceptionTest() throws Exception { expectedException.expect(MultipleObjectsFoundException.class); expectedException.expectMessage(containsString( "Multiple service instances found for customer-id: globalCustomerId, service-type: serviceType and service-instance-name: serviceInstanceId.")); - String globalCustomerId = "globalCustomerId"; - String serviceType = "serviceType"; - String serviceInstanceId = "serviceInstanceId"; + final String globalCustomerId = "globalCustomerId"; + final String serviceType = "serviceType"; + final String serviceInstanceId = "serviceInstanceId"; ServiceInstance serviceInstance = new ServiceInstance(); - serviceInstance.setServiceInstanceId("serviceInstanceId"); + serviceInstance.setServiceInstanceId(serviceInstanceId); serviceInstance.setServiceType(serviceType); - serviceInstance.setServiceInstanceName("serviceInstanceName"); ServiceInstances serviceInstances = new ServiceInstances(); serviceInstances.getServiceInstance().add(serviceInstance); @@ -512,99 +384,81 @@ public class BBInputSetupUtilsTest { } @Test - public void testGetOptionalAAIServiceInstanceByNameNull() throws Exception { - String globalCustomerId = "globalCustomerId"; - String serviceType = "serviceType"; - String serviceInstanceId = "serviceInstanceId"; - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - Optional<ServiceInstance> actual = - this.bbInputSetupUtils.getAAIServiceInstanceByName(globalCustomerId, serviceType, serviceInstanceId); + public void getOptionalAAIServiceInstanceByNameNullTest() throws Exception { + Optional<ServiceInstance> actual = bbInputSetupUtils.getAAIServiceInstanceByName("", "", ""); assertThat(actual, sameBeanAs(Optional.empty())); } @Test - public void testGetCatalogInstanceGroup() throws JsonParseException, JsonMappingException, IOException { - String modelUUID = "modelUUID"; + public void getCatalogInstanceGroupNullTest() { + assertNull(bbInputSetupUtils.getCatalogInstanceGroup("")); + } + @Test + public void getCatalogInstanceGroupTest() throws IOException { + final String modelUUID = "modelUUIDTest"; org.onap.so.db.catalog.beans.InstanceGroup expectedInstanceGroup = mapper.readValue( new File(RESOURCE_PATH + "InstanceGroup.json"), org.onap.so.db.catalog.beans.InstanceGroup.class); - doReturn(expectedInstanceGroup).when(MOCK_catalogDbClient).getInstanceGroupByModelUUID(isA(String.class)); + doReturn(expectedInstanceGroup).when(MOCK_catalogDbClient).getInstanceGroupByModelUUID(modelUUID); - org.onap.so.db.catalog.beans.InstanceGroup actualInstanceGroup = - bbInputSetupUtils.getCatalogInstanceGroup(modelUUID); - - assertThat(actualInstanceGroup, sameBeanAs(expectedInstanceGroup)); + assertThat(bbInputSetupUtils.getCatalogInstanceGroup(modelUUID), sameBeanAs(expectedInstanceGroup)); } @Test - public void testGetCollectionResourceInstanceGroupCustomization() { - String modelCustomizationUUID = "modelCustomizationUUID"; - + public void getCollectionResourceInstanceGroupCustomizationTest() { + final String modelCustomizationUUID = "modelCustomizationUUID"; CollectionResourceInstanceGroupCustomization expectedCollection = new CollectionResourceInstanceGroupCustomization(); doReturn(Arrays.asList(expectedCollection)).when(MOCK_catalogDbClient) .getCollectionResourceInstanceGroupCustomizationByModelCustUUID(modelCustomizationUUID); - List<CollectionResourceInstanceGroupCustomization> actualCollection = - bbInputSetupUtils.getCollectionResourceInstanceGroupCustomization(modelCustomizationUUID); - - assertThat(actualCollection, sameBeanAs(Arrays.asList(expectedCollection))); + assertThat(bbInputSetupUtils.getCollectionResourceInstanceGroupCustomization(modelCustomizationUUID), + sameBeanAs(Arrays.asList(expectedCollection))); } @Test - public void testGetAAIGenericVnf() throws JsonParseException, JsonMappingException, IOException { - String vnfId = "vnfId"; - - GenericVnf expectedAaiVnf = - mapper.readValue(new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), GenericVnf.class); - - doReturn(Optional.of(expectedAaiVnf)).when(MOCK_aaiResourcesClient).get(isA(Class.class), - isA(AAIResourceUri.class)); - AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE); - GenericVnf actualAaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); - - assertThat(actualAaiVnf, sameBeanAs(expectedAaiVnf)); - - verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.GenericVnf.class, expectedUri); + public void getAAIConfigurationNullTest() { + assertNull(bbInputSetupUtils.getAAIConfiguration("")); } @Test - public void testGetAAIConfiguration() throws JsonParseException, JsonMappingException, IOException { - String configurationId = "configurationId"; - + public void getAAIConfigurationTest() throws IOException { + final String configurationId = "configurationId"; Configuration expectedAaiConfiguration = mapper.readValue(new File(RESOURCE_PATH + "ConfigurationInput.json"), Configuration.class); doReturn(Optional.of(expectedAaiConfiguration)).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); - AAIResourceUri expectedUri = - AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId).depth(Depth.ONE); - bbInputSetupUtils.getAAIConfiguration(configurationId); - verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Configuration.class, expectedUri); + assertThat(bbInputSetupUtils.getAAIConfiguration(configurationId), sameBeanAs(expectedAaiConfiguration)); } @Test - public void testGetAAIGenericVnfThrowNotFound() throws JsonParseException, JsonMappingException, IOException { - String vnfId = "vnfId"; + public void getAAIGenericVnfNullTest() { + assertNull(bbInputSetupUtils.getAAIGenericVnf("")); + } - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(isA(Class.class), isA(AAIResourceUri.class)); + @Test + public void getAAIGenericVnfTest() throws IOException { + final String vnfId = "vnfId"; + GenericVnf expectedAaiVnf = + mapper.readValue(new File(RESOURCE_PATH + "aaiGenericVnfInput.json"), GenericVnf.class); - GenericVnf actualAaiVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); + doReturn(Optional.of(expectedAaiVnf)).when(MOCK_aaiResourcesClient).get(isA(Class.class), + eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).depth(Depth.ONE))); - assertNull(actualAaiVnf); + assertThat(bbInputSetupUtils.getAAIGenericVnf(vnfId), sameBeanAs(expectedAaiVnf)); } @Test - public void testGetAAIResourceDepthOne() { - String vnfId = "vnfId"; - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + public void getAAIResourceDepthOneTest() { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId"); AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.ONE); AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); + bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri); verify(MOCK_aaiResourcesClient, times(1)).get(expectedUri); @@ -612,11 +466,11 @@ public class BBInputSetupUtilsTest { } @Test - public void testGetAAIResourceDepthTwo() { - String vnfId = "vnfId"; - AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + public void getAAIResourceDepthTwoTest() { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "anyVnfId"); AAIResourceUri expectedUri = aaiResourceUri.clone().depth(Depth.TWO); AAIResourceUri aaiResourceUriClone = aaiResourceUri.clone(); + bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri); verify(MOCK_aaiResourcesClient, times(1)).get(expectedUri); @@ -625,25 +479,33 @@ public class BBInputSetupUtilsTest { @Test public void getRelatedNetworkByNameFromServiceInstanceTest() throws Exception { + final String networkId = "id123"; + final String networkName = "name123"; + Optional<L3Networks> expected = Optional.of(new L3Networks()); L3Network network = new L3Network(); - network.setNetworkId("id123"); - network.setNetworkName("name123"); + network.setNetworkId(networkId); + network.setNetworkName(networkName); expected.get().getL3Network().add(network); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); Optional<L3Network> actual = - this.bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance("id123", "name123"); - assertEquals(actual.get().getNetworkId(), expected.get().getL3Network().get(0).getNetworkId()); + bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(networkId, networkName); + + assertTrue(actual.isPresent()); + assertEquals(networkId, actual.get().getNetworkId()); + assertEquals(networkName, actual.get().getNetworkName()); + assertEquals(expected.get().getL3Network().get(0).getNetworkId(), actual.get().getNetworkId()); } @Test public void getRelatedNetworkByNameFromServiceInstanceMultipleNetworksExceptionTest() throws Exception { + final String serviceInstanceId = "serviceInstanceId"; + final String networkName = "networkName"; expectedException.expect(MultipleObjectsFoundException.class); - expectedException.expectMessage(containsString( - "Multiple networks found for service-instance-id: serviceInstanceId and network-name: networkName.")); - - String serviceInstanceId = "serviceInstanceId"; - String networkName = "networkName"; + expectedException.expectMessage( + String.format("Multiple networks found for service-instance-id: %s and network-name: %s.", + serviceInstanceId, networkName)); L3Network network = new L3Network(); network.setNetworkId("id123"); @@ -661,15 +523,7 @@ public class BBInputSetupUtilsTest { @Test public void getRelatedNetworkByNameFromServiceInstanceNotFoundTest() throws Exception { - String serviceInstanceId = "serviceInstanceId"; - String networkName = "networkName"; - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(L3Networks.class), any(AAIResourceUri.class)); - - Optional<L3Network> actualNetwork = - bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance(serviceInstanceId, networkName); - - assertEquals(Optional.empty(), actualNetwork); + assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedNetworkByNameFromServiceInstance("", "")); } @Test @@ -682,13 +536,19 @@ public class BBInputSetupUtilsTest { doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class)); Optional<ServiceInstance> actual = this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001"); - assertEquals(actual.get().getServiceInstanceId(), - expected.get().getServiceInstance().get(0).getServiceInstanceId()); + + assertTrue(actual.isPresent()); + assertEquals(expected.get().getServiceInstance().get(0).getServiceInstanceId(), + actual.get().getServiceInstanceId()); } @Test - public void getRelatedServiceInstanceFromInstanceGroupMultipleTest() throws Exception { + public void getRelatedServiceInstanceFromInstanceGroupMultipleExceptionTest() throws Exception { + final String instanceGroupId = "ig-001"; expectedException.expect(MultipleObjectsFoundException.class); + expectedException.expectMessage( + String.format("Mulitple service instances were found for instance-group-id: %s.", instanceGroupId)); + Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances()); ServiceInstance si1 = Mockito.mock(ServiceInstance.class); ServiceInstance si2 = Mockito.mock(ServiceInstance.class); @@ -697,39 +557,46 @@ public class BBInputSetupUtilsTest { doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class)); - this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001"); + bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup(instanceGroupId); } @Test - public void getRelatedServiceInstanceFromInstanceGroupNotFoundTest() throws Exception { + public void getRelatedServiceInstanceFromInstanceGroupNotFoundExceptionTest() throws Exception { expectedException.expect(NoServiceInstanceFoundException.class); + expectedException.expectMessage("No ServiceInstances Returned"); + Optional<ServiceInstances> serviceInstances = Optional.of(new ServiceInstances()); doReturn(serviceInstances).when(MOCK_aaiResourcesClient).get(eq(ServiceInstances.class), any(AAIResourceUri.class)); - this.bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001"); + bbInputSetupUtils.getRelatedServiceInstanceFromInstanceGroup("ig-001"); } @Test public void getRelatedVnfByNameFromServiceInstanceTest() throws Exception { + final String vnfId = "id123"; + final String vnfName = "name123"; + Optional<GenericVnfs> expected = Optional.of(new GenericVnfs()); GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("id123"); - vnf.setVnfName("name123"); + vnf.setVnfId(vnfId); + vnf.setVnfName(vnfName); expected.get().getGenericVnf().add(vnf); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); - Optional<GenericVnf> actual = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance("id123", "name123"); - assertEquals(actual.get().getVnfId(), expected.get().getGenericVnf().get(0).getVnfId()); + Optional<GenericVnf> actual = this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(vnfId, vnfName); + + assertTrue(actual.isPresent()); + assertEquals(expected.get().getGenericVnf().get(0).getVnfId(), actual.get().getVnfId()); } @Test public void getRelatedVnfByNameFromServiceInstanceMultipleVnfsExceptionTest() throws Exception { + final String serviceInstanceId = "serviceInstanceId"; + final String vnfName = "vnfName"; expectedException.expect(MultipleObjectsFoundException.class); - expectedException.expectMessage(containsString( - "Multiple vnfs found for service-instance-id: serviceInstanceId and vnf-name: vnfName.")); - - String serviceInstanceId = "serviceInstanceId"; - String vnfName = "vnfName"; + expectedException.expectMessage(String.format( + "Multiple vnfs found for service-instance-id: %s and vnf-name: %s.", serviceInstanceId, vnfName)); GenericVnf vnf = new GenericVnf(); vnf.setVnfId("id123"); @@ -740,7 +607,6 @@ public class BBInputSetupUtilsTest { vnfs.getGenericVnf().add(vnf); Optional<GenericVnfs> optVnfs = Optional.of(vnfs); - doReturn(optVnfs).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName); @@ -748,38 +614,38 @@ public class BBInputSetupUtilsTest { @Test public void getRelatedVnfByNameFromServiceInstanceNotFoundTest() throws Exception { - String serviceInstanceId = "serviceInstanceId"; - String vnfName = "vnfName"; - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(GenericVnfs.class), any(AAIResourceUri.class)); - - Optional<GenericVnf> actualVnf = - this.bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName); + final String serviceInstanceId = "serviceInstanceId"; + final String vnfName = "vnfName"; - assertEquals(actualVnf, Optional.empty()); + assertEquals(Optional.empty(), + bbInputSetupUtils.getRelatedVnfByNameFromServiceInstance(serviceInstanceId, vnfName)); } @Test public void getRelatedVolumeGroupByNameFromVnfTest() throws Exception { + final String vnfId = "id123"; + final String vnfName = "name123"; + Optional<VolumeGroups> expected = Optional.of(new VolumeGroups()); VolumeGroup volumeGroup = new VolumeGroup(); - volumeGroup.setVolumeGroupId("id123"); - volumeGroup.setVolumeGroupName("name123"); + volumeGroup.setVolumeGroupId(vnfId); + volumeGroup.setVolumeGroupName(vnfName); expected.get().getVolumeGroup().add(volumeGroup); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123", "name123"); - assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); + Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, vnfName); + + assertTrue(actual.isPresent()); + assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId()); } @Test public void getRelatedVolumeGroupByNameFromVnfMultipleVolumeGroupsExceptionTest() throws Exception { + final String vnfId = "vnfId"; + final String volumeGroupName = "volumeGroupName"; expectedException.expect(MultipleObjectsFoundException.class); - expectedException.expectMessage(containsString( - "Multiple volume-groups found for vnf-id: vnfId and volume-group-name: volumeGroupName.")); - - - String vnfId = "vnfId"; - String volumeGroupName = "volumeGroupName"; + expectedException.expectMessage(String.format( + "Multiple volume-groups found for vnf-id: %s and volume-group-name: %s.", vnfId, volumeGroupName)); VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("id123"); @@ -797,15 +663,7 @@ public class BBInputSetupUtilsTest { @Test public void getRelatedVolumeGroupByNameFromVnfNotFoundTest() throws Exception { - String vnfId = "vnfId"; - String volumeGroupName = "volumeGroupName"; - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - - Optional<VolumeGroup> actualVolumeGroup = - bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(vnfId, volumeGroupName); - - assertEquals(actualVolumeGroup, Optional.empty()); + assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf("", "")); } @Test @@ -815,18 +673,20 @@ public class BBInputSetupUtilsTest { volumeGroup.setVolumeGroupId("id123"); volumeGroup.setVolumeGroupName("name123"); expected.get().getVolumeGroup().add(volumeGroup); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123", "id123", "name123"); - assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); + + assertTrue(actual.isPresent()); + assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId()); } @Test public void getRelatedVolumeGroupFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception { expectedException.expect(Exception.class); - - String vnfId = "vnfId"; - String volumeGroupId = "volumeGroupId"; + final String vnfId = "vnfId"; + final String volumeGroupId = "volumeGroupId"; VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("id123"); @@ -844,15 +704,10 @@ public class BBInputSetupUtilsTest { @Test public void getRelatedVolumeGroupFromVfModuleNotFoundTest() throws Exception { - String vnfId = "vnfId"; - String volumeGroupId = "volumeGroupId"; - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - - Optional<VolumeGroup> actualVolumeGroup = - bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId); + final String vnfId = "vnfId"; + final String volumeGroupId = "volumeGroupId"; - assertEquals(actualVolumeGroup, Optional.empty()); + assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, volumeGroupId)); } @Test @@ -861,19 +716,24 @@ public class BBInputSetupUtilsTest { VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("id123"); expected.get().getVolumeGroup().add(volumeGroup); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - Optional<VolumeGroup> actual = this.bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("id123", "id123"); - assertEquals(actual.get().getVolumeGroupId(), expected.get().getVolumeGroup().get(0).getVolumeGroupId()); + Optional<VolumeGroup> actual = bbInputSetupUtils.getRelatedVolumeGroupFromVfModule("id123", "id123"); + + assertTrue(actual.isPresent()); + assertEquals(expected.get().getVolumeGroup().get(0).getVolumeGroupId(), actual.get().getVolumeGroupId()); } @Test public void getRelatedVolumeGroupByNameFromVfModuleMultipleVolumeGroupsExceptionTest() throws Exception { + final String vnfId = "vnfId"; + final String vfModuleId = "vfModuleId"; + final String volumeGroupName = "volumeGroupName"; + expectedException.expect(MultipleObjectsFoundException.class); - expectedException.expectMessage(containsString( - "Multiple voulme-groups found for vnf-id: vnfId, vf-module-id: volumeGroupId and volume-group-name: volumeGroupName.")); - String vnfId = "vnfId"; - String volumeGroupId = "volumeGroupId"; - String volumeGroupName = "volumeGroupName"; + expectedException.expectMessage(String.format( + "Multiple voulme-groups found for vnf-id: %s, vf-module-id: %s and volume-group-name: %s.", vnfId, + vfModuleId, volumeGroupName)); VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setVolumeGroupId("id123"); @@ -884,54 +744,39 @@ public class BBInputSetupUtilsTest { volumeGroups.getVolumeGroup().add(volumeGroup); Optional<VolumeGroups> optVolumeGroups = Optional.of(volumeGroups); - doReturn(optVolumeGroups).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); + bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, vfModuleId, volumeGroupName); } @Test public void getRelatedVolumeGroupByNameFromVfModuleNotFoundTest() throws Exception { - String vnfId = "vnfId"; - String volumeGroupId = "volumeGroupId"; - String volumeGroupName = "volumeGroupName"; - - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(VolumeGroups.class), any(AAIResourceUri.class)); - - Optional<VolumeGroup> actualVolumeGroup = - bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule(vnfId, volumeGroupId, volumeGroupName); - - assertEquals(actualVolumeGroup, Optional.empty()); + assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedVolumeGroupByNameFromVfModule("", "", "")); } - @Test - public void loadOriginalFlowExecutionPathTest() throws Exception { - - String requestId = "123"; - String flowsToExecuteString = - "[{\"buildingBlock\":{\"mso-id\":\"2f9ddc4b-4dcf-4129-a35f-be1625ae0176\",\"bpmn-flow-name\":\"DeactivateFabricConfigurationBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":{\"vfModuleCustomizationUUID\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"vnfResourceCustomizationUUID\":\"a80f05b8-d651-44af-b999-8ed78fb4582f\",\"cvnfcCustomizationUUID\":\"69cce457-9ffd-4359-962b-0596a1e83ad1\",\"vnfcName\":\"zauk51bmcmr01mcm001\"}},{\"buildingBlock\":{\"mso-id\":\"1ca5584e-38a9-4c3f-a4b4-99b0d42089ba\",\"bpmn-flow-name\":\"UnassignFabricConfigurationBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":{\"vfModuleCustomizationUUID\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"vnfResourceCustomizationUUID\":\"a80f05b8-d651-44af-b999-8ed78fb4582f\",\"cvnfcCustomizationUUID\":\"69cce457-9ffd-4359-962b-0596a1e83ad1\",\"vnfcName\":\"zauk51bmcmr01mcm001\"}},{\"buildingBlock\":{\"mso-id\":\"68d16097-4810-477d-803b-8322106106ef\",\"bpmn-flow-name\":\"DeactivateVfModuleBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":null},{\"buildingBlock\":{\"mso-id\":\"0b02eb09-bc23-4329-b19e-716dcca4e4a6\",\"bpmn-flow-name\":\"DeleteVfModuleBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":null},{\"buildingBlock\":{\"mso-id\":\"bcf95d05-0782-44ff-920d-d5100525c275\",\"bpmn-flow-name\":\"UnassignVfModuleBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":null}]"; - ObjectMapper om = new ObjectMapper(); - List<ExecuteBuildingBlock> expectedFlowsToExecute = null; - try { - ExecuteBuildingBlock[] asArray = om.readValue(flowsToExecuteString, ExecuteBuildingBlock[].class); - expectedFlowsToExecute = Arrays.asList(asArray); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + public void loadOriginalFlowExecutionPathTest() throws IOException { + final String requestId = "123"; + final String originalRequestId = "originalRequestId"; + final String flowsToExecuteString = new String( + Files.readAllBytes(Paths.get(RESOURCE_PATH + "FlowsToExecute.json")), StandardCharsets.UTF_8); InfraActiveRequests request = new InfraActiveRequests(); - request.setRequestId("requestId"); - request.setOriginalRequestId("originalRequestId"); - doReturn(request).when(MOCK_requestsDbClient).getInfraActiveRequestbyRequestId(anyString()); - RequestProcessingData rpd = new RequestProcessingData(); - rpd.setValue(flowsToExecuteString); - doReturn(rpd).when(MOCK_requestsDbClient).getRequestProcessingDataBySoRequestIdAndName(anyString(), - anyString()); + ExecuteBuildingBlock[] expectedFlowsToExecute = + mapper.readValue(flowsToExecuteString, ExecuteBuildingBlock[].class); + + request.setRequestId(requestId); + request.setOriginalRequestId(originalRequestId); + doReturn(request).when(MOCK_requestsDbClient).getInfraActiveRequestbyRequestId(requestId); + + RequestProcessingData requestProcessingData = new RequestProcessingData(); + requestProcessingData.setValue(flowsToExecuteString); + doReturn(requestProcessingData).when(MOCK_requestsDbClient) + .getRequestProcessingDataBySoRequestIdAndName(anyString(), anyString()); List<ExecuteBuildingBlock> flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId); - assertEquals(expectedFlowsToExecute.size(), flowsToExecute.size()); + + assertEquals(mapper.writeValueAsString(expectedFlowsToExecute), mapper.writeValueAsString(flowsToExecute)); } @Test @@ -954,11 +799,7 @@ public class BBInputSetupUtilsTest { @Test public void getRelatedConfigurationByNameFromServiceInstanceNotFoundTest() throws Exception { - doReturn(Optional.empty()).when(MOCK_aaiResourcesClient).get(eq(Configurations.class), - any(AAIResourceUri.class)); - Optional<Configuration> actualConfiguration = - bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("id123", "name123"); - assertEquals(actualConfiguration, Optional.empty()); + assertEquals(Optional.empty(), bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("", "")); } @Test @@ -967,40 +808,47 @@ public class BBInputSetupUtilsTest { Configuration configuration = new Configuration(); configuration.setConfigurationId("id123"); expected.get().getConfiguration().add(configuration); + doReturn(expected).when(MOCK_aaiResourcesClient).get(eq(Configurations.class), any(AAIResourceUri.class)); Optional<Configuration> actual = this.bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance("id123", "name123"); - assertEquals(actual.get().getConfigurationId(), expected.get().getConfiguration().get(0).getConfigurationId()); + + assertTrue(actual.isPresent()); + assertEquals(expected.get().getConfiguration().get(0).getConfigurationId(), actual.get().getConfigurationId()); } @Test - public void existsAAIVfModuleGloballyByNameTest() throws Exception { + public void existsAAIVfModuleGloballyByNameTest() { AAIResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE).queryParam("vf-module-name", "testVfModule"); bbInputSetupUtils.existsAAIVfModuleGloballyByName("testVfModule"); + verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri); } @Test - public void existsAAIConfigurationGloballyByNameTest() throws Exception { + public void existsAAIConfigurationGloballyByNameTest() { AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION) .queryParam("configuration-name", "testConfig"); bbInputSetupUtils.existsAAIConfigurationGloballyByName("testConfig"); + verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri); } @Test - public void existsAAINetworksGloballyByNameTest() throws Exception { + public void existsAAINetworksGloballyByNameTest() { AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "testNetwork"); bbInputSetupUtils.existsAAINetworksGloballyByName("testNetwork"); + verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri); } @Test - public void existsAAIVolumeGroupGloballyByNameTest() throws Exception { + public void existsAAIVolumeGroupGloballyByNameTest() { AAIResourceUri expectedUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) .queryParam("volume-group-name", "testVoumeGroup"); + bbInputSetupUtils.existsAAIVolumeGroupGloballyByName("testVoumeGroup"); verify(MOCK_aaiResourcesClient, times(1)).exists(expectedUri); } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json new file mode 100644 index 0000000000..fa271b9e8d --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/FlowsToExecute.json @@ -0,0 +1,292 @@ +[ + { + "buildingBlock": { + "mso-id": "2f9ddc4b-4dcf-4129-a35f-be1625ae0176", + "bpmn-flow-name": "DeactivateFabricConfigurationBB", + "key": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "is-virtual-link": false, + "virtual-link-key": null + }, + "requestId": "9c944122-d161-4280-8594-48c06a9d96d5", + "apiVersion": "7", + "resourceId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "requestAction": "deleteInstance", + "vnfType": "", + "aLaCarte": true, + "homing": false, + "workflowResourceIds": { + "serviceInstanceId": "ff9dae72-05bb-4277-ad2b-1b082467c138", + "vnfId": "84a29830-e533-4f20-a838-910c740bf24c", + "networkId": "", + "volumeGroupId": "", + "vfModuleId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "networkCollectionId": null, + "configurationId": "10f8a3a3-91bf-4821-9515-c01b2864dff0", + "instanceGroupId": "" + }, + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelInvariantId": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelType": "vfModule", + "modelId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelVersion": "1", + "modelCustomizationUuid": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelVersionId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelCustomizationId": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelUuid": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelInvariantUuid": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelInstanceName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false, + "requestorId": "pj8646" + }, + "cloudConfiguration": { + "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a", + "cloudOwner": "att-nc", + "lcpCloudRegionId": "auk51b" + }, + "requestParameters": { + "testApi": "GR_API" + } + }, + "configurationResourceKeys": { + "vfModuleCustomizationUUID": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "vnfResourceCustomizationUUID": "a80f05b8-d651-44af-b999-8ed78fb4582f", + "cvnfcCustomizationUUID": "69cce457-9ffd-4359-962b-0596a1e83ad1", + "vnfcName": "zauk51bmcmr01mcm001" + } + }, + { + "buildingBlock": { + "mso-id": "1ca5584e-38a9-4c3f-a4b4-99b0d42089ba", + "bpmn-flow-name": "UnassignFabricConfigurationBB", + "key": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "is-virtual-link": false, + "virtual-link-key": null + }, + "requestId": "9c944122-d161-4280-8594-48c06a9d96d5", + "apiVersion": "7", + "resourceId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "requestAction": "deleteInstance", + "vnfType": "", + "aLaCarte": true, + "homing": false, + "workflowResourceIds": { + "serviceInstanceId": "ff9dae72-05bb-4277-ad2b-1b082467c138", + "vnfId": "84a29830-e533-4f20-a838-910c740bf24c", + "networkId": "", + "volumeGroupId": "", + "vfModuleId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "networkCollectionId": null, + "configurationId": "10f8a3a3-91bf-4821-9515-c01b2864dff0", + "instanceGroupId": "" + }, + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelInvariantId": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelType": "vfModule", + "modelId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelVersion": "1", + "modelCustomizationUuid": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelVersionId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelCustomizationId": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelUuid": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelInvariantUuid": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelInstanceName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false, + "requestorId": "pj8646" + }, + "cloudConfiguration": { + "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a", + "cloudOwner": "att-nc", + "lcpCloudRegionId": "auk51b" + }, + "requestParameters": { + "testApi": "GR_API" + } + }, + "configurationResourceKeys": { + "vfModuleCustomizationUUID": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "vnfResourceCustomizationUUID": "a80f05b8-d651-44af-b999-8ed78fb4582f", + "cvnfcCustomizationUUID": "69cce457-9ffd-4359-962b-0596a1e83ad1", + "vnfcName": "zauk51bmcmr01mcm001" + } + }, + { + "buildingBlock": { + "mso-id": "68d16097-4810-477d-803b-8322106106ef", + "bpmn-flow-name": "DeactivateVfModuleBB", + "key": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "is-virtual-link": false, + "virtual-link-key": null + }, + "requestId": "9c944122-d161-4280-8594-48c06a9d96d5", + "apiVersion": "7", + "resourceId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "requestAction": "deleteInstance", + "vnfType": "", + "aLaCarte": true, + "homing": false, + "workflowResourceIds": { + "serviceInstanceId": "ff9dae72-05bb-4277-ad2b-1b082467c138", + "vnfId": "84a29830-e533-4f20-a838-910c740bf24c", + "networkId": "", + "volumeGroupId": "", + "vfModuleId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "networkCollectionId": null, + "configurationId": "10f8a3a3-91bf-4821-9515-c01b2864dff0", + "instanceGroupId": "" + }, + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelInvariantId": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelType": "vfModule", + "modelId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelVersion": "1", + "modelCustomizationUuid": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelVersionId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelCustomizationId": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelUuid": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelInvariantUuid": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelInstanceName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false, + "requestorId": "pj8646" + }, + "cloudConfiguration": { + "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a", + "cloudOwner": "att-nc", + "lcpCloudRegionId": "auk51b" + }, + "requestParameters": { + "testApi": "GR_API" + } + }, + "configurationResourceKeys": null + }, + { + "buildingBlock": { + "mso-id": "0b02eb09-bc23-4329-b19e-716dcca4e4a6", + "bpmn-flow-name": "DeleteVfModuleBB", + "key": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "is-virtual-link": false, + "virtual-link-key": null + }, + "requestId": "9c944122-d161-4280-8594-48c06a9d96d5", + "apiVersion": "7", + "resourceId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "requestAction": "deleteInstance", + "vnfType": "", + "aLaCarte": true, + "homing": false, + "workflowResourceIds": { + "serviceInstanceId": "ff9dae72-05bb-4277-ad2b-1b082467c138", + "vnfId": "84a29830-e533-4f20-a838-910c740bf24c", + "networkId": "", + "volumeGroupId": "", + "vfModuleId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "networkCollectionId": null, + "configurationId": "10f8a3a3-91bf-4821-9515-c01b2864dff0", + "instanceGroupId": "" + }, + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelInvariantId": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelType": "vfModule", + "modelId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelVersion": "1", + "modelCustomizationUuid": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelVersionId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelCustomizationId": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelUuid": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelInvariantUuid": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelInstanceName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false, + "requestorId": "pj8646" + }, + "cloudConfiguration": { + "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a", + "cloudOwner": "att-nc", + "lcpCloudRegionId": "auk51b" + }, + "requestParameters": { + "testApi": "GR_API" + } + }, + "configurationResourceKeys": null + }, + { + "buildingBlock": { + "mso-id": "bcf95d05-0782-44ff-920d-d5100525c275", + "bpmn-flow-name": "UnassignVfModuleBB", + "key": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "is-virtual-link": false, + "virtual-link-key": null + }, + "requestId": "9c944122-d161-4280-8594-48c06a9d96d5", + "apiVersion": "7", + "resourceId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "requestAction": "deleteInstance", + "vnfType": "", + "aLaCarte": true, + "homing": false, + "workflowResourceIds": { + "serviceInstanceId": "ff9dae72-05bb-4277-ad2b-1b082467c138", + "vnfId": "84a29830-e533-4f20-a838-910c740bf24c", + "networkId": "", + "volumeGroupId": "", + "vfModuleId": "d1d35800-783d-42d3-82f6-d654c5054a6e", + "networkCollectionId": null, + "configurationId": "10f8a3a3-91bf-4821-9515-c01b2864dff0", + "instanceGroupId": "" + }, + "requestDetails": { + "modelInfo": { + "modelCustomizationName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelInvariantId": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelType": "vfModule", + "modelId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0", + "modelVersion": "1", + "modelCustomizationUuid": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelVersionId": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelCustomizationId": "7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9", + "modelUuid": "00d15ebb-c80e-43c1-80f0-90c40dde70b0", + "modelInvariantUuid": "8028fcc0-96dc-427d-a4de-4536245943da", + "modelInstanceName": "McmrNcUpVnf20191..cr_mccm_fc_base..module-0" + }, + "requestInfo": { + "source": "VID", + "suppressRollback": false, + "requestorId": "pj8646" + }, + "cloudConfiguration": { + "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a", + "cloudOwner": "att-nc", + "lcpCloudRegionId": "auk51b" + }, + "requestParameters": { + "testApi": "GR_API" + } + }, + "configurationResourceKeys": null + } +]
\ No newline at end of file diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index 70365b744c..25f7c4b93f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -75,9 +75,8 @@ public class WorkflowProcessor extends ProcessEngineAwareService { } } - // Note: the business key is used to identify the process in unit tests protected static String getBusinessKey(Map<String, Object> inputVariables) { - return getOrCreate(inputVariables, "mso-business-key"); + return getOrCreate(inputVariables, "mso-request-id"); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java new file mode 100644 index 0000000000..80d86ad009 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListener.java @@ -0,0 +1,30 @@ +package org.onap.so.bpmn.core.plugins; + +import org.camunda.bpm.engine.impl.bpmn.behavior.CallableElementActivityBehavior; +import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener; +import org.camunda.bpm.engine.impl.context.Context; +import org.camunda.bpm.engine.impl.core.model.CallableElement; +import org.camunda.bpm.engine.impl.el.ElValueProvider; +import org.camunda.bpm.engine.impl.el.Expression; +import org.camunda.bpm.engine.impl.el.ExpressionManager; +import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl; +import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl; +import org.camunda.bpm.engine.impl.util.xml.Element; +import org.springframework.stereotype.Component; + + +@Component +public class CallActivityBusinessKeyParseListener extends AbstractBpmnParseListener { + + @Override + public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) { + ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager(); + Expression expression = expressionManager.createExpression("#{execution.processBusinessKey}"); + ElValueProvider p = new ElValueProvider(expression); + CallableElementActivityBehavior callableElementActivityBehavior = + (CallableElementActivityBehavior) activity.getActivityBehavior(); + CallableElement callableElement = (CallableElement) callableElementActivityBehavior.getCallableElement(); + callableElement.setBusinessKeyValueProvider(p); + callableElementActivityBehavior.setCallableElement(callableElement); + } +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java new file mode 100644 index 0000000000..a2d897e367 --- /dev/null +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/CallActivityBusinessKeyParseListenerPlugin.java @@ -0,0 +1,24 @@ +package org.onap.so.bpmn.core.plugins; + +import java.util.ArrayList; +import java.util.List; +import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener; +import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin; +import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.springframework.stereotype.Component; + + +@Component +public class CallActivityBusinessKeyParseListenerPlugin extends AbstractProcessEnginePlugin { + + @Override + public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { + List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners(); + if (preParseListeners == null) { + preParseListeners = new ArrayList<>(); + processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners); + } + preParseListeners.add(new CallActivityBusinessKeyParseListener()); + } + +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index 93f98a34a6..0161422b64 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -1534,6 +1534,18 @@ public abstract class WorkflowTest { } } + protected Object getVariableFromHistoryByProcessInstanceId(String processInstanceId, String variableName) { + try { + HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery() + .processInstanceId(processInstanceId).variableName(variableName).singleResult(); + return v == null ? null : v.getValue(); + } catch (Exception e) { + logger.debug("Error retrieving variable {} from historical process with processInstanceId {}: ", + variableName, processInstanceId, e); + return null; + } + } + /** * Gets a variable value from a process instance based on businessKey and process name. Must be used when multiple * instances exist with the same business key such as when business key is passed to subflows or shared across diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn index 7c86e964ec..c48f8b4d10 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="3.1.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="AssignNetworkBB" name="AssignNetworkBB" isExecutable="true"> <bpmn2:startEvent id="AssignNetworkBB_start"> <bpmn2:outgoing>SequenceFlow_11op1ih</bpmn2:outgoing> @@ -21,7 +21,7 @@ <bpmn2:outgoing>SequenceFlow_0988gld</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:sequenceFlow id="SequenceFlow_017131q" name="Yes" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ExclusiveGateway_0vtj8n8"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{AssignNetwork.networkFoundByName(execution.getVariable("gBuildingBlockExecution")) == true}]]></bpmn2:conditionExpression> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression">#{AssignNetwork.networkFoundByName(execution.getVariable("gBuildingBlockExecution")) == true}</bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0gkr871" name="No" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ServiceTask_put_network_in_AAI" /> <bpmn2:endEvent id="AssignNetworkBB_end"> @@ -36,11 +36,11 @@ <bpmn2:incoming>SequenceFlow_0e08b9t</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0mxc4ri</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_1ctpnpe" sourceRef="ServiceTask_put_network_in_AAI" targetRef="ServiceTask_connect_to_Tenant" /> + <bpmn2:sequenceFlow id="SequenceFlow_1ctpnpe" sourceRef="ServiceTask_put_network_in_AAI" targetRef="ExclusiveGateway_0g85lk7" /> <bpmn2:sequenceFlow id="SequenceFlow_0e08b9t" sourceRef="ServiceTask_connect_to_NCIG" targetRef="ServiceTask_connect_to_NCSI" /> <bpmn2:sequenceFlow id="SequenceFlow_0mxc4ri" sourceRef="ServiceTask_connect_to_NCSI" targetRef="ExclusiveGateway_0vtj8n8" /> <bpmn2:serviceTask id="ServiceTask_connect_to_Tenant" name=" AAI Connect (tenant) " camunda:expression="${AAICreateTasks.connectNetworkToTenant(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> - <bpmn2:incoming>SequenceFlow_1ctpnpe</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0lj5jj1</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0fwcvep</bpmn2:outgoing> </bpmn2:serviceTask> <bpmn2:serviceTask id="ServiceTask_connect_to_CloudRegion" name=" AAI Connect (cloud region) " camunda:expression="${AAICreateTasks.connectNetworkToCloudRegion(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> @@ -54,11 +54,6 @@ <bpmn2:outgoing>SequenceFlow_017131q</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_0gkr871</bpmn2:outgoing> </bpmn2:inclusiveGateway> - <bpmn2:inclusiveGateway id="ExclusiveGateway_0vtj8n8"> - <bpmn2:incoming>SequenceFlow_017131q</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_0mxc4ri</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0jm95hf</bpmn2:outgoing> - </bpmn2:inclusiveGateway> <bpmn2:sequenceFlow id="SequenceFlow_0jm95hf" sourceRef="ExclusiveGateway_0vtj8n8" targetRef="ServiceTask_get_cloud_region" /> <bpmn2:sequenceFlow id="SequenceFlow_16hhbw3" sourceRef="ServiceTask_get_cloud_region" targetRef="ServiceTask_assign_network_sdnc" /> <bpmn2:sequenceFlow id="SequenceFlow_0988gld" sourceRef="ServiceTask_assign_network_aai" targetRef="AssignNetworkBB_end" /> @@ -74,11 +69,36 @@ </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_0rt36co" sourceRef="ServiceTask_assign_network_sdnc" targetRef="CallActivity_sdncHandlerCall" /> <bpmn2:sequenceFlow id="SequenceFlow_1mvf7b9" sourceRef="CallActivity_sdncHandlerCall" targetRef="ServiceTask_assign_network_aai" /> - <bpmn2:textAnnotation id="TextAnnotation_0dnksb2"> <bpmn2:text>sets Cloud Region on BB execution for SDNC assign</bpmn2:text> -</bpmn2:textAnnotation> + <bpmn2:serviceTask id="Task_0mu8391" name="Create Platform" camunda:expression="${AAICreateTasks.createPlatformForNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_1kslfgw</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0j7rpm9</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:serviceTask id="ServiceTask_0e2crgd" name="Create Lob" camunda:expression="${AAICreateTasks.createLineOfBusinessForNetwork(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn2:incoming>SequenceFlow_0j7rpm9</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0ugp99e</bpmn2:outgoing> + </bpmn2:serviceTask> + <bpmn2:sequenceFlow id="SequenceFlow_0lj5jj1" sourceRef="ExclusiveGateway_0g85lk7" targetRef="ServiceTask_connect_to_Tenant" /> + <bpmn2:sequenceFlow id="SequenceFlow_1kslfgw" sourceRef="ExclusiveGateway_0g85lk7" targetRef="Task_0mu8391" /> + <bpmn2:sequenceFlow id="SequenceFlow_0j7rpm9" sourceRef="Task_0mu8391" targetRef="ServiceTask_0e2crgd" /> + <bpmn2:sequenceFlow id="SequenceFlow_0ugp99e" sourceRef="ServiceTask_0e2crgd" targetRef="ExclusiveGateway_0vtj8n8" /> + <bpmn2:parallelGateway id="ExclusiveGateway_0g85lk7"> + <bpmn2:incoming>SequenceFlow_1ctpnpe</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0lj5jj1</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_1kslfgw</bpmn2:outgoing> + </bpmn2:parallelGateway> + <bpmn2:inclusiveGateway id="ExclusiveGateway_0vtj8n8"> + <bpmn2:incoming>SequenceFlow_017131q</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0mxc4ri</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0ugp99e</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0jm95hf</bpmn2:outgoing> + </bpmn2:inclusiveGateway> + <bpmn2:textAnnotation id="TextAnnotation_0dnksb2"> + <bpmn2:text>sets Cloud Region on BB execution for SDNC assign</bpmn2:text> + </bpmn2:textAnnotation> <bpmn2:association id="Association_1rsqd3z" sourceRef="ServiceTask_get_cloud_region" targetRef="TextAnnotation_0dnksb2" /> - <bpmn2:textAnnotation id="TextAnnotation_17jb2vn"> <bpmn2:text>conditionally executed if Network Collection Instance Group exists</bpmn2:text> -</bpmn2:textAnnotation> + <bpmn2:textAnnotation id="TextAnnotation_17jb2vn"> + <bpmn2:text>conditionally executed if Network Collection Instance Group exists</bpmn2:text> + </bpmn2:textAnnotation> <bpmn2:association id="Association_15ppe1t" sourceRef="ServiceTask_connect_to_NCIG" targetRef="TextAnnotation_17jb2vn" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> @@ -86,165 +106,190 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignNetworkBB"> <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="AssignNetworkBB_start"> - <dc:Bounds x="746" y="-105" width="36" height="36" /> + <dc:Bounds x="156" y="137" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="739" y="-64" width="50" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1wo7ke9_di" bpmnElement="ServiceTask_get_cloud_region"> - <dc:Bounds x="1632" y="-127" width="100" height="80" /> + <dc:Bounds x="1042" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1ofnl0p_di" bpmnElement="ServiceTask_assign_network_sdnc"> - <dc:Bounds x="1769" y="-127" width="100" height="80" /> + <dc:Bounds x="1179" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_0dnksb2_di" bpmnElement="TextAnnotation_0dnksb2"> - <dc:Bounds x="1576" y="35" width="212" height="30" /> + <dc:Bounds x="986" y="242" width="212" height="30" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_1rsqd3z_di" bpmnElement="Association_1rsqd3z"> - <di:waypoint xsi:type="dc:Point" x="1682" y="-47" /> - <di:waypoint xsi:type="dc:Point" x="1682" y="35" /> + <di:waypoint x="1092" y="195" /> + <di:waypoint x="1092" y="242" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_1dm3ngd_di" bpmnElement="ServiceTask_put_network_in_AAI"> - <dc:Bounds x="906" y="-49" width="100" height="80" /> + <dc:Bounds x="316" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_18yks1p_di" bpmnElement="ServiceTask_assign_network_aai"> - <dc:Bounds x="2106" y="-127" width="100" height="80" /> + <dc:Bounds x="1516" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_017131q_di" bpmnElement="SequenceFlow_017131q"> - <di:waypoint xsi:type="dc:Point" x="863" y="-112" /> - <di:waypoint xsi:type="dc:Point" x="863" y="-161" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="-161" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="-112" /> + <di:waypoint x="273" y="130" /> + <di:waypoint x="273" y="81" /> + <di:waypoint x="972" y="81" /> + <di:waypoint x="972" y="130" /> <bpmndi:BPMNLabel> - <dc:Bounds x="871.5" y="-151.96931534232883" width="19" height="12" /> + <dc:Bounds x="282" y="90" width="18" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0gkr871_di" bpmnElement="SequenceFlow_0gkr871"> - <di:waypoint xsi:type="dc:Point" x="863" y="-62" /> - <di:waypoint xsi:type="dc:Point" x="863" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="906" y="-9" /> + <di:waypoint x="273" y="180" /> + <di:waypoint x="273" y="233" /> + <di:waypoint x="316" y="233" /> <bpmndi:BPMNLabel> - <dc:Bounds x="872.125" y="-36.06410256410257" width="14" height="12" /> + <dc:Bounds x="282" y="206" width="15" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_083u1a5_di" bpmnElement="AssignNetworkBB_end"> - <dc:Bounds x="2241" y="-105" width="36" height="36" /> + <dc:Bounds x="1651" y="137" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="2214" y="-65" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_11op1ih_di" bpmnElement="SequenceFlow_11op1ih"> - <di:waypoint xsi:type="dc:Point" x="782" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="838" y="-87" /> + <di:waypoint x="192" y="155" /> + <di:waypoint x="248" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="765" y="-102" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0a96yhg_di" bpmnElement="ServiceTask_connect_to_NCIG"> - <dc:Bounds x="1286" y="-49" width="100" height="80" /> + <dc:Bounds x="743" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_0mauyto_di" bpmnElement="ServiceTask_connect_to_NCSI"> - <dc:Bounds x="1422" y="-49" width="100" height="80" /> + <dc:Bounds x="867" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1ctpnpe_di" bpmnElement="SequenceFlow_1ctpnpe"> - <di:waypoint xsi:type="dc:Point" x="1006" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1036" y="-9" /> + <di:waypoint x="416" y="232" /> + <di:waypoint x="421" y="232" /> <bpmndi:BPMNLabel> <dc:Bounds x="976" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0e08b9t_di" bpmnElement="SequenceFlow_0e08b9t"> - <di:waypoint xsi:type="dc:Point" x="1386" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1422" y="-9" /> + <di:waypoint x="843" y="233" /> + <di:waypoint x="867" y="233" /> <bpmndi:BPMNLabel> <dc:Bounds x="1359" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0mxc4ri_di" bpmnElement="SequenceFlow_0mxc4ri"> - <di:waypoint xsi:type="dc:Point" x="1522" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1562" y="-62" /> + <di:waypoint x="917" y="193" /> + <di:waypoint x="956" y="164" /> <bpmndi:BPMNLabel> <dc:Bounds x="1497" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_019bzpc_di" bpmnElement="ServiceTask_connect_to_Tenant"> - <dc:Bounds x="1036" y="-49" width="100" height="80" /> + <dc:Bounds x="515" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ServiceTask_1alvmym_di" bpmnElement="ServiceTask_connect_to_CloudRegion"> - <dc:Bounds x="1162" y="-49" width="100" height="80" /> + <dc:Bounds x="622" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fwcvep_di" bpmnElement="SequenceFlow_0fwcvep"> - <di:waypoint xsi:type="dc:Point" x="1136" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1162" y="-9" /> + <di:waypoint x="565" y="193" /> + <di:waypoint x="565" y="173" /> + <di:waypoint x="672" y="173" /> + <di:waypoint x="672" y="193" /> <bpmndi:BPMNLabel> <dc:Bounds x="1104" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_07z7hcu_di" bpmnElement="SequenceFlow_07z7hcu"> - <di:waypoint xsi:type="dc:Point" x="1262" y="-9" /> - <di:waypoint xsi:type="dc:Point" x="1286" y="-9" /> + <di:waypoint x="722" y="233" /> + <di:waypoint x="743" y="233" /> <bpmndi:BPMNLabel> <dc:Bounds x="1229" y="-24" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="TextAnnotation_17jb2vn_di" bpmnElement="TextAnnotation_17jb2vn"> - <dc:Bounds x="1232" y="86" width="158" height="54" /> + <dc:Bounds x="777" y="288" width="158" height="54" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="Association_15ppe1t_di" bpmnElement="Association_15ppe1t"> - <di:waypoint xsi:type="dc:Point" x="1306" y="31" /> - <di:waypoint xsi:type="dc:Point" x="1267" y="86" /> + <di:waypoint x="793" y="273" /> + <di:waypoint x="793" y="288" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="InclusiveGateway_0kiphfm_di" bpmnElement="networkFoundByName_ExclusiveGateway"> - <dc:Bounds x="838" y="-112" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="898" y="-104" width="73" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="InclusiveGateway_0pxktc3_di" bpmnElement="ExclusiveGateway_0vtj8n8"> - <dc:Bounds x="1537" y="-112" width="50" height="50" /> + <dc:Bounds x="248" y="130" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1562" y="-58" width="0" height="12" /> + <dc:Bounds x="308" y="138" width="73" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0jm95hf_di" bpmnElement="SequenceFlow_0jm95hf"> - <di:waypoint xsi:type="dc:Point" x="1587" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="1632" y="-87" /> + <di:waypoint x="997" y="155" /> + <di:waypoint x="1042" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="1609.5" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_16hhbw3_di" bpmnElement="SequenceFlow_16hhbw3"> - <di:waypoint xsi:type="dc:Point" x="1732" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="1769" y="-87" /> + <di:waypoint x="1142" y="155" /> + <di:waypoint x="1179" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="1750.5" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0988gld_di" bpmnElement="SequenceFlow_0988gld"> - <di:waypoint xsi:type="dc:Point" x="2206" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="2241" y="-87" /> + <di:waypoint x="1616" y="155" /> + <di:waypoint x="1651" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="2178.5" y="-108" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_0h7upeg_di" bpmnElement="CallActivity_sdncHandlerCall"> - <dc:Bounds x="1927" y="-127" width="100" height="80" /> + <dc:Bounds x="1337" y="115" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0rt36co_di" bpmnElement="SequenceFlow_0rt36co"> - <di:waypoint xsi:type="dc:Point" x="1869" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="1927" y="-87" /> + <di:waypoint x="1279" y="155" /> + <di:waypoint x="1337" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="1898" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1mvf7b9_di" bpmnElement="SequenceFlow_1mvf7b9"> - <di:waypoint xsi:type="dc:Point" x="2027" y="-87" /> - <di:waypoint xsi:type="dc:Point" x="2106" y="-87" /> + <di:waypoint x="1437" y="155" /> + <di:waypoint x="1516" y="155" /> <bpmndi:BPMNLabel> <dc:Bounds x="2066.5" y="-108" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_0z9uk3m_di" bpmnElement="Task_0mu8391"> + <dc:Bounds x="471" y="305" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0e2crgd_di" bpmnElement="ServiceTask_0e2crgd"> + <dc:Bounds x="631" y="305" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0lj5jj1_di" bpmnElement="SequenceFlow_0lj5jj1"> + <di:waypoint x="471" y="232" /> + <di:waypoint x="515" y="233" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1kslfgw_di" bpmnElement="SequenceFlow_1kslfgw"> + <di:waypoint x="446" y="257" /> + <di:waypoint x="446" y="345" /> + <di:waypoint x="471" y="345" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0j7rpm9_di" bpmnElement="SequenceFlow_0j7rpm9"> + <di:waypoint x="571" y="343" /> + <di:waypoint x="631" y="341" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ugp99e_di" bpmnElement="SequenceFlow_0ugp99e"> + <di:waypoint x="731" y="345" /> + <di:waypoint x="972" y="345" /> + <di:waypoint x="972" y="180" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ParallelGateway_02lmom2_di" bpmnElement="ExclusiveGateway_0g85lk7"> + <dc:Bounds x="421" y="207" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="InclusiveGateway_1cof7a3_di" bpmnElement="ExclusiveGateway_0vtj8n8"> + <dc:Bounds x="947" y="130" width="50" height="50" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn index c8600586ce..1b4470b545 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn @@ -1,34 +1,38 @@ <?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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1a52v2f" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3"> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1a52v2f" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.5.0"> <bpmn:collaboration id="Collaboration_0go8wi3"> <bpmn:participant id="Participant_1dwc5st" name="SO Assign PNF" processRef="AssignPnfBB" /> <bpmn:participant id="Participant_0gycee4" name="AAI" /> <bpmn:messageFlow id="MessageFlow_0xh6bkn" sourceRef="CreatePnfEntryInAai" targetRef="Participant_0gycee4" /> </bpmn:collaboration> <bpmn:process id="AssignPnfBB" name="AssignPnfBB" isExecutable="true"> - <bpmn:sequenceFlow id="SequenceFlow_0l6rtzy" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" /> <bpmn:sequenceFlow id="SequenceFlow_1fu9o4x" sourceRef="AssignPnf_StartEvent" targetRef="CreatePnfEntryInAai" /> - <bpmn:endEvent id="AaiEntryExists" name="AAI entry exists"> - <bpmn:incoming>SequenceFlow_0l6rtzy</bpmn:incoming> - </bpmn:endEvent> <bpmn:serviceTask id="CreatePnfEntryInAai" name="Create Pnf entry in AAI" camunda:expression="${AAICreateTasks.createPnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1fu9o4x</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0l6rtzy</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0yrabnf</bpmn:outgoing> </bpmn:serviceTask> <bpmn:startEvent id="AssignPnf_StartEvent"> <bpmn:outgoing>SequenceFlow_1fu9o4x</bpmn:outgoing> </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_0yrabnf" sourceRef="CreatePnfEntryInAai" targetRef="Task_UpdatePnfOrchestrationStatusAssigned" /> + <bpmn:sequenceFlow id="SequenceFlow_1yb16sd" sourceRef="Task_UpdatePnfOrchestrationStatusAssigned" targetRef="AaiEntryExists" /> + <bpmn:serviceTask id="Task_UpdatePnfOrchestrationStatusAssigned" name="Update Pnf Orchestration Status to Assigned" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedPnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0yrabnf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yb16sd</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:endEvent id="AaiEntryExists" name="AAI entry exists"> + <bpmn:incoming>SequenceFlow_1yb16sd</bpmn:incoming> + </bpmn:endEvent> <bpmn:association id="Association_1le3nwi" sourceRef="AssignPnf_StartEvent" targetRef="TextAnnotation_184cxp4" /> <bpmn:textAnnotation id="TextAnnotation_184cxp4"> <bpmn:text>Inputs: - - pnfName - String -</bpmn:text> + - pnfName - String</bpmn:text> </bpmn:textAnnotation> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0go8wi3"> <bpmndi:BPMNShape id="Participant_1dwc5st_di" bpmnElement="Participant_1dwc5st" isHorizontal="true"> - <dc:Bounds x="160" y="80" width="646" height="391" /> + <dc:Bounds x="160" y="80" width="738" height="391" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Participant_0gycee4_di" bpmnElement="Participant_0gycee4" isHorizontal="true"> <dc:Bounds x="260" y="567" width="502" height="60" /> @@ -51,19 +55,26 @@ <di:waypoint x="237" y="203" /> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_1wfgsdz_di" bpmnElement="AaiEntryExists"> - <dc:Bounds x="722" y="269" width="36" height="36" /> + <dc:Bounds x="772" y="269" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="703" y="312" width="77" height="14" /> + <dc:Bounds x="753" y="312" width="77" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0l6rtzy_di" bpmnElement="SequenceFlow_0l6rtzy"> - <di:waypoint x="561" y="287" /> - <di:waypoint x="722" y="287" /> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1fu9o4x_di" bpmnElement="SequenceFlow_1fu9o4x"> <di:waypoint x="255" y="287" /> <di:waypoint x="461" y="287" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yrabnf_di" bpmnElement="SequenceFlow_0yrabnf"> + <di:waypoint x="561" y="287" /> + <di:waypoint x="620" y="287" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1kmas9h_di" bpmnElement="Task_UpdatePnfOrchestrationStatusAssigned"> + <dc:Bounds x="620" y="247" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1yb16sd_di" bpmnElement="SequenceFlow_1yb16sd"> + <di:waypoint x="720" y="287" /> + <di:waypoint x="772" y="287" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn index b38ec69ba5..29e2f2bf11 100644 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn +++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WaitForPnfReadyBB.bpmn @@ -8,20 +8,26 @@ <bpmn:messageFlow id="MessageFlow_1py54jr" sourceRef="UnregisterfromPnfReadyEvent" targetRef="WorkflowMessageServiceForDmaap" /> </bpmn:collaboration> <bpmn:process id="WaitForPnfReadyBB" name="WaitForPnfReadyBB" isExecutable="true"> - <bpmn:startEvent id="WaitForPnfReady_StartEvent"> - <bpmn:outgoing>SequenceFlow_1jzs6dp</bpmn:outgoing> - </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_17q5zqe" sourceRef="UpdatePnfOrchestrationStatusToRegistered" targetRef="AaiEntryUpdated" /> + <bpmn:sequenceFlow id="SequenceFlow_0m2r6ye" sourceRef="UpdatePnfOrchestrationStatusToRegister" targetRef="WaitForDmaapPnfReadyNotification" /> + <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="UnregisterfromPnfReadyEvent" targetRef="ThrowTimeoutException" /> + <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="UpdatePnfOrchestrationStatusToRegistered" /> + <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="RegisterForPnfReadyEvent" targetRef="UpdatePnfOrchestrationStatusToRegister" /> + <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="UnregisterfromPnfReadyEvent" /> + <bpmn:sequenceFlow id="SequenceFlow_1jzs6dp" sourceRef="WaitForPnfReady_StartEvent" targetRef="RegisterForPnfReadyEvent" /> <bpmn:serviceTask id="RegisterForPnfReadyEvent" name="Register for Pnf Ready Event" camunda:delegateExpression="${RegisterForPnfReadyEvent}"> <bpmn:incoming>SequenceFlow_1jzs6dp</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1o8od8e</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:sequenceFlow id="SequenceFlow_1miyzfe" sourceRef="UnregisterfromPnfReadyEvent" targetRef="ThrowTimeoutException" /> - <bpmn:sequenceFlow id="SequenceFlow_0p09qgm" sourceRef="WaitForDmaapPnfReadyNotification" targetRef="AaiEntryUpdated" /> - <bpmn:sequenceFlow id="SequenceFlow_1o8od8e" sourceRef="RegisterForPnfReadyEvent" targetRef="WaitForDmaapPnfReadyNotification" /> - <bpmn:sequenceFlow id="SequenceFlow_1kc34bc" sourceRef="WaitForDmaapTimeout" targetRef="UnregisterfromPnfReadyEvent" /> - <bpmn:sequenceFlow id="SequenceFlow_1jzs6dp" sourceRef="WaitForPnfReady_StartEvent" targetRef="RegisterForPnfReadyEvent" /> - <bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo"> + <bpmn:startEvent id="WaitForPnfReady_StartEvent"> + <bpmn:outgoing>SequenceFlow_1jzs6dp</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="UpdatePnfOrchestrationStatusToRegister" name="Update Pnf Orchestration Status to Register" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusRegisterPnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> <bpmn:incoming>SequenceFlow_1o8od8e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0m2r6ye</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:receiveTask id="WaitForDmaapPnfReadyNotification" name="Wait for DMAAP pnf-ready notification" messageRef="Message_13h1tlo"> + <bpmn:incoming>SequenceFlow_0m2r6ye</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0p09qgm</bpmn:outgoing> </bpmn:receiveTask> <bpmn:boundaryEvent id="WaitForDmaapTimeout" name="Timeout" attachedToRef="WaitForDmaapPnfReadyNotification"> @@ -30,17 +36,21 @@ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">#{timeoutForPnfEntryNotification}</bpmn:timeDuration> </bpmn:timerEventDefinition> </bpmn:boundaryEvent> + <bpmn:serviceTask id="UpdatePnfOrchestrationStatusToRegistered" name="Update Pnf Orchestration Status to Registered" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusRegisteredPnf(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}"> + <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17q5zqe</bpmn:outgoing> + </bpmn:serviceTask> <bpmn:serviceTask id="UnregisterfromPnfReadyEvent" name="Unregister from Pnf Ready Event" camunda:delegateExpression="${CancelDmaapSubscription}"> <bpmn:incoming>SequenceFlow_1kc34bc</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1miyzfe</bpmn:outgoing> </bpmn:serviceTask> + <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated"> + <bpmn:incoming>SequenceFlow_17q5zqe</bpmn:incoming> + </bpmn:endEvent> <bpmn:endEvent id="ThrowTimeoutException" name="Throw timeout exception"> <bpmn:incoming>SequenceFlow_1miyzfe</bpmn:incoming> <bpmn:errorEventDefinition errorRef="Error_1" /> </bpmn:endEvent> - <bpmn:endEvent id="AaiEntryUpdated" name="AAI entry updated"> - <bpmn:incoming>SequenceFlow_0p09qgm</bpmn:incoming> - </bpmn:endEvent> <bpmn:textAnnotation id="TextAnnotation_1eyzes8"> <bpmn:text>Inputs: - pnf name - String</bpmn:text> @@ -52,12 +62,12 @@ <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1d0w8lf"> <bpmndi:BPMNShape id="Participant_1egg397_di" bpmnElement="WaitForPnfReadyBB_ID" isHorizontal="true"> - <dc:Bounds x="160" y="50" width="810" height="400" /> + <dc:Bounds x="160" y="50" width="1040" height="400" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0k52gr7_di" bpmnElement="AaiEntryUpdated"> - <dc:Bounds x="882" y="189" width="36" height="36" /> + <dc:Bounds x="1112" y="189" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="858" y="230" width="88" height="14" /> + <dc:Bounds x="1088" y="230" width="88" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_0j5ok9h_di" bpmnElement="WaitForPnfReady_StartEvent"> @@ -67,12 +77,12 @@ </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="Participant_0vmrrhf_di" bpmnElement="WorkflowMessageServiceForDmaap" isHorizontal="true"> - <dc:Bounds x="340" y="490" width="463" height="60" /> + <dc:Bounds x="340" y="490" width="690" height="60" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0wbx6tt_di" bpmnElement="ThrowTimeoutException"> - <dc:Bounds x="882" y="322" width="36" height="36" /> + <dc:Bounds x="1112" y="322" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="875" y="359" width="70" height="27" /> + <dc:Bounds x="1105" y="359" width="70" height="27" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="TextAnnotation_1eyzes8_di" bpmnElement="TextAnnotation_1eyzes8"> @@ -83,32 +93,32 @@ <di:waypoint x="237" y="109" /> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_1vrcp2d_di" bpmnElement="MessageFlow_1vrcp2d"> - <di:waypoint x="582" y="490" /> - <di:waypoint x="582" y="247" /> + <di:waypoint x="772" y="490" /> + <di:waypoint x="772" y="247" /> <bpmndi:BPMNLabel> <dc:Bounds x="996" y="380" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="BoundaryEvent_15eo1k9_di" bpmnElement="WaitForDmaapTimeout"> - <dc:Bounds x="596" y="229" width="36" height="36" /> + <dc:Bounds x="786" y="229" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="639" y="240" width="40" height="14" /> + <dc:Bounds x="829" y="240" width="40" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1kc34bc_di" bpmnElement="SequenceFlow_1kc34bc"> - <di:waypoint x="614" y="265" /> - <di:waypoint x="614" y="340" /> - <di:waypoint x="710" y="340" /> + <di:waypoint x="804" y="265" /> + <di:waypoint x="804" y="340" /> + <di:waypoint x="910" y="340" /> <bpmndi:BPMNLabel> <dc:Bounds x="1028" y="309" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ReceiveTask_1sfysua_di" bpmnElement="WaitForDmaapPnfReadyNotification"> - <dc:Bounds x="530" y="167" width="100" height="80" /> + <dc:Bounds x="720" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0p09qgm_di" bpmnElement="SequenceFlow_0p09qgm"> - <di:waypoint x="630" y="207" /> - <di:waypoint x="882" y="207" /> + <di:waypoint x="820" y="207" /> + <di:waypoint x="910" y="207" /> <bpmndi:BPMNLabel> <dc:Bounds x="1106.5" y="187" width="90" height="10" /> </bpmndi:BPMNLabel> @@ -131,26 +141,40 @@ <dc:Bounds x="340" y="167" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1miyzfe_di" bpmnElement="SequenceFlow_1miyzfe"> - <di:waypoint x="810" y="340" /> - <di:waypoint x="882" y="340" /> + <di:waypoint x="1010" y="340" /> + <di:waypoint x="1112" y="340" /> <bpmndi:BPMNLabel> <dc:Bounds x="1233.5" y="343" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="MessageFlow_1py54jr_di" bpmnElement="MessageFlow_1py54jr"> - <di:waypoint x="760" y="380" /> - <di:waypoint x="760" y="490" /> + <di:waypoint x="960" y="380" /> + <di:waypoint x="960" y="490" /> <bpmndi:BPMNLabel> <dc:Bounds x="1165" y="458" width="90" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_12j7hox_di" bpmnElement="UnregisterfromPnfReadyEvent"> - <dc:Bounds x="710" y="300" width="100" height="80" /> + <dc:Bounds x="910" y="300" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1jzs6dp_di" bpmnElement="SequenceFlow_1jzs6dp"> <di:waypoint x="255" y="207" /> <di:waypoint x="340" y="207" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1kiymc9_di" bpmnElement="UpdatePnfOrchestrationStatusToRegister"> + <dc:Bounds x="530" y="167" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0m2r6ye_di" bpmnElement="SequenceFlow_0m2r6ye"> + <di:waypoint x="630" y="207" /> + <di:waypoint x="720" y="207" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_17q5zqe_di" bpmnElement="SequenceFlow_17q5zqe"> + <di:waypoint x="1010" y="207" /> + <di:waypoint x="1112" y="207" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1e3i8pf_di" bpmnElement="UpdatePnfOrchestrationStatusToRegistered"> + <dc:Bounds x="910" y="167" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java index c223d3ff11..de6b75bd03 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java @@ -28,9 +28,9 @@ import org.springframework.stereotype.Component; @Component public class HomingV2 { - static final String HOMING_SNIRO = "sniro"; - static final String HOMING_OOF = "oof"; - static final String HOMING_SOLUTION = "Homing_Solution"; + public static final String HOMING_SNIRO = "sniro"; + public static final String HOMING_OOF = "oof"; + public static final String HOMING_SOLUTION = "Homing_Solution"; private SniroHomingV2 sniroHomingV2; private OofHomingV2 oofHomingV2; @@ -59,6 +59,6 @@ public class HomingV2 { private boolean isSniro(BuildingBlockExecution execution) { return execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams().stream() - .anyMatch(params -> HOMING_SNIRO.equals(params.get(HOMING_SOLUTION))); + .anyMatch(params -> HomingV2.HOMING_SNIRO.equals(params.get(HomingV2.HOMING_SOLUTION))); } } 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 22089dae1f..dab5102efd 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 @@ -31,8 +31,6 @@ import java.util.TreeSet; import java.util.UUID; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.onap.so.client.orchestration.AAIPnfResources; -import org.onap.so.logger.LoggingAnchor; import org.camunda.bpm.engine.delegate.BpmnError; import org.onap.so.bpmn.common.BuildingBlockExecution; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -62,12 +60,14 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; import org.onap.so.client.orchestration.AAIInstanceGroupResources; import org.onap.so.client.orchestration.AAINetworkResources; +import org.onap.so.client.orchestration.AAIPnfResources; import org.onap.so.client.orchestration.AAIServiceInstanceResources; import org.onap.so.client.orchestration.AAIVfModuleResources; import org.onap.so.client.orchestration.AAIVnfResources; import org.onap.so.client.orchestration.AAIVolumeGroupResources; import org.onap.so.client.orchestration.AAIVpnBindingResources; import org.onap.so.logger.ErrorCode; +import org.onap.so.logger.LoggingAnchor; import org.onap.so.logger.MessageEnum; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -274,18 +274,28 @@ public class AAICreateTasks { * @param str * @throws @return */ + public void createPlatformForNetwork(BuildingBlockExecution execution) { + try { + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + if (network != null) { + createPlatformNetwork(network); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + /** + * This method is used for separating (,) from the string. + * + * @param str + * @throws @return + */ public void createPlatform(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - Platform platform = vnf.getPlatform(); - if (platform != null) { - if (platform.getPlatformName() == null || "".equals(platform.getPlatformName())) { - logger.debug("PlatformName is null in input. Skipping create platform..."); - } else { - List<String> platforms = splitCDL(platform.getPlatformName()); - platforms.stream().forEach(platformName -> aaiVnfResources - .createPlatformandConnectVnf(new Platform(platformName), vnf)); - } + if (vnf != null) { + createPlatformVnf(vnf); } } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); @@ -293,6 +303,30 @@ public class AAICreateTasks { } + protected void createPlatformVnf(GenericVnf vnf) { + Platform platform = vnf.getPlatform(); + if (Strings.isNullOrEmpty(platform.getPlatformName())) { + logger.debug("PlatformName is null in input. Skipping create platform..."); + } else { + List<String> platforms = splitCDL(platform.getPlatformName()); + platforms.stream().forEach( + platformName -> aaiVnfResources.createPlatformandConnectVnf(new Platform(platformName), vnf)); + } + } + + protected void createPlatformNetwork(L3Network network) { + Platform platform = network.getPlatform(); + if (platform != null) { + if (Strings.isNullOrEmpty(platform.getPlatformName())) { + logger.debug("PlatformName is null in input. Skipping create platform..."); + } else { + List<String> platforms = splitCDL(platform.getPlatformName()); + platforms.stream().forEach( + platformName -> aaiNetworkResources.createPlatformAndConnectNetwork(platform, network)); + } + } + } + /** * This method is used for separating (,) from the string. * @@ -312,22 +346,51 @@ public class AAICreateTasks { public void createLineOfBusiness(BuildingBlockExecution execution) { try { GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness(); - if (lineOfBusiness != null) { - if (lineOfBusiness.getLineOfBusinessName() == null - || "".equals(lineOfBusiness.getLineOfBusinessName())) { - logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); - } else { - List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName()); - lineOfBussinesses.stream().forEach(lobName -> aaiVnfResources - .createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName), vnf)); - } + if (vnf != null) { + createLineOfBusinessVnf(vnf); } } catch (Exception ex) { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } + public void createLineOfBusinessForNetwork(BuildingBlockExecution execution) { + try { + L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); + if (network != null) { + createLineOfBusinessNetwork(network); + } + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + protected void createLineOfBusinessVnf(GenericVnf vnf) { + LineOfBusiness lineOfBusiness = vnf.getLineOfBusiness(); + if (lineOfBusiness != null) { + if (Strings.isNullOrEmpty(lineOfBusiness.getLineOfBusinessName())) { + logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); + } else { + List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName()); + lineOfBussinesses.stream().forEach( + lobName -> aaiVnfResources.createLineOfBusinessandConnectVnf(new LineOfBusiness(lobName), vnf)); + } + } + } + + protected void createLineOfBusinessNetwork(L3Network network) { + LineOfBusiness lineOfBusiness = network.getLineOfBusiness(); + if (lineOfBusiness != null) { + if (Strings.isNullOrEmpty(lineOfBusiness.getLineOfBusinessName())) { + logger.info("lineOfBusiness is null in input. Skipping create lineOfBusiness..."); + } else { + List<String> lineOfBussinesses = splitCDL(lineOfBusiness.getLineOfBusinessName()); + lineOfBussinesses.stream().forEach(lobName -> aaiNetworkResources + .createLineOfBusinessAndConnectNetwork(new LineOfBusiness(lobName), network)); + } + } + } + /** * This method is used for creating the volume group in A&AI. * diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index f1fbe545ce..4d5494d18c 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -118,6 +118,14 @@ public class AAIUpdateTasks { } } + /** + * BPMN access method to update status of Pnf to Assigned in AAI + * + * @param execution + */ + public void updateOrchestrationStatusAssignedPnf(BuildingBlockExecution execution) { + updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ASSIGNED); + } /** * BPMN access method to update status of Pnf to Active in AAI @@ -125,11 +133,29 @@ public class AAIUpdateTasks { * @param execution */ public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) { + updateOrchestrationStatusForPnf(execution, OrchestrationStatus.ACTIVE); + } + + /** + * BPMN access method to update status of Pnf to Register in AAI + */ + public void updateOrchestrationStatusRegisterPnf(BuildingBlockExecution execution) { + updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTER); + } + + /** + * BPMN access method to update status of Pnf to Registered in AAI + */ + public void updateOrchestrationStatusRegisteredPnf(BuildingBlockExecution execution) { + updateOrchestrationStatusForPnf(execution, OrchestrationStatus.REGISTERED); + } + + private void updateOrchestrationStatusForPnf(BuildingBlockExecution execution, OrchestrationStatus status) { try { Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF); - aaiPnfResources.updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ACTIVE); + aaiPnfResources.updateOrchestrationStatusPnf(pnf, status); } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivePnf", ex); + logger.error("Exception occurred in AAIUpdateTasks during update Orchestration Status to {}", status, ex); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index bc702c9fb4..3af65815a6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -30,6 +30,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.client.aai.AAIObjectPlurals; @@ -38,8 +40,8 @@ import org.onap.so.client.aai.entities.AAIEdgeLabel; 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.client.graphinventory.entities.uri.Depth; import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.OrchestrationStatus; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -76,6 +78,22 @@ public class AAINetworkResources { serviceInstanceURI); } + public void createLineOfBusinessAndConnectNetwork(LineOfBusiness lineOfBusiness, L3Network network) { + AAIResourceUri lineOfBusinessURI = + AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness.getLineOfBusinessName()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + injectionHelper.getAaiClient().createIfNotExists(lineOfBusinessURI, Optional.of(lineOfBusiness)) + .connect(networkURI, lineOfBusinessURI); + } + + public void createPlatformAndConnectNetwork(Platform platform, L3Network network) { + AAIResourceUri platformURI = + AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platform.getPlatformName()); + AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); + injectionHelper.getAaiClient().createIfNotExists(platformURI, Optional.of(platform)).connect(networkURI, + platformURI); + } + public void deleteNetwork(L3Network network) { AAIResourceUri networkURI = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()); injectionHelper.getAaiClient().delete(networkURI); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java index ae6dde6521..e26009a1de 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -139,6 +139,25 @@ public class AAIUpdateTasksTest extends BaseTaskTest { aaiUpdateTasks.updateOrchestrationStatusActiveService(execution); } + @Test + public void updateOrchestrationStatusAssignedPnfTest() throws Exception { + Pnf pnf = preparePnfAndExtractForPnf(); + doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedPnf(execution); + + verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ASSIGNED); + } + + @Test + public void updateOrchestrationStatusAssignedPnfExceptionTest() throws Exception { + Pnf pnf = preparePnfAndExtractForPnf(); + doThrow(RuntimeException.class).when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, + OrchestrationStatus.ASSIGNED); + + expectedException.expect(BpmnError.class); + aaiUpdateTasks.updateOrchestrationStatusAssignedPnf(execution); + } @Test public void updateOrchestrationStatusActivePnfTest() throws Exception { @@ -161,6 +180,26 @@ public class AAIUpdateTasksTest extends BaseTaskTest { } @Test + public void updateOrchestrationStatusRegisterPnfTest() throws Exception { + Pnf pnf = preparePnfAndExtractForPnf(); + doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTER); + + aaiUpdateTasks.updateOrchestrationStatusRegisterPnf(execution); + + verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTER); + } + + @Test + public void updateOrchestrationStatusRegisteredPnfTest() throws Exception { + Pnf pnf = preparePnfAndExtractForPnf(); + doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTERED); + + aaiUpdateTasks.updateOrchestrationStatusRegisteredPnf(execution); + + verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.REGISTERED); + } + + @Test public void updateOrchestrationStatusAssignedVnfTest() throws Exception { doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); |