diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
16 files changed, 638 insertions, 86 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java index b5bb0bed94..380a94f951 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -52,6 +52,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; @@ -71,6 +72,7 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.db.catalog.beans.OrchestrationStatus; public class TestDataSetup{ private int collectionCounter; @@ -686,4 +688,12 @@ public class TestDataSetup{ serviceInstance.setConfigurations(configurations); return config; } + + public Subnet buildSubnet() { + Subnet subnet = new Subnet(); + subnet.setSubnetId("testSubnetId"); + subnet.setOrchestrationStatus(OrchestrationStatus.PENDING); + subnet.setNeutronSubnetId("testNeutronSubnetId"); + return subnet; + } }
\ No newline at end of file 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 d800ae9618..55958946a3 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 @@ -21,14 +21,24 @@ package org.onap.so.bpmn.infrastructure.aai.tasks; import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.HashMap; import org.camunda.bpm.engine.delegate.BpmnError; +import org.hamcrest.Matchers; import org.junit.Before; import org.junit.Test; +import org.mockito.Mockito; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; @@ -36,6 +46,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.db.catalog.beans.OrchestrationStatus; @@ -52,6 +63,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ private VolumeGroup volumeGroup; private CloudRegion cloudRegion; private Configuration configuration; + private Subnet subnet; @Before public void before() { @@ -62,6 +74,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ cloudRegion = setCloudRegion(); network = setL3Network(); configuration = setConfiguration(); + subnet = buildSubnet(); } @Test @@ -290,51 +303,14 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ doThrow(Exception.class).when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution); } - - @Test - public void updateOstatusAssignedNetworkTest() throws Exception { - doNothing().when(aaiNetworkResources).updateNetwork(network); - - aaiUpdateTasks.updateOrchestrationStatusAssignedNetwork(execution); - - verify(aaiNetworkResources, times(1)).updateNetwork(network); - assertEquals("", network.getHeatStackId()); - } @Test - public void updateOstatusAssignedNetworkExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - - doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); - - aaiUpdateTasks.updateOrchestrationStatusAssignedNetwork(execution); - } - - @Test - public void updateOstatusActivedNetworkTest() throws Exception { - doNothing().when(aaiNetworkResources).updateNetwork(network); - - aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution); - - verify(aaiNetworkResources, times(1)).updateNetwork(network); - } - - @Test - public void updateOstatusCreatedNetworkTest() throws Exception { - doNothing().when(aaiNetworkResources).updateNetwork(network); - - aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution); - - verify(aaiNetworkResources, times(1)).updateNetwork(network); - } - - @Test - public void updateOstatusActiveNetworkExceptionTest() throws Exception { + public void updateNetworkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); - aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution); + aaiUpdateTasks.updateNetwork(execution, OrchestrationStatus.ACTIVE); } @Test @@ -374,20 +350,62 @@ public class AAIUpdateTasksTest extends BaseTaskTest{ CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); createNetworkResponse.setNetworkFqdn("testNetworkFqdn"); createNetworkResponse.setNetworkStackId("testNetworkStackId"); + HashMap<String, String> subnetMap = new HashMap<String, String>(); + subnetMap.put("testSubnetId", "testNeutronSubnetId"); + createNetworkResponse.setSubnetMap(subnetMap); + + network.getSubnets().add(subnet); execution.setVariable("createNetworkResponse", createNetworkResponse); doNothing().when(aaiNetworkResources).updateNetwork(network); + doNothing().when(aaiNetworkResources).updateSubnet(network, subnet); + aaiUpdateTasks.updateNetworkCreated(execution); verify(aaiNetworkResources, times(1)).updateNetwork(network); + verify(aaiNetworkResources, times(1)).updateSubnet(network, subnet); assertEquals(createNetworkResponse.getNetworkFqdn(), network.getContrailNetworkFqdn()); assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus()); assertEquals(createNetworkResponse.getNetworkStackId(), network.getHeatStackId()); assertEquals(createNetworkResponse.getNeutronNetworkId(), network.getNeutronNetworkId()); + String neutronSubnetId = createNetworkResponse.getSubnetMap().entrySet().iterator().next().getValue(); + assertEquals(neutronSubnetId, network.getSubnets().get(0).getNeutronSubnetId()); } @Test + public void updateOrchestrationStatusNetworkTest() { + AAIUpdateTasks spy = Mockito.spy(new AAIUpdateTasks()); + doNothing().when(spy).updateNetwork(eq(execution), any()); + spy.updateOrchestrationStatusActiveNetwork(execution); + verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ACTIVE); + spy.updateOrchestrationStatusAssignedNetwork(execution); + verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.ASSIGNED); + spy.updateOrchestrationStatusCreatedNetwork(execution); + verify(spy, times(1)).updateNetwork(execution, OrchestrationStatus.CREATED); + } + + @Test + public void updateNetworkAAITest() { + + L3Network spy = spy(new L3Network()); + L3Network shallowCopy = mock(L3Network.class); + Subnet mockSubnet = mock(Subnet.class); + Subnet shallowCopySubnet = mock(Subnet.class); + when(mockSubnet.shallowCopyId()).thenReturn(shallowCopySubnet); + doReturn(shallowCopy).when(spy).shallowCopyId(); + + doNothing().when(aaiNetworkResources).updateNetwork(network); + doNothing().when(aaiNetworkResources).updateSubnet(network, subnet); + + spy.getSubnets().add(mockSubnet); + aaiUpdateTasks.updateNetworkAAI(spy, OrchestrationStatus.CREATED); + + verify(shallowCopy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED); + verify(spy, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED); + verify(shallowCopySubnet, times(1)).setOrchestrationStatus(OrchestrationStatus.CREATED); + } + @Test public void updateNetworkCreatedkExceptionTest() throws Exception { expectedException.expect(BpmnError.class); doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java index 7cade7703a..dcc95affce 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java @@ -1,3 +1,23 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + package org.onap.so.bpmn.infrastructure.appc.tasks; import static org.mockito.Mockito.times; diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java index e1b652a140..8382b9be72 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java @@ -33,6 +33,7 @@ import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.springframework.beans.factory.annotation.Autowired; public class AssignVnfTest extends BaseTaskTest { @@ -87,10 +88,10 @@ public class AssignVnfTest extends BaseTaskTest { assignVnf.createInstanceGroups(execution); verify(aaiInstanceGroupResources, times(1)).createInstanceGroup(instanceGroup1); verify(aaiInstanceGroupResources, times(1)).createInstanceGroup(instanceGroup2); - verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup1, genericVnf); - verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup2, genericVnf); - verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup3, genericVnf); - verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup4, genericVnf); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup1, genericVnf, AAIEdgeLabel.BELONGS_TO); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup2, genericVnf, AAIEdgeLabel.BELONGS_TO); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup3, genericVnf, AAIEdgeLabel.USES); + verify(aaiInstanceGroupResources, times(1)).connectInstanceGroupToVnf(instanceGroup4, genericVnf, AAIEdgeLabel.USES); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java new file mode 100644 index 0000000000..b4ec68050e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionUnitTest.java @@ -0,0 +1,178 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIConfigurationResources; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import org.onap.so.db.catalog.client.CatalogDbClient; + +@RunWith(MockitoJUnitRunner.class) +public class WorkflowActionUnitTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/Macro/"; + + @Mock + private CatalogDbClient catalogDbClient; + @Mock + private BBInputSetup bbInputSetup; + @Mock + private BBInputSetupUtils bbInputSetupUtils; + @Mock + private ExceptionBuilder exceptionBuilder; + @Mock + private AAIConfigurationResources aaiConfigurationResources; + + @InjectMocks + @Spy + private WorkflowAction workflowAction; + + @Test + public void filterOrchFlowsHasFabricTest() { + + List<OrchestrationFlow> flows = createFlowList( + "DeactivateFabricConfigurationBB", + "flow x", + "flow y", + "ActivateFabricConfigurationBB", + "flow z"); + doReturn(Arrays.asList("yes", "yes")).when(workflowAction).traverseCatalogDbForConfiguration(any(String.class), any(String.class)); + + List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class)); + + assertThat(result, is(flows)); + } + + @Test + public void filterOrchFlowNoFabricTest() { + List<OrchestrationFlow> flows = createFlowList( + "DeactivateFabricConfigurationBB", + "flow x", + "flow y", + "ActivateFabricConfigurationBB", + "flow z"); + doReturn(Arrays.asList()).when(workflowAction).traverseCatalogDbForConfiguration(any(String.class), any(String.class)); + + List<OrchestrationFlow> result = workflowAction.filterOrchFlows(flows, WorkflowType.VFMODULE, mock(DelegateExecution.class)); + List<OrchestrationFlow> expected = createFlowList( + "flow x", + "flow y", + "flow z"); + + assertThat(result, is(expected)); + } + + @Test + public void traverseCatalogDbForConfigurationTest() { + + CvnfcCustomization cvnfcCustomization = new CvnfcCustomization(); + VnfVfmoduleCvnfcConfigurationCustomization vfModuleCustomization = new VnfVfmoduleCvnfcConfigurationCustomization(); + ConfigurationResource configuration = new ConfigurationResource(); + configuration.setToscaNodeType("FabricConfiguration"); + configuration.setModelUUID("my-uuid"); + vfModuleCustomization.setConfigurationResource(configuration); + cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(Collections.singleton(vfModuleCustomization)); + List<CvnfcCustomization> cvnfcCustomizations = Arrays.asList(cvnfcCustomization); + when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(any(String.class), any(String.class))) + .thenReturn(cvnfcCustomizations); + + List<String> results = workflowAction.traverseCatalogDbForConfiguration("myVnfCustomizationId", "myVfModuleCustomizationId"); + + assertThat(results, is(Arrays.asList("my-uuid"))); + + } + + @Test + public void verifyFilterOrchInvocation() throws Exception { + DelegateExecution execution = mock(DelegateExecution.class); + + when(execution.getVariable(eq("aLaCarte"))).thenReturn(true); + when(execution.getVariable(eq("bpmnRequest"))).thenReturn(getJson("ServiceMacroAssign.json")); + when(execution.getVariable(eq("requestUri"))).thenReturn("/v6/serviceInstances/123/vnfs/1234"); + + OrchestrationFlow flow = new OrchestrationFlow(); + flow.setFlowName("flow x"); + + List<OrchestrationFlow> flows = Arrays.asList(flow); + doReturn(Arrays.asList(flow)).when(workflowAction).queryNorthBoundRequestCatalogDb(any(), any(), any(), anyBoolean()); + workflowAction.selectExecutionList(execution); + + verify(workflowAction, times(1)).filterOrchFlows(eq(flows), any(), any()); + + flow = new OrchestrationFlow(); + flow.setFlowName("flow y"); + flows = Arrays.asList(flow); + when(execution.getVariable(eq("aLaCarte"))).thenReturn(false); + workflowAction.selectExecutionList(execution); + + verify(workflowAction, never()).filterOrchFlows(eq(flows), any(), any()); + + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename))); + } + + private List<OrchestrationFlow> createFlowList(String... myList) { + + List<OrchestrationFlow> result = new ArrayList<>(); + for (String name : myList) { + OrchestrationFlow flow = new OrchestrationFlow(); + flow.setFlowName(name); + result.add(flow); + } + + return result; + + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java index 99f1b188c9..d86453b87c 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -654,4 +654,21 @@ public class AAIObjectMapperTest { assertThat(actualRouteTarget, sameBeanAs(expectedRouteTarget)); } + + @Test + public void mapSubnetTest() { + Subnet subnet = new Subnet(); + subnet.setSubnetId("testSubnetId"); + subnet.setOrchestrationStatus(OrchestrationStatus.PENDING); + subnet.setNeutronSubnetId("testNeutronSubnetId"); + + org.onap.aai.domain.yang.Subnet expectedSubnet = new org.onap.aai.domain.yang.Subnet(); + expectedSubnet.setSubnetId("testSubnetId"); + expectedSubnet.setOrchestrationStatus("Pending"); + expectedSubnet.setNeutronSubnetId("testNeutronSubnetId"); + + org.onap.aai.domain.yang.Subnet actualSubnet = aaiObjectMapper.mapSubnet(subnet); + + assertThat(actualSubnet, sameBeanAs(expectedSubnet)); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java index fddba98f4c..8f0d00ff86 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -21,6 +21,7 @@ package org.onap.so.client.adapter.network.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.*; import static org.mockito.Mockito.doReturn; import java.io.UnsupportedEncodingException; @@ -38,6 +39,7 @@ import org.onap.so.adapters.nwrest.ContrailNetwork; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.NetworkTechnology; import org.onap.so.adapters.nwrest.ProviderVlanNetwork; import org.onap.so.adapters.nwrest.RollbackNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; @@ -96,6 +98,24 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ } @Test + public void testSetNetworkTechnology() { + String networkTechnology = "Contrail"; + NetworkTechnology expectedNetworkTechnology = NetworkTechnology.CONTRAIL; + NetworkTechnology actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); + assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); + + networkTechnology = "Neutron"; + expectedNetworkTechnology = NetworkTechnology.NEUTRON; + actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); + assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); + + networkTechnology = "Vmware"; + expectedNetworkTechnology = NetworkTechnology.VMWARE; + actualNetworkTechnology = SPY_networkAdapterObjectMapper.setNetworkTechnology(networkTechnology); + assertEquals("NetworkTechnology matches", expectedNetworkTechnology, actualNetworkTechnology); + + } + @Test public void buildCreateNetworkRequestFromBbobjectTest() throws Exception { String cloudRegionPo = "cloudRegionPo"; @@ -108,7 +128,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType()); expectedCreateNetworkRequest.setBackout(false); expectedCreateNetworkRequest.setFailIfExists(true); - + expectedCreateNetworkRequest.setNetworkTechnology(NetworkTechnology.CONTRAIL); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId(requestContext.getMsoRequestId()); msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); @@ -124,10 +144,11 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ List<Subnet> subnetList = new ArrayList<Subnet>(); subnetList.add(openstackSubnet); l3Network.getSubnets().add(openstackSubnet); + l3Network.getModelInfoNetwork().setNetworkTechnology("Contrail"); CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); - assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); + assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("contrailRequest").ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); } @Test @@ -232,7 +253,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{ expectedUpdateNetworkRequest.setNetworkParams(userInput); expectedUpdateNetworkRequest.setMsoRequest(msoRequest); expectedUpdateNetworkRequest.setSkipAAI(true); - expectedUpdateNetworkRequest.setBackout(!Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); + expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); expectedUpdateNetworkRequest.setMessageId("messageId"); expectedUpdateNetworkRequest.setNotificationUrl("http://localhost:28080/mso/WorkflowMesssage/NetworkAResponse/messageId"); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java index b2f01f007f..8f5c8dfb5e 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -134,7 +134,7 @@ public class VnfAdapterObjectMapperTest { expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams); expectedCreateVolumeGroupRequest.setSkipAAI(true); - expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled()); + expectedCreateVolumeGroupRequest.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); expectedCreateVolumeGroupRequest.setFailIfExists(true); MsoRequest msoRequest = new MsoRequest(); @@ -210,7 +210,7 @@ public class VnfAdapterObjectMapperTest { expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams); expectedCreateVolumeGroupRequest.setSkipAAI(true); - expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled()); + expectedCreateVolumeGroupRequest.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled())); expectedCreateVolumeGroupRequest.setFailIfExists(true); MsoRequest msoRequest = new MsoRequest(); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java index 0c9e281fc7..32a495e094 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperPayloadTest.java @@ -22,17 +22,20 @@ package org.onap.so.client.adapter.vnf.mapper; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; +import java.util.Map; import org.junit.Before; import org.junit.Test; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVmNetworkData; import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; -import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; @@ -132,6 +135,80 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { } @Test + public void createVfModuleWithFalseRollbackRequestMapperTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid"); + modelInfoServiceInstance.setModelName("serviceModelName"); + modelInfoServiceInstance.setModelUuid("serviceModelUuid"); + modelInfoServiceInstance.setModelVersion("serviceModelVersion"); + modelInfoServiceInstance.setEnvironmentContext("environmentContext"); + modelInfoServiceInstance.setWorkloadContext("workloadContext"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value2"); + requestContext.setMsoRequestId("requestId"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.setVnfName("vnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + Integer vfModuleIndex = 1; + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + vfModule.setModuleIndex(vfModuleIndex); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + HashMap<String, String> cloudParams = new HashMap<String, String>(); + cloudParams.put("key3", "value3"); + vfModule.setCloudParams(cloudParams); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopology.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = vfModuleObjectMapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, null, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestTrueBackout.json"))); + + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test public void createVfModuleRequestWithNoEnvironmentAndWorkloadContextMapperTest() throws Exception { // prepare and set service instance @@ -770,4 +847,18 @@ public class VnfAdapterVfModuleObjectMapperPayloadTest { assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); } + + @Test + public void networkCloudParamsTest() throws IOException { + + String json = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "grApiVmNetworkSubSectionWith5GParams.json"))); + GenericResourceApiVmNetworkData network = omapper.readValue(json, GenericResourceApiVmNetworkData.class); + Map<String, String> paramsMap = new HashMap<>(); + vfModuleObjectMapper.buildVlanInformation(paramsMap, network, "testKey", "testType"); + + assertEquals("1,3", paramsMap.get("testKey_testType_private_vlans")); + assertEquals("2,3", paramsMap.get("testKey_testType_public_vlans")); + assertEquals("1,2,3", paramsMap.get("testKey_testType_guest_vlans")); + assertEquals("my-segemntation-id", paramsMap.get("testKey_testType_vlan_filter")); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java index aef25e5ded..621e275fdf 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java @@ -40,6 +40,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @RunWith(MockitoJUnitRunner.class) @@ -87,6 +88,12 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup{ } @Test + public void connectInstanceGroupWithEdgeTest() throws Exception { + aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf, AAIEdgeLabel.BELONGS_TO); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId())), eq(AAIEdgeLabel.BELONGS_TO)); + } + + @Test public void existsTest() throws Exception { aaiInstanceGroupResources.exists(instanceGroup); verify(MOCK_aaiResourcesClient, times(1)).exists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java index fa3324840c..cf270c21a7 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -55,6 +55,7 @@ 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.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.AAIResultWrapper; @@ -74,6 +75,7 @@ public class AAINetworkResourcesTest extends TestDataSetup{ private InstanceGroup instanceGroup; private ServiceInstance serviceInstance; private CloudRegion cloudRegion; + private Subnet subnet; @Mock protected AAIResourcesClient MOCK_aaiResourcesClient; @@ -101,6 +103,9 @@ public class AAINetworkResourcesTest extends TestDataSetup{ serviceInstance = buildServiceInstance(); cloudRegion = buildCloudRegion(); + + subnet = buildSubnet(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); } @@ -314,4 +319,15 @@ public class AAINetworkResourcesTest extends TestDataSetup{ aaiNetworkResources.deleteNetworkInstanceGroup(instanceGroup); verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); } + + @Test + public void updateSubnetTest() throws Exception { + + doReturn(new org.onap.aai.domain.yang.Subnet()).when(MOCK_aaiObjectMapper).mapSubnet(subnet); + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Subnet.class)); + + aaiNetworkResources.updateSubnet(network, subnet); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Subnet.class)); + } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java index 298a3de9ba..ba7dc8d618 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java @@ -20,9 +20,11 @@ package org.onap.so.client.sdnc.mapper; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; import java.util.HashMap; @@ -32,28 +34,31 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.InjectMocks; +import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput; +import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation; import org.onap.so.bpmn.common.data.TestDataSetup; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; import org.onap.so.client.sdnc.beans.SDNCSvcAction; -import org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; -import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; -import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation; - -public class GeneralTopologyObjectMapperTest extends TestDataSetup{ +public class GeneralTopologyObjectMapperTest extends TestDataSetup { @InjectMocks private GeneralTopologyObjectMapper genObjMapper = new GeneralTopologyObjectMapper(); @@ -222,4 +227,55 @@ public class GeneralTopologyObjectMapperTest extends TestDataSetup{ assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId()); assertNotNull(gcRequestInput.getVnfId()); } + + @Test + public void buildNetworkInformationTest() { + + L3Network network = new L3Network(); + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("my-uuid"); + modelInfoNetwork.setModelName("my-model-name"); + modelInfoNetwork.setModelVersion("my-model-version"); + modelInfoNetwork.setModelUUID("my-model-uuid"); + modelInfoNetwork.setModelCustomizationUUID("my-customization-uuid"); + network.setModelInfoNetwork(modelInfoNetwork); + network.setNetworkId("my-network-id"); + network.setNetworkType("my-network-type"); + network.setNetworkTechnology("my-network-technology"); + + GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation(); + GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation(); + networkInformation.setNetworkId("my-network-id"); + networkInformation.setNetworkType("my-network-type"); + networkInformation.networkTechnology("my-network-technology"); + networkInformation.setFromPreload(null); + onapModelInformation.setModelInvariantUuid("my-uuid"); + onapModelInformation.setModelName("my-model-name"); + onapModelInformation.setModelVersion("my-model-version"); + onapModelInformation.setModelUuid("my-model-uuid"); + onapModelInformation.setModelCustomizationUuid("my-customization-uuid"); + networkInformation.setOnapModelInformation(onapModelInformation); + + assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network))); + + } + + @Test + public void buildNetworkInformationNoModelTest() { + + L3Network network = new L3Network(); + network.setNetworkId("my-network-id"); + network.setNetworkType("my-network-type"); + network.setNetworkTechnology("my-network-technology"); + + GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation(); + networkInformation.setNetworkId("my-network-id"); + networkInformation.setNetworkType("my-network-type"); + networkInformation.networkTechnology("my-network-technology"); + networkInformation.setFromPreload(null); + + + assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network))); + + } } diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json index 087f8a3971..a9cef565df 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json @@ -5,7 +5,7 @@ "networkName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1", "networkType": "CONTRAIL30_BASIC", "modelCustomizationUuid": "8edf06ef-fd40-42cf-a054-0fc09108d3f0", - "networkTechnology": "NEUTRON", + "networkTechnology": "CONTRAIL", "subnets": [ { "subnetName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", @@ -35,7 +35,7 @@ "requestId": "6cfde724-76c7-4747-bcb3-67a59a46ca95", "serviceInstanceId": "testServiceInstanceId1" }, - "contrailRequest": false, + "contrailRequest": true, "skipAAI": true, "messageId": "175264dc-fb6b-4aae-ba42-8c77a63fec12", "synchronous": true diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/grApiVmNetworkSubSectionWith5GParams.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/grApiVmNetworkSubSectionWith5GParams.json new file mode 100644 index 0000000000..e83f487a64 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/grApiVmNetworkSubSectionWith5GParams.json @@ -0,0 +1,73 @@ +{ + "network-role": "vmNetworkRole0", + "segmentation-id" : "my-segemntation-id", + "floating-ips": { + "floating-ip-v4": [ + "floatingIpV40", + "floatingIpV41" + ], + "floating-ip-v6": [ + "floatingIpV60", + "floatingIpV61" + ] + }, + "interface-route-prefixes": { + "interface-route-prefix": [ + "interfaceRoutePrefix0", + "interfaceRoutePrefix1" + ] + }, + "sriov-parameters": { + "heat-vlan-filters": { + "heat-vlan-filter": [ + "heatVlanFilter0", + "heatVlanFilter1" + ] + } + }, + "network-information-items": { + "network-information-item": [ + { + "network-ips": { + "network-ip": [ + "ip0", + "ip1" + ] + }, + "ip-version": "ipv4" + }, + { + "network-ips": { + "network-ip": [ + "ip2", + "ip3" + ] + }, + "ip-version": "ipv6" + } + ] + }, + "related-networks" : { + "related-network" : [{ + "vlan-tags" : { + "is-private" : "True", + "upper-tag-id" : "1" + } + },{ + "vlan-tags" : { + "is-private" : "False", + "upper-tag-id" : "2" + } + },{ + "vlan-tags" : { + "is-private" : "True", + "upper-tag-id" : "3" + } + },{ + "vlan-tags" : { + "is-private" : "False", + "upper-tag-id" : "3" + } + }] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json new file mode 100644 index 0000000000..bd06f5f86f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json @@ -0,0 +1,68 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfId": "vnfId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": true, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "environment_context": "environmentContext", + "fw_0_subint_ctrl_port_0_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_net_ids": "networkId0", + "fw_0_subint_ctrl_port_0_net_names": "1", + "fw_subint_ctrl_port_0_subintcount": "1", + "fw_0_subint_ctrl_port_0_v6_ip": "ip0,ip1", + "fw_0_subint_ctrl_port_0_v6_ip_0": "ip0", + "fw_0_subint_ctrl_port_0_v6_ip_1": "ip1", + "fw_0_subint_ctrl_port_0_vlan_ids": "1", + "fw_subint_ctrl_port_0_floating_ip": "floatingIpV40", + "fw_subint_ctrl_port_0_floating_v6_ip": "floatingIpV60", + "workload_context": "workloadContext", + "key1": "value2", + "key3": "value3", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "vnfNetworkRole0_subnet_id": "subnetId0", + "vnfNetworkRole0_v6_subnet_id": "subnetId1", + "vmType0_name_0": "vmName0", + "vmType0_name_1": "vmName1", + "vmType0_names": "vmName0,vmName1", + "vmType0_vmNetworkRole0_floating_ip": "floatingIpV40", + "vmType0_vmNetworkRole0_floating_v6_ip": "floatingIpV60", + "vmType0_vmNetworkRole0_route_prefixes": "[{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix0\"},{\"interface_route_table_routes_route_prefix\": \"interfaceRoutePrefix1\"}]", + "vmNetworkRole0_ATT_VF_VLAN_FILTER": "heatVlanFilter0,heatVlanFilter1", + "vmType0_vmNetworkRole0_ip_0": "ip0", + "vmType0_vmNetworkRole0_ip_1": "ip1", + "vmType0_vmNetworkRole0_ips": "ip0,ip1", + "vmType0_vmNetworkRole0_v6_ip_0": "ip2", + "vmType0_vmNetworkRole0_v6_ip_1": "ip3", + "vmType0_vmNetworkRole0_v6_ips": "ip2,ip3", + "paramOne": "paramOneValue", + "paramTwo": "paramTwoValue", + "paramThree": "paramThreeValue" + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml index 4562ebdaea..6f67a9ccc4 100644 --- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -114,30 +114,6 @@ mso: version: '9' generic-vnf: version: '9' - v8: - customer: - uri: /aai/v8/business/customers/customer - generic-query: - uri: /aai/v8/search/generic-query - l3-network: - uri: /aai/v8/network/l3-networks/l3-network - network-policy: - uri: /aai/v8/network/network-policies/network-policy - nodes-query: - uri: /aai/v8/search/nodes-query - route-table-reference: - uri: /aai/v8/network/route-table-references/route-table-reference - tenant: - uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant - vce: - uri: /aai/v8/network/vces/vce - vpn-binding: - uri: /aai/v8/network/vpn-bindings/vpn-binding - v9: - cloud-region: - uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic - generic-vnf: - uri: /aai/v9/network/generic-vnfs/generic-vnf global: default: aai: @@ -220,4 +196,4 @@ camunda: bpm: metrics: enabled: false - db-reporter-activate: false
\ No newline at end of file + db-reporter-activate: false |