diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-07-30 15:56:09 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-07-31 11:09:25 -0400 |
commit | 5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch) | |
tree | 59a968f27b4b603aacc9d5e7b51fb598aeec5321 /bpmn/so-bpmn-tasks/src/test | |
parent | b6dc38501f3b746426b42d9de4cc883d894149e8 (diff) |
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18
Issue-ID: SO-670
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
164 files changed, 23337 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java new file mode 100644 index 0000000000..e527b587b7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/BaseTest.java @@ -0,0 +1,44 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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; + +import org.junit.runner.RunWith; +import org.onap.so.bpmn.buildingblock.SniroHomingV2; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.client.orchestration.SDNOHealthCheckResources; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +@ContextConfiguration +public abstract class BaseTest extends TestDataSetup { + + @SpyBean + protected SDNOHealthCheckResources MOCK_sdnoHealthCheckResources; + + @MockBean + protected SniroHomingV2 sniroHoming; +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java new file mode 100644 index 0000000000..a29df9cbcf --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java @@ -0,0 +1,64 @@ +/*- + * ============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; +import ch.vorburger.exec.ManagedProcessException; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import javax.sql.DataSource; + +@Configuration +@Profile({"test"}) +public class EmbeddedMariaDbConfig { + + @Bean + MariaDB4jSpringService mariaDB4jSpringService() { + MariaDB4jSpringService service = new MariaDB4jSpringService(); + + + service.getConfiguration().addArg("--lower_case_table_names=1"); + return service; + } + + @Bean + DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + //Create our database with default root user and no password + mariaDB4jSpringService.getDB().createDB(databaseName); + + DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); + + return DataSourceBuilder + .create() + .username(datasourceUsername) + .password(datasourcePassword) + .url(config.getURL(databaseName)) + .driverClassName(datasourceDriver) + .build(); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java new file mode 100644 index 0000000000..e35fe0db9f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/FileUtil.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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; + +import java.io.IOException; +import java.io.InputStream; +import org.onap.so.logger.MsoLogger; + +/** + * + * File utility class.<br/> + * <p> + * </p> + * + * @author + * @version ONAP Sep 15, 2017 + */ +public class FileUtil { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, FileUtil.class); + + /** + * Read the specified resource file and return the contents as a String. + * + * @param fileName Name of the resource file + * @return the contents of the resource file as a String + * @throws IOException if there is a problem reading the file + */ + public static String readResourceFile(String fileName) { + InputStream stream; + try { + stream = getResourceAsStream(fileName); + byte[] bytes; + bytes = new byte[stream.available()]; + if(stream.read(bytes) > 0) { + stream.close(); + return new String(bytes); + } else { + stream.close(); + return ""; + } + } catch (IOException e) { + LOGGER.debug("Exception:", e); + return ""; + } + } + + /** + * Get an InputStream for the resource specified. + * + * @param resourceName Name of resource for which to get InputStream. + * @return an InputStream for the resource specified. + * @throws IOException If we can't get the InputStream for whatever reason. + */ + private static InputStream getResourceAsStream(String resourceName) throws IOException { + InputStream stream = + FileUtil.class.getClassLoader().getResourceAsStream(resourceName); + if (stream == null) { + throw new IOException("Can't access resource '" + resourceName + "'"); + } + return stream; + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java new file mode 100644 index 0000000000..6401d5516d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java @@ -0,0 +1,54 @@ +package org.onap.so; +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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========================================================= + */ + + + +import java.io.IOException; + +import javax.annotation.PreDestroy; + +import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication; +import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; +import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl; +import org.onap.so.requestsdb.RequestsDBHelper; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.FilterType; +import org.springframework.context.annotation.Profile; + +@SpringBootApplication +@Profile("test") +@EnableProcessApplication("MSO CommonBPMN Test Application") +@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = { + @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class), + @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) }) +public class TestApplication { + public static void main(String... args) { + SpringApplication.run(TestApplication.class, args); + System.getProperties().setProperty("mso.db", "MARIADB"); + System.getProperties().setProperty("server.name", "Springboot"); + + + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java new file mode 100644 index 0000000000..501e64f4d4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java @@ -0,0 +1,119 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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; + +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.onap.so.TestApplication; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; +import org.onap.so.client.orchestration.AAICollectionResources; +import org.onap.so.client.orchestration.AAIInstanceGroupResources; +import org.onap.so.client.orchestration.AAINetworkResources; +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.client.orchestration.NetworkAdapterResources; +import org.onap.so.client.orchestration.SDNCNetworkResources; +import org.onap.so.client.orchestration.SDNCServiceInstanceResources; +import org.onap.so.client.orchestration.SDNCVfModuleResources; +import org.onap.so.client.orchestration.SDNCVnfResources; +import org.onap.so.client.orchestration.VnfAdapterVfModuleResources; +import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +@RunWith(SpringRunner.class) +@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@ActiveProfiles("test") +public abstract class BaseTaskTest extends TestDataSetup { + @MockBean + protected AAIVolumeGroupResources aaiVolumeGroupResources; + + @MockBean + protected AAIServiceInstanceResources aaiServiceInstanceResources; + + @MockBean + protected AAIVnfResources aaiVnfResources; + + @MockBean + protected AAIVfModuleResources aaiVfModuleResources; + + @MockBean + protected AAIVpnBindingResources aaiVpnBindingResources; + + @MockBean + protected AAINetworkResources aaiNetworkResources; + + @MockBean + protected AAICollectionResources aaiCollectionResources; + + @MockBean + protected NetworkAdapterResources networkAdapterResources; + + @MockBean + protected VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + + @MockBean + protected VnfAdapterVfModuleResources vnfAdapterVfModuleResources; + + @MockBean + protected SDNCVnfResources sdncVnfResources; + + @MockBean + protected SDNCNetworkResources sdncNetworkResources; + + @MockBean + protected SDNCVfModuleResources sdncVfModuleResources; + + @MockBean + protected SDNCServiceInstanceResources sdncServiceInstanceResources; + + @MockBean + protected AssignNetworkBBUtils assignNetworkBBUtils; + + @MockBean + protected NetworkAdapterObjectMapper networkAdapterObjectMapper; + + @MockBean + protected AAIInstanceGroupResources aaiInstanceGroupResources; + + @MockBean + protected CatalogDbClient catalogDbClient; + + @Mock + protected BBInputSetupUtils bbSetupUtils; + + @Mock + protected BBInputSetup bbInputSetup; + + @SpyBean + protected SDNCClient SPY_sdncClient; +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java new file mode 100644 index 0000000000..946c5dfe80 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java @@ -0,0 +1,139 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.common.aai.tasks; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.infrastructure.aai.tasks.AAIFlagTasks; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAIVnfResources; +import org.springframework.beans.factory.annotation.Autowired; + +@RunWith(MockitoJUnitRunner.class) +public class AAIFlagTasksTest extends TestDataSetup { + + @InjectMocks + private AAIFlagTasks aaiFlagTasks = new AAIFlagTasks(); + + @Mock + private AAIVnfResources aaiVnfResources; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + + @Mock + private ExtractPojosForBB extractPojosForBB; + + @Mock + private ExceptionBuilder exceptionUtil; + + private GenericVnf genericVnf; + + @Before + public void before() throws BBObjectNotFoundException { + genericVnf = setGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf); + } + + @Test + public void checkVnfInMaintTestTrue() throws Exception { + doThrow(new BpmnError("VNF is in maintenance in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + doReturn(true).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + try { + aaiFlagTasks.checkVnfInMaintFlag(execution); + } catch (Exception e) { + verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class)); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF is in maintenance in A&AI")); + } + } + + @Test + public void checkVnfInMaintTestFalse() throws Exception { + doReturn(false).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + aaiFlagTasks.checkVnfInMaintFlag(execution); + verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class)); + } + + @Test + public void checkVnfInMaintFlagExceptionTest() { + + doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + doThrow(Exception.class).when(aaiVnfResources).checkInMaintFlag(isA(String.class)); + try { + aaiFlagTasks.checkVnfInMaintFlag(execution); + } catch (Exception e) { + verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class)); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + + } + + @Test + public void modifyVnfInMaintFlagTest() throws Exception { + doNothing().when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class)); + aaiFlagTasks.modifyVnfInMaintFlag(execution, true); + verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf); + } + + @Test + public void modifyVnfInMaintFlagExceptionTest() { + + doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + doThrow(Exception.class).when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class)); + try { + aaiFlagTasks.modifyVnfInMaintFlag(execution, true); + } catch (Exception e) { + verify(aaiVnfResources, times(1)).checkInMaintFlag(any(String.class)); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + } +} 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 new file mode 100644 index 0000000000..a20b68b147 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java @@ -0,0 +1,665 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.common.data; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.assertj.core.util.Arrays; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl; +import org.junit.Before; +import org.junit.Rule; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.DelegateExecutionImpl; +import org.onap.so.bpmn.servicedecomposition.bbobjects.AllottedResource; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +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.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +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.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoAllottedResource; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +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; + +public class TestDataSetup{ + private int collectionCounter; + private int configurationCounter; + private int customerCounter; + private int genericVnfCounter; + private int instanceGroupCounter; + private int l3NetworkCounter; + private int owningEntityCounter; + private int pnfCounter; + private int projectCounter; + private int serviceInstanceCounter; + private int serviceProxyCounter; + private int serviceSubscriptionCounter; + private int vfModuleCounter; + private int volumeGroupCounter; + private int vpnBindingCounter; + private int vpnBondingLinkCounter; + + protected BuildingBlockExecution execution; + + protected GeneralBuildingBlock gBBInput; + + protected HashMap<ResourceKey, String> lookupKeyMap; + + protected ExtractPojosForBB extractPojosForBB = new ExtractPojosForBB(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + protected DelegateExecution delegateExecution; + + @Before + public void buildingBlockTestDataSetupBefore() { + collectionCounter = 0; + configurationCounter = 0; + customerCounter = 0; + genericVnfCounter = 0; + instanceGroupCounter = 0; + l3NetworkCounter = 0; + owningEntityCounter = 0; + pnfCounter = 0; + projectCounter = 0; + serviceInstanceCounter = 0; + serviceProxyCounter = 0; + serviceSubscriptionCounter = 0; + vfModuleCounter = 0; + volumeGroupCounter = 0; + vpnBindingCounter = 0; + vpnBondingLinkCounter = 0; + + execution = new DelegateExecutionImpl(new ExecutionImpl()); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + + gBBInput = new GeneralBuildingBlock(); + execution.setVariable("gBBInput", gBBInput); + + lookupKeyMap = new HashMap<ResourceKey, String>(); + execution.setVariable("lookupKeyMap", lookupKeyMap); + + ExecutionImpl mockExecutionImpl = mock(ExecutionImpl.class); + doReturn("test").when(mockExecutionImpl).getProcessInstanceId(); + + ExecutionImpl executionImpl = new ExecutionImpl(); + executionImpl.setProcessInstance(mockExecutionImpl); + + delegateExecution = (DelegateExecution) executionImpl; + delegateExecution.setVariable("testProcessKey", "testProcessKeyValue"); + } + + public Map<String, String> buildUserInput() { + Map<String, String> userInput = new HashMap<>(); + userInput.put("testUserInputKey", "testUserInputValue"); + + return userInput; + } + + public Map<String, String> setUserInput() { + Map<String, String> userInput = buildUserInput(); + + gBBInput.setUserInput(userInput); + + return userInput; + } + + public RequestContext buildRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId(UUID.randomUUID().toString()); + requestContext.setProductFamilyId("testProductFamilyId"); + requestContext.setRequestorId("testRequestorId"); + + requestContext.setUserParams(new HashMap<>()); + + Map<String,Object> dataMap = new HashMap<>(); + dataMap.put("vpnId","testVpnId"); + dataMap.put("vpnRegion","testVpnRegion"); + dataMap.put("vpnRt","testVpnRt"); + dataMap.put("vpnName","vpnName"); + dataMap.put("vpnRegion", Arrays.asList(new String[] {"USA", "EMEA", "APAC"})); + + HashMap<String,Object> userParams = new HashMap<>(); + userParams.put("vpnData",dataMap); + + List<Map<String,Object>> userParamsList = new ArrayList<>(); + userParamsList.add(userParams); + + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParamsList); + requestContext.setRequestParameters(requestParameters); + + return requestContext; + } + + public RequestContext setRequestContext() { + RequestContext requestContext = buildRequestContext(); + + gBBInput.setRequestContext(requestContext); + + return requestContext; + } + + public CloudRegion buildCloudRegion() { + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("testLcpCloudRegionId"); + cloudRegion.setTenantId("testTenantId"); + cloudRegion.setCloudOwner("testCloudOwner"); + + return cloudRegion; + } + + public CloudRegion setCloudRegion() { + CloudRegion cloudRegion = buildCloudRegion(); + + gBBInput.setCloudRegion(cloudRegion); + + return cloudRegion; + } + + public OrchestrationContext buildOrchestrationContext() { + OrchestrationContext orchestrationContext = new OrchestrationContext(); + + return orchestrationContext; + } + + public OrchestrationContext setOrchestrationContext() { + OrchestrationContext orchestrationContext = buildOrchestrationContext(); + + gBBInput.setOrchContext(orchestrationContext); + + return orchestrationContext; + } + + public Collection buildCollection() { + collectionCounter++; + + Collection collection = new Collection(); + collection.setId("testId" + collectionCounter); + collection.setInstanceGroup(buildInstanceGroup()); + + return collection; + } + + public Configuration buildConfiguration() { + configurationCounter++; + + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId" + configurationCounter); + configuration.setConfigurationName("testConfigurationName" + configurationCounter); + + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter); + modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter); + modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter); + + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + return configuration; + } + + public OwningEntity buildOwningEntity() { + owningEntityCounter++; + + OwningEntity owningEntity = new OwningEntity(); + owningEntity.setOwningEntityId("testOwningEntityId" + owningEntityCounter); + owningEntity.setOwningEntityName("testOwningEntityName" + owningEntityCounter); + + return owningEntity; + } + + public Project buildProject() { + projectCounter++; + + Project project = new Project(); + project.setProjectName("testProjectName" + projectCounter); + + return project; + } + + public ServiceSubscription buildServiceSubscription() { + serviceSubscriptionCounter++; + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setTempUbSubAccountId("testTempUbSubAccountId" + serviceSubscriptionCounter); + serviceSubscription.setServiceType("testServiceType" + serviceSubscriptionCounter); + + return serviceSubscription; + } + + public Customer buildCustomer() { + customerCounter++; + + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId" + customerCounter); + customer.setSubscriberType("testSubscriberType" + customerCounter); + + customer.setServiceSubscription(buildServiceSubscription()); + + return customer; + } + + public ServiceInstance buildServiceInstance() { + serviceInstanceCounter++; + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId" + serviceInstanceCounter); + serviceInstance.setServiceInstanceName("testServiceInstanceName" + serviceInstanceCounter); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("testModelInvariantUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelUuid("testModelUUID" + serviceInstanceCounter); + modelInfoServiceInstance.setModelVersion("testModelVersion" + serviceInstanceCounter); + modelInfoServiceInstance.setModelName("testModelName" + serviceInstanceCounter); + modelInfoServiceInstance.setServiceType("testServiceType" + serviceInstanceCounter); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + serviceInstance.setProject(buildProject()); + + serviceInstance.setOwningEntity(buildOwningEntity()); + + serviceInstance.setCollection(buildCollection()); + + serviceInstance.getConfigurations().add(buildConfiguration()); + + return serviceInstance; + } + + public ServiceInstance setServiceInstance() { + ServiceInstance serviceInstance = buildServiceInstance(); + + if(gBBInput.getCustomer() == null) { + gBBInput.setCustomer(buildCustomer()); + } + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().add(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + + return serviceInstance; + } + + public Customer setCustomer() { + if(gBBInput.getCustomer() != null) return gBBInput.getCustomer(); + Customer customer = new Customer(); + customer.setGlobalCustomerId("testGlobalCustomerId"); + customer.setSubscriberType("testSubscriberType"); + + customer.setServiceSubscription(buildServiceSubscription()); + + gBBInput.setCustomer(customer); + + return customer; + } + + public Collection setCollection() { + Collection collection = new Collection(); + collection.setId("testId"); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.setCollection(collection); + + return collection; + } + + public InstanceGroup setInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId"); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction"); + + Collection collection = null; + + try { + ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + collection = serviceInstance.getCollection(); + + if (collection == null) { + collection = setCollection(); + } + } catch(BBObjectNotFoundException e) { + collection = setCollection(); + } + + collection.setInstanceGroup(instanceGroup); + + return instanceGroup; + } + + public VpnBinding buildVpnBinding() { + vpnBindingCounter++; + + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId" + vpnBindingCounter); + vpnBinding.setVpnName("testVpnName" + vpnBindingCounter); + vpnBinding.setCustomerVpnId("testCustomerVpnId" + vpnBindingCounter); + + return vpnBinding; + } + + public VpnBinding setVpnBinding() { + VpnBinding vpnBinding = buildVpnBinding(); + + Customer customer = gBBInput.getCustomer(); + + if(customer == null){ + customer = buildCustomer(); + } + + customer.getVpnBindings().add(vpnBinding); + lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId()); + + return vpnBinding; + } + + public InstanceGroup buildInstanceGroup() { + instanceGroupCounter++; + + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("testId" + instanceGroupCounter); + instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction" + instanceGroupCounter); + + return instanceGroup; + } + + public L3Network buildL3Network() { + l3NetworkCounter++; + + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId" + l3NetworkCounter); + network.setNetworkName("testNetworkName" + l3NetworkCounter); + network.setNetworkType("testNetworkType" + l3NetworkCounter); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter); + modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter); + modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter); + modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter); + network.setModelInfoNetwork(modelInfoNetwork); + + return network; + } + + public L3Network setL3Network() { + L3Network network = buildL3Network(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + + return network; + } + + public GenericVnf buildGenericVnf() { + genericVnfCounter++; + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("testVnfId" + genericVnfCounter); + genericVnf.setVnfName("testVnfName" + genericVnfCounter); + genericVnf.setVnfType("testVnfType" + genericVnfCounter); + + Platform platform = new Platform(); + platform.setPlatformName("testPlatformName"); + genericVnf.setPlatform(platform); + + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("testLineOfBusinessName"); + genericVnf.setLineOfBusiness(lob); + + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelName("testModelName" + genericVnfCounter); + modelInfoGenericVnf.setModelCustomizationUuid("testModelCustomizationUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelInvariantUuid("testModelInvariantUUID" + genericVnfCounter); + modelInfoGenericVnf.setModelVersion("testModelVersion" + genericVnfCounter); + modelInfoGenericVnf.setModelUuid("testModelUUID" + genericVnfCounter); + genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + return genericVnf; + } + + public GenericVnf setGenericVnf() { + GenericVnf genericVnf = buildGenericVnf(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVnfs().add(genericVnf); + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, genericVnf.getVnfId()); + + return genericVnf; + } + + public VfModule buildVfModule() { + vfModuleCounter++; + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId" + vfModuleCounter); + vfModule.setVfModuleName("testVfModuleName" + vfModuleCounter); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("testModelInvariantUUID" + vfModuleCounter); + modelInfoVfModule.setModelVersion("testModelVersion" + vfModuleCounter); + modelInfoVfModule.setModelUUID("testModelUUID" + vfModuleCounter); + modelInfoVfModule.setModelName("testModelName" + vfModuleCounter); + modelInfoVfModule.setModelCustomizationUUID("testModelCustomizationUUID" + vfModuleCounter); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + return vfModule; + } + + public VfModule setVfModule() { + VfModule vfModule = buildVfModule(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVfModules().add(vfModule); + lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModule.getVfModuleId()); + + return vfModule; + } + + public VolumeGroup buildVolumeGroup() { + volumeGroupCounter++; + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("testVolumeGroupId" + volumeGroupCounter); + volumeGroup.setVolumeGroupName("testVolumeGroupName" + volumeGroupCounter); + volumeGroup.setHeatStackId("testHeatStackId" + volumeGroupCounter); + + return volumeGroup; + } + + public VolumeGroup setVolumeGroup() { + VolumeGroup volumeGroup = buildVolumeGroup(); + + GenericVnf genericVnf = null; + + try { + genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + } catch(BBObjectNotFoundException e) { + genericVnf = setGenericVnf(); + } + + genericVnf.getVolumeGroups().add(volumeGroup); + lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId()); + + return volumeGroup; + } + + public Pnf buildPnf() { + pnfCounter++; + + Pnf pnf = new Pnf(); + pnf.setPnfId("testPnfId" + pnfCounter); + pnf.setPnfName("testPnfName" + pnfCounter); + + return pnf; + } + + public ServiceProxy buildServiceProxy() { + serviceProxyCounter++; + + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setServiceInstance(buildServiceInstance()); + serviceProxy.getServiceInstance().getVnfs().add(buildGenericVnf()); + + Pnf primaryPnf = buildPnf(); + primaryPnf.setRole("Primary"); + serviceProxy.getServiceInstance().getPnfs().add(primaryPnf); + + Pnf secondaryPnf = buildPnf(); + secondaryPnf.setRole("Secondary"); + serviceProxy.getServiceInstance().getPnfs().add(secondaryPnf); + + return serviceProxy; + } + + public VpnBondingLink buildVpnBondingLink() { + vpnBondingLinkCounter++; + + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter); + + Configuration vnrConfiguration = buildConfiguration(); + vnrConfiguration.setNetwork(buildL3Network()); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); + + vpnBondingLink.setVrfConfiguration(buildConfiguration()); + + vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy()); + + vpnBondingLink.setTransportServiceProxy(buildServiceProxy()); + + return vpnBondingLink; + } + + public VpnBondingLink setVpnBondingLink() { + VpnBondingLink vpnBondingLink = buildVpnBondingLink(); + + ServiceInstance serviceInstance = null; + + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + + serviceInstance.getVpnBondingLinks().add(vpnBondingLink); + lookupKeyMap.put(ResourceKey.VPN_BONDING_LINK_ID, vpnBondingLink.getVpnBondingLinkId()); + + + return vpnBondingLink; + } + + public Customer setAvpnCustomer() { + Customer customer = buildCustomer(); + + gBBInput.setCustomer(customer); + + return customer; + } + + public ServiceProxy setServiceProxy(String uniqueIdentifier, String type) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setId("testProxyId" + uniqueIdentifier); + serviceProxy.setType(type); + + ModelInfoServiceProxy modelInfo = new ModelInfoServiceProxy(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + + serviceProxy.setModelInfoServiceProxy(modelInfo); + + return serviceProxy; + } + + public AllottedResource setAllottedResource(String uniqueIdentifier) { + AllottedResource ar = new AllottedResource(); + ar.setId("testAllottedResourceId" + uniqueIdentifier); + + ModelInfoAllottedResource modelInfo = new ModelInfoAllottedResource(); + modelInfo.setModelInvariantUuid("testProxyModelInvariantUuid" + uniqueIdentifier); + modelInfo.setModelName("testProxyModelName" + uniqueIdentifier); + modelInfo.setModelUuid("testProxyModelUuid" + uniqueIdentifier); + modelInfo.setModelVersion("testProxyModelVersion" + uniqueIdentifier); + + ar.setModelInfoAllottedResource(modelInfo); + + return ar; + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java new file mode 100644 index 0000000000..51a7f1ab04 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java @@ -0,0 +1,387 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.aai.tasks; + +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.BaseTaskTest; +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.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class AAICreateTasksTest extends BaseTaskTest{ + @Autowired + private AAICreateTasks aaiCreateTasks; + + private ServiceInstance serviceInstance; + private L3Network network; + private GenericVnf genericVnf; + private VolumeGroup volumeGroup; + private CloudRegion cloudRegion; + private VfModule vfModule; + private Customer customer; + + @Rule + public final ExpectedException exception = ExpectedException.none(); + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + genericVnf = setGenericVnf(); + volumeGroup = setVolumeGroup(); + cloudRegion = setCloudRegion(); + vfModule = setVfModule(); + + } + + @Test + public void createServiceInstanceTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer); + aaiCreateTasks.createServiceInstance(execution); + verify(aaiServiceInstanceResources, times(1)).createServiceInstance(serviceInstance, customer); + } + + @Test + public void createServiceInstanceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound"); + doThrow(Exception.class).when(aaiServiceInstanceResources).createServiceInstance(serviceInstance, customer); + aaiCreateTasks.createServiceInstance(execution); + } + + @Test + public void createVolumeGroupTest() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doNothing().when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion); + doNothing().when(aaiVolumeGroupResources).connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); + + aaiCreateTasks.createVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).createVolumeGroup(volumeGroup, cloudRegion); + verify(aaiVolumeGroupResources, times(1)).connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); + verify(aaiVolumeGroupResources, times(1)).connectVolumeGroupToTenant(volumeGroup, cloudRegion); + } + + @Test + public void createVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doThrow(Exception.class).when(aaiVolumeGroupResources).createVolumeGroup(volumeGroup, cloudRegion); + + aaiCreateTasks.createVolumeGroup(execution); + } + + @Test + public void createProjectTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + verify(aaiServiceInstanceResources, times(1)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + } + + @Test + public void createPlatformTest() throws Exception { + doNothing().when(aaiVnfResources).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf); + aaiCreateTasks.createPlatform(execution); + verify(aaiVnfResources, times(1)).createPlatformandConnectVnf(genericVnf.getPlatform(), genericVnf); + } + + @Test + public void createLineOfBusinessTest() throws Exception { + doNothing().when(aaiVnfResources).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf); + aaiCreateTasks.createLineOfBusiness(execution); + verify(aaiVnfResources, times(1)).createLineOfBusinessandConnectVnf(genericVnf.getLineOfBusiness(), genericVnf); + } + + @Test + public void createProjectExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "notfound"); + doThrow(Exception.class).when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + } + + @Test + public void createProjectNullProjectNameTest() throws Exception { + serviceInstance.getProject().setProjectName(null); + doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + verify(aaiServiceInstanceResources, times(0)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + } + + @Test + public void createProjectEmptyProjectNameTest() throws Exception { + serviceInstance.getProject().setProjectName(""); + doNothing().when(aaiServiceInstanceResources).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + aaiCreateTasks.createProject(execution); + verify(aaiServiceInstanceResources, times(0)).createProjectandConnectServiceInstance(serviceInstance.getProject(), serviceInstance); + } + + @Test + public void createOwningEntityTest() throws Exception { + doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + doNothing().when(aaiServiceInstanceResources).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(),serviceInstance); + aaiCreateTasks.createOwningEntity(execution); + verify(aaiServiceInstanceResources, times(1)).existsOwningEntity(serviceInstance.getOwningEntity()); + verify(aaiServiceInstanceResources, times(1)).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(), serviceInstance); + } + + @Test + public void createOwningEntityNotExistsOwningEntityTest() throws Exception { + doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + doNothing().when(aaiServiceInstanceResources).createOwningEntityandConnectServiceInstance(serviceInstance.getOwningEntity(),serviceInstance); + aaiCreateTasks.createOwningEntity(execution); + verify(aaiServiceInstanceResources, times(1)).existsOwningEntity(serviceInstance.getOwningEntity()); + verify(aaiServiceInstanceResources, times(1)).createOwningEntityandConnectServiceInstance(serviceInstance.getOwningEntity(), serviceInstance); + } + + @Test + public void createOwningEntityNullOwningEntityIdTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityId(null); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityEmptyOwningEntityIdTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityId(""); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityNullOwningEntityNameTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityName(null); + + doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityEmptyOwningEntityNameTest() throws Exception { + expectedException.expect(BpmnError.class); + + serviceInstance.getOwningEntity().setOwningEntityName(""); + + doReturn(false).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createOwningEntityExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doReturn(true).when(aaiServiceInstanceResources).existsOwningEntity(serviceInstance.getOwningEntity()); + + doThrow(Exception.class).when(aaiServiceInstanceResources).connectOwningEntityandServiceInstance(serviceInstance.getOwningEntity(), serviceInstance); + + aaiCreateTasks.createOwningEntity(execution); + } + + @Test + public void createVnfTest() throws Exception { + doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + aaiCreateTasks.createVnf(execution); + verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + } + + @Test + public void createVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "notfound"); + doNothing().when(aaiVnfResources).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + aaiCreateTasks.createVnf(execution); + verify(aaiVnfResources, times(1)).createVnfandConnectServiceInstance(genericVnf, serviceInstance); + } + + + @Test + public void createVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).createVfModule(vfModule, genericVnf); + aaiCreateTasks.createVfModule(execution); + verify(aaiVfModuleResources, times(1)).createVfModule(vfModule, genericVnf); + } + + @Test + public void createServiceSubscriptionTest(){ + doNothing().when(aaiServiceInstanceResources).createServiceSubscription(customer); + aaiCreateTasks.createServiceSubscription(execution); + verify(aaiServiceInstanceResources, times(1)).createServiceSubscription(customer); + } + + @Test + public void createServiceSubscriptionTestExceptionHandling(){ + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiServiceInstanceResources).createServiceSubscription(customer); + aaiCreateTasks.createServiceSubscription(execution); + } + + @Test + public void createServiceSubscriptionTestCustomerIsNull(){ + expectedException.expect(BpmnError.class); + gBBInput.setCustomer(null); + aaiCreateTasks.createServiceSubscription(execution); + } + + @Test + public void createVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVfModuleResources).createVfModule(vfModule, genericVnf); + aaiCreateTasks.createVfModule(execution); + } + + @Test + public void connectVfModuleToVolumeGroupTest() throws Exception { + doNothing().when(aaiVfModuleResources).connectVfModuleToVolumeGroup(genericVnf, vfModule, volumeGroup, cloudRegion); + aaiCreateTasks.connectVfModuleToVolumeGroup(execution); + verify(aaiVfModuleResources, times(1)).connectVfModuleToVolumeGroup(genericVnf, vfModule, volumeGroup, cloudRegion); + } + + @Test + public void createNetworkTest() throws Exception { + network.getModelInfoNetwork().setNeutronNetworkType("PROVIDER"); + + doNothing().when(aaiNetworkResources).createNetworkConnectToServiceInstance(network,serviceInstance); + aaiCreateTasks.createNetwork(execution); + verify(aaiNetworkResources, times(1)).createNetworkConnectToServiceInstance(network, serviceInstance); + } + + @Test + public void createNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + lookupKeyMap.put(ResourceKey.NETWORK_ID, "notfound"); + doThrow(Exception.class).when(aaiNetworkResources).createNetworkConnectToServiceInstance(network,serviceInstance); + aaiCreateTasks.createNetwork(execution); + } + + @Test + public void createCustomerTest() throws Exception { + doNothing().when(aaiVpnBindingResources).createCustomer(customer); + + aaiCreateTasks.createCustomer(execution); + + verify(aaiVpnBindingResources, times(1)).createCustomer(customer); + } + + @Test + public void createCustomerExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVpnBindingResources).createCustomer(customer); + + aaiCreateTasks.createCustomer(execution); + } + + @Test + public void createNetworkCollectionTest() throws Exception { + doNothing().when(aaiNetworkResources).createNetworkCollection(serviceInstance.getCollection()); + execution.setVariable("networkCollectionName", "testNetworkCollectionName"); + aaiCreateTasks.createNetworkCollection(execution); + verify(aaiNetworkResources, times(1)).createNetworkCollection(serviceInstance.getCollection()); + } + + @Test + public void createNetworkCollectionInstanceGroupTest() throws Exception { + doNothing().when(aaiNetworkResources).createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); + aaiCreateTasks.createNetworkCollectionInstanceGroup(execution); + verify(aaiNetworkResources, times(1)).createNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup()); + } + + @Test + public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance); + aaiCreateTasks.connectNetworkToNetworkCollectionServiceInstance(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance); + } + + @Test + public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup()); + aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToNetworkCollectionInstanceGroup(network, serviceInstance.getCollection().getInstanceGroup()); + } + + @Test + public void connectNetworkToNullNetworkCollectionInstanceGroupTest() throws Exception { + //reset test data to have no network collection instance group + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("testServiceInstanceId"); + L3Network network = new L3Network(); + network.setNetworkId("testNetworkId"); + serviceInstance.getNetworks().add(network); + lookupKeyMap.put(ResourceKey.NETWORK_ID, network.getNetworkId()); + gBBInput.setServiceInstance(serviceInstance); + lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstance.getServiceInstanceId()); + //verify connection call was not executednetwork + exception.expect(BpmnError.class); + aaiCreateTasks.connectNetworkToNetworkCollectionInstanceGroup(execution); + verify(aaiNetworkResources, never()).connectNetworkToNetworkCollectionInstanceGroup(network, null); + } + + @Test + public void connectNetworkToCloudRegionTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiNetworkResources).connectNetworkToCloudRegion(network, gBBInput.getCloudRegion()); + aaiCreateTasks.connectNetworkToCloudRegion(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToCloudRegion(network, gBBInput.getCloudRegion()); + } + + @Test + public void connectNetworkToTenantTest() throws Exception { + gBBInput = execution.getGeneralBuildingBlock(); + doNothing().when(aaiNetworkResources).connectNetworkToTenant(network, gBBInput.getCloudRegion()); + aaiCreateTasks.connectNetworkToTenant(execution); + verify(aaiNetworkResources, times(1)).connectNetworkToTenant(network, gBBInput.getCloudRegion()); + } +} 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 new file mode 100644 index 0000000000..6ad263a935 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java @@ -0,0 +1,427 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.aai.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +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.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class AAIUpdateTasksTest extends BaseTaskTest{ + @Autowired + private AAIUpdateTasks aaiUpdateTasks; + + private L3Network network; + private ServiceInstance serviceInstance; + private VfModule vfModule; + private GenericVnf genericVnf; + private VolumeGroup volumeGroup; + private CloudRegion cloudRegion; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + volumeGroup = setVolumeGroup(); + cloudRegion = setCloudRegion(); + network = setL3Network(); + } + + @Test + public void updateOrchestrationStatusAssignedServiceTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution); + + verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); + } + + @Test + public void updateOrchestrationStatusAssignedServiceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedService(execution); + } + + @Test + public void updateOrchestrationStatusActiveServiceTest() throws Exception { + doNothing().when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveService(execution); + + verify(aaiServiceInstanceResources, times(1)).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActiveServiceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiServiceInstanceResources).updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveService(execution); + } + + @Test + public void updateOrchestrationStatusAssignedVnfTest() throws Exception { + doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution); + + verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); + } + + @Test + public void updateOrchestrationStatusAssignedVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVnf(execution); + } + + @Test + public void updateOrchestrationStatusActiveVnfTest() throws Exception { + doNothing().when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution); + + verify(aaiVnfResources, times(1)).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActiveVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiVnfResources).updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveVnf(execution); + } + + @Test + public void updateOrchestrationStatusAssignVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution); + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + assertEquals("", vfModule.getHeatStackId()); + } + + @Test + public void updateOrchestrationStatusAssignVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVfModule(execution); + } + + @Test + public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution); + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + } + + @Test + public void updateOrchestrationStatusCreatedVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusCreatedVfModule(execution); + } + + @Test + public void updateOrchestrationStatusPendingActivatefModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); + + aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); + } + + @Test + public void updateOrchestrationStatusPendingActivatefModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.PENDING_ACTIVATION); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusPendingActivationVfModule(execution); + } + + @Test + public void updateOrchestrationStatusDectivateVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + + aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + } + + @Test + public void updateOrchestrationStatusDectivateVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.CREATED); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusDeactivateVfModule(execution); + } + + @Test + public void updateOrchestrationStatusActiveVolumeGroupTest() throws Exception { + doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActiveVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + aaiUpdateTasks.updateOrchestrationStatusActiveVolumeGroup(execution); + } + + @Test + public void updateOrchestrationStatusCreatedVolumeGroupTest() throws Exception { + doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); + + aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); + } + + @Test + public void updateOrchestrationStatusCreatedVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED); + aaiUpdateTasks.updateOrchestrationStatusCreatedVolumeGroup(execution); + } + + @Test + public void test_updateOrchestrationStatusAssignedVolumeGroup() throws Exception { + doNothing().when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(execution); + + verify(aaiVolumeGroupResources, times(1)).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); + assertEquals("", volumeGroup.getHeatStackId()); + } + + @Test + public void test_updateOrchestrationStatusAssignedVolumeGroup_exception() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVolumeGroupResources).updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED); + aaiUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(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 { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateOrchestrationStatusActiveNetwork(execution); + } + + @Test + public void updateOstatusActivedNetworkCollectionTest() throws Exception { + doNothing().when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); + aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); + verify(aaiCollectionResources, times(1)).updateCollection(serviceInstance.getCollection()); + } + + @Test + public void updateOstatusActiveNetworkColectionExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiCollectionResources).updateCollection(serviceInstance.getCollection()); + aaiUpdateTasks.updateOrchestrationStatusActiveNetworkCollection(execution); + } + + @Test + public void updateOrchestrationStatusActivateVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); + + aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); + } + + @Test + public void updateOrchestrationStatusActivateVfModuleExceptionTest() throws Exception { + doThrow(Exception.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ACTIVE); + + expectedException.expect(BpmnError.class); + + aaiUpdateTasks.updateOrchestrationStatusActivateVfModule(execution); + } + + @Test + public void updateNetworkCreatedTest() throws Exception { + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkFqdn("testNetworkFqdn"); + createNetworkResponse.setNetworkStackId("testNetworkStackId"); + + execution.setVariable("createNetworkResponse", createNetworkResponse); + + doNothing().when(aaiNetworkResources).updateNetwork(network); + aaiUpdateTasks.updateNetworkCreated(execution); + verify(aaiNetworkResources, times(1)).updateNetwork(network); + + assertEquals(createNetworkResponse.getNetworkFqdn(), network.getContrailNetworkFqdn()); + assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus()); + assertEquals(createNetworkResponse.getNetworkStackId(), network.getHeatStackId()); + assertEquals(createNetworkResponse.getNeutronNetworkId(), network.getNeutronNetworkId()); + } + + @Test + public void updateNetworkCreatedkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); + aaiUpdateTasks.updateNetworkCreated(execution); + } + + @Test + public void updateObjectNetworkTest() { + doNothing().when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateObjectNetwork(execution); + + verify(aaiNetworkResources, times(1)).updateNetwork(network); + } + + @Test + public void updateObjectNetworkExceptionText() { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(aaiNetworkResources).updateNetwork(network); + + aaiUpdateTasks.updateObjectNetwork(execution); + } + + @Test + public void test_updateServiceInstance() { + doNothing().when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance); + aaiUpdateTasks.updateServiceInstance(execution); + verify(aaiServiceInstanceResources, times(1)).updateServiceInstance(serviceInstance); + } + + @Test + public void test_updateServiceInstance_exception() { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiServiceInstanceResources).updateServiceInstance(serviceInstance); + aaiUpdateTasks.updateServiceInstance(execution); + } + + @Test + public void updateObjectVnfTest() { + doNothing().when(aaiVnfResources).updateObjectVnf(genericVnf); + + aaiUpdateTasks.updateObjectVnf(execution); + + verify(aaiVnfResources, times(1)).updateObjectVnf(genericVnf); + } + + @Test + public void updateObjectVnfExceptionTest() { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVnfResources).updateObjectVnf(genericVnf); + aaiUpdateTasks.updateObjectVnf(execution); + } + + @Test + public void updateOrchestrationStatusDeleteVfModuleTest() throws Exception { + doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + + aaiUpdateTasks.updateOrchestrationStatusDeleteVfModule(execution); + + verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf, OrchestrationStatus.ASSIGNED); + assertEquals("", vfModule.getHeatStackId()); + } + + @Test + public void updateModelVfModuleTest() { + doNothing().when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf); + aaiUpdateTasks.updateModelVfModule(execution); + verify(aaiVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf); + } + + @Test + public void updateModelVfModuleExceptionTest() { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf); + aaiUpdateTasks.updateModelVfModule(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java new file mode 100644 index 0000000000..64760c03a0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterCreateTasksTest.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.adapter.network.tasks; + +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Map; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkAdapterCreateTasksTest extends BaseTaskTest{ + @Autowired + private NetworkAdapterCreateTasks networkAdapterCreateTasks; + + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private L3Network l3Network; + private Map<String, String> userInput; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + l3Network = setL3Network(); + userInput = setUserInput(); + userInput.put("userInputKey1", "userInputValue1"); + requestContext = setRequestContext(); + cloudRegion = setCloudRegion(); + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void createNetworkTest() throws Exception { + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkStackId("networkStackId"); + createNetworkResponse.setNetworkCreated(true); + Optional<CreateNetworkResponse> oCreateNetworkResponse = Optional.of(createNetworkResponse); + + String cloudRegionPo = "cloudRegionPo"; + execution.setVariable("cloudRegionPo", cloudRegionPo); + + doReturn(oCreateNetworkResponse).when(networkAdapterResources).createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo,customer); + networkAdapterCreateTasks.createNetwork(execution); + verify(networkAdapterResources, times(1)).createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo,customer); + } + + @Test + public void rollbackCreateNetworkTest() throws Exception { + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkStackId("networkStackId"); + createNetworkResponse.setNetworkCreated(true); + execution.setVariable("createNetworkResponse", createNetworkResponse); + Optional<CreateNetworkResponse> oCreateNetworkResponse = Optional.of(createNetworkResponse); + + String cloudRegionPo = "cloudRegionPo"; + execution.setVariable("cloudRegionPo", cloudRegionPo); + + doReturn(oCreateNetworkResponse).when(networkAdapterResources).rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + networkAdapterCreateTasks.rollbackCreateNetwork(execution); + verify(networkAdapterResources, times(1)).rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java new file mode 100644 index 0000000000..88b654fd45 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterDeleteTasksTest.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.adapter.network.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.UnsupportedEncodingException; +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkAdapterDeleteTasksTest extends BaseTaskTest{ + @Autowired + private NetworkAdapterDeleteTasks networkAdapterDeleteTasks; + + private ServiceInstance serviceInstance; + private L3Network l3Network; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private String cloudRegionPo; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + l3Network = setL3Network(); + requestContext = setRequestContext(); + cloudRegion = setCloudRegion(); + } + + @Test + public void test_deleteNetwork() throws UnsupportedEncodingException, NetworkAdapterClientException { + + DeleteNetworkResponse deleteNetworkResponse = new DeleteNetworkResponse(); + deleteNetworkResponse.setNetworkDeleted(true); + deleteNetworkResponse.setNetworkId(l3Network.getNetworkId()); + Optional<DeleteNetworkResponse> oDeleteNetworkResponse = Optional.of(deleteNetworkResponse); + doReturn(oDeleteNetworkResponse).when(networkAdapterResources).deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network); + + networkAdapterDeleteTasks.deleteNetwork(execution); + + verify(networkAdapterResources, times(1)).deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network); + assertEquals(deleteNetworkResponse, execution.getVariable("deleteNetworkResponse")); + } + + @Test + public void test_deleteNetwork_exception() { + expectedException.expect(BpmnError.class); + + networkAdapterDeleteTasks.deleteNetwork(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java new file mode 100644 index 0000000000..6489c9b149 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterUpdateTasksTest.java @@ -0,0 +1,101 @@ +/*- + * ============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.adapter.network.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Map; +import java.util.Optional; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkAdapterUpdateTasksTest extends BaseTaskTest{ + @Autowired + private NetworkAdapterUpdateTasks networkAdapterUpdateTasks; + + private ServiceInstance serviceInstance; + private L3Network network; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Map<String, String> userInput; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + requestContext = setRequestContext(); + cloudRegion = setCloudRegion(); + orchestrationContext = setOrchestrationContext(); + userInput = setUserInput(); + userInput.put("userInputKey1", "userInputValue1"); + + } + + @Test + public void updateNetworkTest() throws Exception { + UpdateNetworkResponse updateNetworkResponse = new UpdateNetworkResponse(); + updateNetworkResponse.setMessageId("messageId"); + updateNetworkResponse.setNetworkId("networkId"); + Optional<UpdateNetworkResponse> oUpdateNetworkResponse = Optional.of(updateNetworkResponse); + + doReturn(oUpdateNetworkResponse).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + + networkAdapterUpdateTasks.updateNetwork(execution); + + verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + assertEquals(updateNetworkResponse, execution.getVariable("NetworkAdapterUpdateNetworkResponse")); + } + + @Test + public void updateNetworkNoResponseTest() throws Exception { + doReturn(Optional.empty()).when(networkAdapterResources).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + + networkAdapterUpdateTasks.updateNetwork(execution); + + verify(networkAdapterResources, times(1)).updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, customer); + assertNull(execution.getVariable("NetworkAdapterUpdateNetworkResponse")); + } + + @Test + public void updateNetworkExceptionTest() { + expectedException.expect(BpmnError.class); + + networkAdapterUpdateTasks.updateNetwork(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java new file mode 100644 index 0000000000..f54e3faf1d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasksTest.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.adapter.vnf.tasks; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +public class VnfAdapterCreateTasksTest extends BaseTaskTest{ + @Autowired + private VnfAdapterCreateTasks vnfAdapterCreateTasks; + + @Test + public void test_createVolumeGroupRequest() throws Exception { + RequestContext requestContext = setRequestContext(); + + ServiceInstance serviceInstance = setServiceInstance(); + + GenericVnf genericVnf = setGenericVnf(); + + VfModule vfModule = setVfModule(); + vfModule.setSelflink("vfModuleSelfLink"); + VolumeGroup volumeGroup = setVolumeGroup(); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + String sdncVnfQueryResponse = "SDNCVnfQueryResponse"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVnfQueryResponse); + + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setVolumeGroupId("volumeGroupStackId"); + + doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse); + + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + + verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVnfQueryResponse); + + assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request")); + } + + @Test + public void test_createVolumeGroupRequest_for_alaCarte_flow() throws Exception { + RequestContext requestContext = setRequestContext(); + ServiceInstance serviceInstance = setServiceInstance(); + GenericVnf genericVnf = setGenericVnf(); + VolumeGroup volumeGroup = setVolumeGroup(); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setVolumeGroupId("volumeGroupStackId"); + + doReturn(request).when(vnfAdapterVolumeGroupResources).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null); + + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + + verify(vnfAdapterVolumeGroupResources, times(1)).createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null); + + assertEquals(request.toXmlString(), execution.getVariable("VNFREST_Request")); + } + + @Test + public void test_createVolumeGroupRequest_exception() throws Exception { + // run with no data setup, and it will throw a BBObjectNotFoundException + expectedException.expect(BpmnError.class); + + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + } + + @Test + public void test_createVfModule() throws Exception { + RequestContext requestContext = setRequestContext(); + + ServiceInstance serviceInstance = setServiceInstance(); + + GenericVnf genericVnf = setGenericVnf(); + + VfModule vfModule = setVfModule(); + + CloudRegion cloudRegion = setCloudRegion(); + + OrchestrationContext orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVfModuleRequest modRequest = new CreateVfModuleRequest(); + modRequest.setVfModuleId(vfModule.getVfModuleId()); + modRequest.setBaseVfModuleStackId("baseVfModuleStackId"); + modRequest.setVfModuleName(vfModule.getVfModuleName()); + CreateVfModuleRequest createVfModuleRequest = modRequest; + + String sdncVfModuleQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncVfModuleQueryResponse); + + String sdncVnfQueryResponse = "{someJson}"; + execution.setVariable("SDNCQueryResponse_" + genericVnf.getVnfId(), sdncVnfQueryResponse); + + doReturn(createVfModuleRequest).when(vnfAdapterVfModuleResources).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + vnfAdapterCreateTasks.createVfModule(execution); + + verify(vnfAdapterVfModuleResources, times(1)).createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertEquals(execution.getVariable("VNFREST_Request"), createVfModuleRequest.toXmlString()); + } + + @Test + public void createVfModuleExceptionTest() throws Exception { + // run with no data setup, and it will throw a BBObjectNotFoundException + expectedException.expect(BpmnError.class); + vnfAdapterCreateTasks.createVolumeGroupRequest(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java new file mode 100644 index 0000000000..4ea11c235b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.adapter.vnf.tasks; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class VnfAdapterDeleteTasksTest extends BaseTaskTest{ + @Autowired + private VnfAdapterDeleteTasks vnfAdapterDeleteTasks; + + private VolumeGroup volumeGroup; + private VfModule vfModule; + private GenericVnf genericVnf; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private ServiceInstance serviceInstance; + private OrchestrationContext orchestrationContext; + + @Before + public void before() throws Exception { + requestContext = setRequestContext(); + + serviceInstance = setServiceInstance(); + + cloudRegion = setCloudRegion(); + + genericVnf = setGenericVnf(); + + vfModule = setVfModule(); + + volumeGroup = setVolumeGroup(); + + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void test_deleteVfModule() throws Exception { + DeleteVfModuleRequest deleteVfModuleRequest = new DeleteVfModuleRequest(); + deleteVfModuleRequest.setVfModuleId("vfModuleId"); + + doReturn(deleteVfModuleRequest).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + + vnfAdapterDeleteTasks.deleteVfModule(execution); + + verify(vnfAdapterVfModuleResources, times(1)).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + assertEquals(execution.getVariable("VNFREST_Request"), deleteVfModuleRequest.toXmlString()); + } + + @Test + public void deleteVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(vnfAdapterVfModuleResources).deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + + vnfAdapterDeleteTasks.deleteVfModule(execution); + } + + @Test + public void test_deleteVolumeGroup() throws Exception { + DeleteVolumeGroupResponse deleteVolumeGroupResponse = new DeleteVolumeGroupResponse(); + + doReturn(deleteVolumeGroupResponse).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + + vnfAdapterDeleteTasks.deleteVolumeGroup(execution); + + verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + } + + @Test + public void deleteVolumeGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + + vnfAdapterDeleteTasks.deleteVolumeGroup(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java new file mode 100644 index 0000000000..24a99c97f4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java @@ -0,0 +1,169 @@ +/*- + * ============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.adapter.vnf.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.FileUtil; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class VnfAdapterImplTest extends BaseTaskTest { + @Autowired + private VnfAdapterImpl vnfAdapterImpl; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private VfModule vfModule; + private VolumeGroup volumeGroup; + + private static final String VNF_ADAPTER_REST_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestDeleteResponse.xml"); + private static final String VNF_ADAPTER_REST_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"); + private static final String VNF_ADAPTER_VOLUME_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml"); + private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn"; + private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1"; + + @Before + public void before() { + requestContext = setRequestContext(); + serviceInstance = setServiceInstance(); + vfModule = setVfModule(); + volumeGroup = setVolumeGroup(); + vfModule.setHeatStackId(null); + } + + @Test + public void preProcessVnfAdapterTest() { + vnfAdapterImpl.preProcessVnfAdapter(execution); + + assertEquals("true", execution.getVariable("isDebugLogEnabled")); + assertEquals(requestContext.getMsoRequestId(), execution.getVariable("mso-request-id")); + assertEquals(serviceInstance.getServiceInstanceId(), execution.getVariable("mso-service-instance-id")); + } + + @Test + public void postProcessVnfAdapter_CreateResponseTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId()); + } + + + @Test + public void postProcessVnfAdapter_CreateResponseTest_EmptyCreateVfModuleResponseTag() { + expectedException.expect(BpmnError.class); + execution.setVariable("vnfAdapterRestV1Response", "<vfModuleStackId></vfModuleStackId>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapter_CreateResponseTest_EmptyVfModuleStackIdTag() { + execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse></createVfModuleResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_CreateResponseTest_EmptyHeatStackId() { + execution.setVariable("vnfAdapterRestV1Response", "<createVfModuleResponse><vfModuleStackId></vfModuleStackId></createVfModuleResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_ResponseNullTest() { + execution.setVariable("vnfAdapterRestV1Response", null); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_ResponseEmptyTest() { + execution.setVariable("vnfAdapterRestV1Response", ""); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() { + execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVfModuleResponseTag() { + expectedException.expect(BpmnError.class); + execution.setVariable("vnfAdapterRestV1Response", "<vfModuleDeleted></vfModuleDeleted>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() { + execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertNull(vfModule.getHeatStackId()); + } + + @Test + public void preProcessVnfAdapterExceptionTest() { + expectedException.expect(BpmnError.class); + lookupKeyMap.clear(); + vnfAdapterImpl.preProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapter_CreateVolumeResponseTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_CREATE_RESPONSE); + vnfAdapterImpl.postProcessVnfAdapter(execution); + assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId()); + } + + @Test + public void postProcessVnfAdapter_CreateVolumeEmptyResponseTest() { + expectedException.expect(BpmnError.class); + execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>"); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } + + @Test + public void postProcessVnfAdapterExceptionTest() { + execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE); + expectedException.expect(BpmnError.class); + lookupKeyMap.clear(); + vnfAdapterImpl.postProcessVnfAdapter(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java new file mode 100644 index 0000000000..dff953802e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkBBUtilsTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; + +public class AssignNetworkBBUtilsTest extends BaseTaskTest { + //Necessary because AssignNetworkBBUtils is already mocked using MockBean in the base class for use in other tests + private AssignNetworkBBUtils nonMockAssignNetworkBBUtils = new AssignNetworkBBUtils(); + + private CloudRegion cloudRegion; + + @Before + public void before() { + cloudRegion = setCloudRegion(); + } + + @Test + public void getCloudRegionTest25() throws Exception { + cloudRegion.setCloudRegionVersion("2.5"); + + nonMockAssignNetworkBBUtils.getCloudRegion(execution); + + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionPo")); + assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc")); + } + + @Test + public void getCloudRegionTest30() throws Exception { + cloudRegion.setCloudRegionVersion("3.0"); + + nonMockAssignNetworkBBUtils.getCloudRegion(execution); + + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionPo")); + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java new file mode 100644 index 0000000000..a206140014 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class AssignNetworkTest extends BaseTaskTest { + + @Autowired + private AssignNetwork assignNetwork; + + private ServiceInstance serviceInstance; + private L3Network network; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + network = setL3Network(); + } + + @Test + public void hasCollectionTest() throws Exception { + setServiceInstance(); + //collection present by default base test setup + boolean hasCollection = assignNetwork.hasCollection(execution); + assertEquals(true, hasCollection); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(false, skip); + } + + @Test + public void hasNoCollectionTest() throws Exception { + //clear collection + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + serviceInstance.setCollection(null); + boolean hasCollection = assignNetwork.hasCollection(execution); + assertEquals(false, hasCollection); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(true, skip); + } + + @Test + public void hasNoCollectionNoNetworkTest() throws Exception { + //clear collection and updated network status to PRECREATED - when it was NOT found by name + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + serviceInstance.setCollection(null); + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + boolean hasCollection = assignNetwork.hasCollection(execution); + boolean networkFound = assignNetwork.networkFoundByName(execution); + assertEquals(false, hasCollection); + assertEquals(false, networkFound); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(true, skip); + } + + @Test + public void hasNetworkNoCollectionTest() throws Exception { + //clear collection and updated network status to INVENTORIED - when it was found by name + try { + serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID)); + network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + } catch(BBObjectNotFoundException e) { + serviceInstance = setServiceInstance(); + } + serviceInstance.setCollection(null); + network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + boolean hasCollection = assignNetwork.hasCollection(execution); + boolean networkFound = assignNetwork.networkFoundByName(execution); + assertEquals(false, hasCollection); + assertEquals(true, networkFound); + + boolean skip = assignNetwork.skipNetworkCreationInAAI(execution); + assertEquals(true, skip); + } + +} 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 new file mode 100644 index 0000000000..e1b652a140 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignVnfTest.java @@ -0,0 +1,110 @@ +/*- + * ============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.flowspecific.tasks; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +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.springframework.beans.factory.annotation.Autowired; + +public class AssignVnfTest extends BaseTaskTest { + @Autowired + private AssignVnf assignVnf; + + private InstanceGroup instanceGroup1; + private InstanceGroup instanceGroup2; + private InstanceGroup instanceGroup3; + private InstanceGroup instanceGroup4; + private GenericVnf genericVnf; + + @Before + public void before() { + ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup(); + modelVnfc.setType("VNFC"); + modelVnfc.setFunction("function"); + + ModelInfoInstanceGroup modelNetworkInstanceGroup = new ModelInfoInstanceGroup(); + modelNetworkInstanceGroup.setType("networkInstanceGroup"); + modelNetworkInstanceGroup.setFunction("function"); + + instanceGroup1 = new InstanceGroup(); + instanceGroup1.setId("test-001"); + instanceGroup1.setModelInfoInstanceGroup(modelVnfc); + + instanceGroup2 = new InstanceGroup(); + instanceGroup2.setId("test-002"); + instanceGroup2.setModelInfoInstanceGroup(modelVnfc); + + instanceGroup3 = new InstanceGroup(); + instanceGroup3.setId("test-003"); + instanceGroup3.setModelInfoInstanceGroup(modelNetworkInstanceGroup); + + instanceGroup4 = new InstanceGroup(); + instanceGroup4.setId("test-004"); + instanceGroup4.setModelInfoInstanceGroup(modelNetworkInstanceGroup); + + genericVnf = setGenericVnf(); + genericVnf.setVnfName("vnfName"); + } + + @Test + public void createInstanceGroupsSunnyDayTest() throws Exception { + + List<InstanceGroup> instanceGroupList = genericVnf.getInstanceGroups(); + instanceGroupList.add(instanceGroup1); + instanceGroupList.add(instanceGroup2); + instanceGroupList.add(instanceGroup3); + instanceGroupList.add(instanceGroup4); + + 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); + } + + @Test + public void createVnfcInstanceGroupNoneTest() throws Exception { + assignVnf.createInstanceGroups(execution); + verify(aaiInstanceGroupResources, times(0)).createInstanceGroup(any(InstanceGroup.class)); + verify(aaiInstanceGroupResources, times(0)).connectInstanceGroupToVnf(any(InstanceGroup.class), any(GenericVnf.class)); + } + + @Test + public void createVnfcInstanceGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + genericVnf.setVnfId("test-999"); + assignVnf.createInstanceGroups(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java new file mode 100644 index 0000000000..cde7797ed0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollectionTest.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.flowspecific.tasks; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.springframework.beans.factory.annotation.Autowired; + +public class CreateNetworkCollectionTest extends BaseTaskTest{ + @Autowired + private CreateNetworkCollection createNetworkCollection; + + private L3Network network; + private ServiceInstance serviceInstance; + private OrchestrationContext orchestrationContext; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + network = setL3Network(); + + List<L3Network> l3NetworkList = new ArrayList<L3Network>(); + l3NetworkList.add(network); + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + modelInfoInstanceGroup.setFunction("function"); + serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup); + + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void buildCreateNetworkRequestTest() throws Exception { + createNetworkCollection.buildNetworkCollectionName(execution); + + assertEquals(serviceInstance.getServiceInstanceName() + "_" + serviceInstance.getCollection().getInstanceGroup().getModelInfoInstanceGroup().getFunction(), execution.getVariable("networkCollectionName")); + } + + @Test(expected = BpmnError.class) + public void buildCreateNetworkRequestInstanceGroupModelInfoFunctionNullExceptionTest() throws Exception { + ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup(); + serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(modelInfoInstanceGroup); + createNetworkCollection.buildNetworkCollectionName(execution); + } + + @Test(expected = BpmnError.class) + public void buildCreateNetworkRequestInstanceGroupModelInfoNullTest() throws Exception { + serviceInstance.getCollection().getInstanceGroup().setModelInfoInstanceGroup(null); + createNetworkCollection.buildNetworkCollectionName(execution); + } + + @Test + public void connectCollectionToInstanceGroupTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkCollectionInstanceGroupToNetworkCollection(serviceInstance.getCollection().getInstanceGroup(), serviceInstance.getCollection()); + createNetworkCollection.connectCollectionToInstanceGroup(execution); + verify(aaiNetworkResources, times(1)).connectNetworkCollectionInstanceGroupToNetworkCollection(serviceInstance.getCollection().getInstanceGroup(), serviceInstance.getCollection()); + } + + @Test + public void connectCollectionToServiceInstanceTest() throws Exception { + doNothing().when(aaiNetworkResources).connectNetworkCollectionToServiceInstance(serviceInstance.getCollection(), serviceInstance); + createNetworkCollection.connectCollectionToServiceInstance(execution); + verify(aaiNetworkResources, times(1)).connectNetworkCollectionToServiceInstance(serviceInstance.getCollection(), serviceInstance); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java new file mode 100644 index 0000000000..f23df3312f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkTest.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.flowspecific.tasks; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.springframework.beans.factory.annotation.Autowired; + +public class CreateNetworkTest extends BaseTaskTest{ + @Autowired + private CreateNetwork createNetwork; + + private L3Network network; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Map<String, String> userInput; + private RequestContext requestContext; + private String cloudRegionPo = "testCloudRegionPo"; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + cloudRegion = setCloudRegion(); + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + requestContext = setRequestContext(); + userInput = setUserInput(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + } + + @Test + public void buildCreateNetworkRequestTest() throws Exception { + execution.setVariable("cloudRegionPo", cloudRegionPo); + + CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest(); + + doReturn(expectedCreateNetworkRequest).when(networkAdapterObjectMapper).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, cloudRegionPo, customer); + + createNetwork.buildCreateNetworkRequest(execution); + + verify(networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, network, userInput, cloudRegionPo, customer); + + assertThat(expectedCreateNetworkRequest, sameBeanAs(execution.getVariable("createNetworkRequest"))); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java new file mode 100644 index 0000000000..4966a8b42d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NetworkBBUtilsTest.java @@ -0,0 +1,118 @@ +/*- + * ============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.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import org.onap.aai.domain.yang.L3Network; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.springframework.beans.factory.annotation.Autowired; + +public class NetworkBBUtilsTest extends BaseTaskTest{ + @Autowired + private NetworkBBUtils networkBBUtils; + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/"; + + private CloudRegion cloudRegion; + + @Before + public void before() { + cloudRegion = setCloudRegion(); + } + + @Test + public void isRelationshipRelatedToExistsTrueTest() throws Exception { + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + Optional<L3Network> l3network = aaiResultWrapper.asBean(L3Network.class); + + boolean isVfModule = networkBBUtils.isRelationshipRelatedToExists(l3network, "vf-module"); + assertTrue(isVfModule); + + } + + @Test + public void isRelationshipRelatedToExistsFalseTest() throws Exception { + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAAIResponse.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + Optional<L3Network> l3network = aaiResultWrapper.asBean(L3Network.class); + + boolean isVfModule = networkBBUtils.isRelationshipRelatedToExists(l3network, "vf-module"); + assertFalse(isVfModule); + + } + + @Test + public void getCloudRegionSDNC25Test() throws Exception { + cloudRegion.setCloudRegionVersion("2.5"); + + NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class); + String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.SDNC); + Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.SDNC); + + assertEquals("AAIAIC25", cloudRegionId); + } + + @Test + public void getCloudRegionSDNC30Test() throws Exception { + cloudRegion.setCloudRegionVersion("3.0"); + + NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class); + String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.SDNC); + Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.SDNC); + + assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionId); + } + + @Test + public void getCloudRegionPO25Test() throws Exception { + cloudRegion.setCloudRegionVersion("2.5"); + + NetworkBBUtils spyAssign = Mockito.spy(NetworkBBUtils.class); + String cloudRegionId = spyAssign.getCloudRegion(execution, SourceSystem.PO); + Mockito.verify(spyAssign).getCloudRegion(execution, SourceSystem.PO); + + assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionId); + } + + @Test + public void getCloudRegionPO30Test() throws Exception { + cloudRegion.setCloudRegionVersion("3.0"); + + NetworkBBUtils spyAssignPO = Mockito.spy(NetworkBBUtils.class); + String cloudRegionIdPO = spyAssignPO.getCloudRegion(execution, SourceSystem.PO); + Mockito.verify(spyAssignPO).getCloudRegion(execution, SourceSystem.PO); + + assertEquals(cloudRegion.getLcpCloudRegionId(), cloudRegionIdPO); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java new file mode 100644 index 0000000000..6a117902ea --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java @@ -0,0 +1,92 @@ +/*- + * ============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.flowspecific.tasks; + +import static org.junit.Assert.assertEquals; + +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.springframework.beans.factory.annotation.Autowired; + +public class UnassignNetworkBBTest extends BaseTaskTest { + @Autowired + private UnassignNetworkBB unassignNetworkBB; + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/Network/"; + + @Test + public void checkRelationshipRelatedToTrueTest() throws Exception { + expectedException.expect(BpmnError.class); + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper); + + unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module"); + } + + @Test + public void checkRelationshipRelatedToFalseTest() throws Exception { + final String aaiResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "unassignNetworkBB_queryAAIResponse_.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(aaiResponse); + execution.setVariable("l3NetworkAAIResultWrapper", aaiResultWrapper); + + unassignNetworkBB.checkRelationshipRelatedTo(execution, "kfc-module"); + //expected result is no exception + } + + @Test + public void getCloudSdncRegion25Test() throws Exception { + CloudRegion cloudRegion = setCloudRegion(); + cloudRegion.setCloudRegionVersion("2.5"); + unassignNetworkBB.getCloudSdncRegion(execution); + assertEquals("AAIAIC25", execution.getVariable("cloudRegionSdnc")); + } + + @Test + public void getCloudSdncRegion30Test() throws Exception { + CloudRegion cloudRegion = setCloudRegion(); + cloudRegion.setCloudRegionVersion("3.0"); + gBBInput.setCloudRegion(cloudRegion); + unassignNetworkBB.getCloudSdncRegion(execution); + assertEquals(cloudRegion.getLcpCloudRegionId(), execution.getVariable("cloudRegionSdnc")); + } + + @Test + public void errorEncounteredTest_rollback() throws Exception { + expectedException.expect(BpmnError.class); + execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first."); + execution.setVariable("isRollbackNeeded", true); + unassignNetworkBB.errorEncountered(execution); + } + + @Test + public void errorEncounteredTest_noRollback() throws Exception { + expectedException.expect(BpmnError.class); + execution.setVariable("ErrorUnassignNetworkBB", "Relationship's RelatedTo still exists in AAI, remove the relationship vf-module first."); + unassignNetworkBB.errorEncountered(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java new file mode 100644 index 0000000000..98c1f185fe --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnfTest.java @@ -0,0 +1,67 @@ +/*- + * ============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.flowspecific.tasks; + +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +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.springframework.beans.factory.annotation.Autowired; + +public class UnassignVnfTest extends BaseTaskTest{ + @Autowired + private UnassignVnf unassignVnf; + + @Test + public void deleteInstanceGroupsSunnyDayTest() throws Exception { + GenericVnf genericVnf = setGenericVnf(); + + ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup(); + modelVnfc.setType("VNFC"); + + InstanceGroup instanceGroup1 = new InstanceGroup(); + instanceGroup1.setId("test-001"); + instanceGroup1.setModelInfoInstanceGroup(modelVnfc); + genericVnf.getInstanceGroups().add(instanceGroup1); + + InstanceGroup instanceGroup2 = new InstanceGroup(); + instanceGroup2.setId("test-002"); + instanceGroup2.setModelInfoInstanceGroup(modelVnfc); + genericVnf.getInstanceGroups().add(instanceGroup2); + + unassignVnf.deleteInstanceGroups(execution); + verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup1)); + verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup2)); + } + + @Test + public void deletecreateVnfcInstanceGroupExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + unassignVnf.deleteInstanceGroups(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java new file mode 100644 index 0000000000..d3b421eedb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTaskTest.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.sdnc.tasks; + +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +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.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + + +public class SDNCActivateTaskTest extends BaseTaskTest{ + @Autowired + private SDNCActivateTasks sdncActivateTasks; + + private L3Network network; + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private GenericVnf genericVnf; + private VfModule vfModule; + private Customer customer; + + @Before + public void before() { + serviceInstance = setServiceInstance(); + network = setL3Network(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + customer = setCustomer(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + + } + + @Test + public void activateVnfTest() throws Exception { + doReturn("success").when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer, cloudRegion,requestContext); + sdncActivateTasks.activateVnf(execution); + verify(sdncVnfResources, times(1)).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext); + } + + @Test + public void activateVnfTestException() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVnfResources).activateVnf(genericVnf,serviceInstance, customer,cloudRegion,requestContext); + sdncActivateTasks.activateVnf(execution); + } + + @Test + public void activateNetworkTest() throws Exception { + doReturn("response").when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); + sdncActivateTasks.activateNetwork(execution); + verify(sdncNetworkResources, times(1)).activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + } + + @Test + public void activateNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncNetworkResources).activateNetwork(isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); + sdncActivateTasks.activateNetwork(execution); + } + + @Test + public void activateVfModuleTest() throws Exception { + doReturn("success").when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncActivateTasks.activateVfModule(execution); + + verify(sdncVfModuleResources, times(1)).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + } + + @Test + public void activateVfModuleTestException() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).activateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncActivateTasks.activateVfModule(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java new file mode 100644 index 0000000000..6a40db3eaa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasksTest.java @@ -0,0 +1,144 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.sdnc.tasks; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +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.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + + +public class SDNCAssignTasksTest extends BaseTaskTest{ + @Autowired + private SDNCAssignTasks sdncAssignTasks; + + private L3Network network; + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private GenericVnf genericVnf; + private VfModule vfModule; + private VolumeGroup volumeGroup; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + network = setL3Network(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + volumeGroup = setVolumeGroup(); + + } + + @Test + public void assignServiceInstanceTest() throws Exception { + doReturn("response").when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); + + sdncAssignTasks.assignServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).assignServiceInstance(serviceInstance, customer, requestContext); + assertTrue(execution.getVariable("SDNCResponse").equals("response")); + } + + @Test + public void assignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncServiceInstanceResources).assignServiceInstance(serviceInstance, customer, requestContext); + + sdncAssignTasks.assignServiceInstance(execution); + } + + @Test + public void assignVnfTest() throws Exception { + doReturn("response").when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + + sdncAssignTasks.assignVnf(execution); + + verify(sdncVnfResources, times(1)).assignVnf(genericVnf, serviceInstance,customer, cloudRegion, requestContext, false); + assertTrue(execution.getVariable("SDNCResponse").equals("response")); + } + + @Test + public void assignVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVnfResources).assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + + sdncAssignTasks.assignVnf(execution); + } + + @Test + public void assignVfModuleTest() throws Exception { + doReturn("response").when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncAssignTasks.assignVfModule(execution); + + verify(sdncVfModuleResources, times(1)).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertTrue(execution.getVariable("SDNCAssignResponse_" + vfModule.getVfModuleId()).equals("response")); + } + + @Test + public void assignVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).assignVfModule(vfModule, volumeGroup, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncAssignTasks.assignVfModule(execution); + } + + @Test + public void assignNetworkTest() throws Exception { + doReturn("response").when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + sdncAssignTasks.assignNetwork(execution); + + verify(sdncNetworkResources, times(1)).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + } + + @Test + public void assignNetworkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncNetworkResources).assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + sdncAssignTasks.assignNetwork(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java new file mode 100644 index 0000000000..fc2d182b52 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCChangeAssignTasksTest.java @@ -0,0 +1,100 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +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; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCChangeAssignTasksTest extends BaseTaskTest{ + @Autowired + private SDNCChangeAssignTasks sdncChangeAssignTasks; + + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private CloudRegion cloudRegion; + private VfModule vfModule; + private GenericVnf genericVnf; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + + } + + @Test + public void changeModelVnfTest() throws Exception { + String response = "sdncChangeModelServiceInstance"; + + doReturn(response).when(sdncServiceInstanceResources).changeModelServiceInstance(serviceInstance, customer, requestContext); + + sdncChangeAssignTasks.changeModelServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).changeModelServiceInstance(serviceInstance, customer, requestContext); + + assertEquals(response, execution.getVariable("SDNCChangeAssignTasks.changeModelServiceInstance.response")); + } + + @Test + public void changeModelVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(sdncVnfResources).changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncChangeAssignTasks.changeModelVnf(execution); + } + + @Test + public void changeAssignModelVfModuleTest() throws Exception { + String response = "response"; + doReturn(response).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncChangeAssignTasks.changeAssignModelVfModule(execution); + + verify(sdncVfModuleResources, times(1)).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertTrue(execution.getVariable("SDNCChangeAssignVfModuleResponse").equals(response)); + } + + @Test + public void changeAssignModelVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(sdncVfModuleResources).changeAssignVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncChangeAssignTasks.changeAssignModelVfModule(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java new file mode 100644 index 0000000000..ed281ce317 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTaskTest.java @@ -0,0 +1,154 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +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.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCDeactivateTaskTest extends BaseTaskTest { + @Autowired + private SDNCDeactivateTasks sdncDeactivateTasks; + + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private RequestContext requestContext; + private GenericVnf genericVnf; + private VfModule vfModule; + private L3Network network; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + cloudRegion = setCloudRegion(); + requestContext = setRequestContext(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + network = setL3Network(); + + } + + @Test + public void deactivateVfModuleTest() throws Exception { + doReturn("success").when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncDeactivateTasks.deactivateVfModule(execution); + + verify(sdncVfModuleResources, times(1)).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + } + + @Test + public void deactivateVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).deactivateVfModule(vfModule, genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncDeactivateTasks.deactivateVfModule(execution); + } + + @Test + public void deactivateVnfTest() throws Exception { + doReturn("success").when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncDeactivateTasks.deactivateVnf(execution); + + verify(sdncVnfResources, times(1)).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + } + + @Test + public void deactivateVnfExceptionTest() throws Exception { + doThrow(Exception.class).when(sdncVnfResources).deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + expectedException.expect(BpmnError.class); + sdncDeactivateTasks.deactivateVnf(execution); + } + + @Test + public void deactivateServiceInstanceTest() throws Exception { + doReturn("response").when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext); + + sdncDeactivateTasks.deactivateServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).deactivateServiceInstance(serviceInstance, customer, requestContext); + assertEquals("response", execution.getVariable("deactivateServiceInstanceSDNCResponse")); + assertTrue(execution.getVariable("sdncServiceInstanceRollback")); + } + + @Test + public void deactivateServiceInstanceExceptionTest() throws Exception { + doThrow(Exception.class).when(sdncServiceInstanceResources).deactivateServiceInstance(serviceInstance, customer, requestContext); + expectedException.expect(BpmnError.class); + sdncDeactivateTasks.deactivateServiceInstance(execution); + } + + @Test + public void test_deactivateNetwork() throws Exception { + String expectedResponse = "return"; + + doReturn(expectedResponse).when(sdncNetworkResources).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + sdncDeactivateTasks.deactivateNetwork(execution); + + verify(sdncNetworkResources, times(1)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + assertEquals(expectedResponse, execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response")); + + assertTrue(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback")); + } + + @Test + public void test_deactivateNetwork_exception() throws Exception { + expectedException.expect(BpmnError.class); + + try { + lookupKeyMap.remove(ResourceKey.NETWORK_ID); + + sdncDeactivateTasks.deactivateNetwork(execution); + } finally { + verify(sdncNetworkResources, times(0)).deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + assertNull(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.response")); + + assertFalse(execution.getVariable("SDNCDeactivateTasks.deactivateNetwork.rollback")); + } + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java new file mode 100644 index 0000000000..b98ab71d1d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java @@ -0,0 +1,121 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCQueryTasksTest extends BaseTaskTest{ + @Autowired + private SDNCQueryTasks sdncQueryTasks; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + private GenericVnf genericVnf; + private VfModule vfModule; + + @Before + public void before() { + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + } + + @Test + public void queryVfModuleTest() throws Exception { + String sdncQueryResponse = "response"; + vfModule.setSelflink("vfModuleSelfLink"); + + doReturn(sdncQueryResponse).when(sdncVfModuleResources).queryVfModule(vfModule); + + assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + sdncQueryTasks.queryVfModule(execution); + assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + + verify(sdncVfModuleResources, times(1)).queryVfModule(vfModule); + } + + @Test + public void queryVnfTest() throws Exception { + String sdncQueryResponse = "response"; + + doReturn(sdncQueryResponse).when(sdncVnfResources).queryVnf(genericVnf); + + assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId())); + sdncQueryTasks.queryVnf(execution); + assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId())); + + verify(sdncVnfResources, times(1)).queryVnf(genericVnf); + } + + @Test + public void queryVfModuleForVolumeGroupTest() throws Exception { + String sdncQueryResponse = "response"; + vfModule.setSelflink("vfModuleSelfLink"); + + doReturn(sdncQueryResponse).when(sdncVfModuleResources).queryVfModule(vfModule); + + assertNotEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + assertEquals(sdncQueryResponse, execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId())); + + verify(sdncVfModuleResources, times(1)).queryVfModule(vfModule); + } + + @Test + public void queryVfModuleForVolumeGroupNoSelfLinkExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + vfModule.setSelflink(""); + + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + } + + @Test + public void queryVfModuleForVolumeGroupVfObjectExceptionTest() throws Exception { + gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0).getVnfs().get(0).getVfModules().clear(); + + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + + verify(sdncVfModuleResources, times(0)).queryVfModule(any(VfModule.class)); + } + + @Test + public void queryVfModuleForVolumeGroupNonVfObjectExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + sdncQueryTasks.queryVfModuleForVolumeGroup(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java new file mode 100644 index 0000000000..14243c5909 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasksTest.java @@ -0,0 +1,202 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.sdnc.tasks; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +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.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.springframework.beans.factory.annotation.Autowired; + +public class SDNCUnassignTasksTest extends BaseTaskTest{ + @Autowired + private SDNCUnassignTasks sdncUnassignTasks; + + private ServiceInstance serviceInstance; + private RequestContext requestContext; + private GenericVnf genericVnf; + private VfModule vfModule; + private CloudRegion cloudRegion; + private L3Network network; + private Customer customer; + + @Before + public void before() { + customer = setCustomer(); + serviceInstance = setServiceInstance(); + requestContext = setRequestContext(); + genericVnf = setGenericVnf(); + vfModule = setVfModule(); + cloudRegion = setCloudRegion(); + network = setL3Network(); + + } + + @Test + public void unassignServiceInstanceTest() throws Exception { + doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); + + sdncUnassignTasks.unassignServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(1)).unassignServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void unassignServiceInstanceTest_inventoried() throws Exception { + doReturn("test").when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); + + serviceInstance.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignServiceInstance(execution); + + verify(sdncServiceInstanceResources, times(0)).unassignServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void unassignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncServiceInstanceResources).unassignServiceInstance(serviceInstance, customer, requestContext); + + sdncUnassignTasks.unassignServiceInstance(execution); + } + + @Test + public void unassignVfModuleTest() throws Exception { + doReturn("response").when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance); + + sdncUnassignTasks.unassignVfModule(execution); + + verify(sdncVfModuleResources, times(1)).unassignVfModule(vfModule, genericVnf, serviceInstance); + assertEquals("response", execution.getVariable("SDNCResponse")); + } + + @Test + public void unassignVfModuleTest_inventoried() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignVfModule(execution); + + verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance); + assertNull(execution.getVariable("SDNCResponse")); + } + + @Test + public void unassignVfModuleTest_pendingCreate() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_CREATE); + + sdncUnassignTasks.unassignVfModule(execution); + + verify(sdncVfModuleResources, times(0)).unassignVfModule(vfModule, genericVnf, serviceInstance); + assertNull(execution.getVariable("SDNCResponse")); + } + + @Test + public void unassignVfModuleExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doThrow(Exception.class).when(sdncVfModuleResources).unassignVfModule(vfModule, genericVnf, serviceInstance); + + sdncUnassignTasks.unassignVfModule(execution); + } + + @Test + public void unassignVnfTest() throws Exception { + doReturn("response").when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + sdncUnassignTasks.unassignVnf(execution); + + verify(sdncVnfResources, times(1)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertTrue(execution.getVariable("sdncUnassignVnfResponse").equals("response")); + } + + @Test + public void unassignVnfTest_inventoried() throws Exception { + genericVnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignVnf(execution); + + verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertNull(execution.getVariable("sdncUnassignVnfResponse")); + } + + @Test + public void unassignVnfTest_created() throws Exception { + genericVnf.setOrchestrationStatus(OrchestrationStatus.CREATED); + + sdncUnassignTasks.unassignVnf(execution); + + verify(sdncVnfResources, times(0)).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + assertNull(execution.getVariable("sdncUnassignVnfResponse")); + } + + @Test + public void unassignVnfExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + doThrow(Exception.class).when(sdncVnfResources).unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + sdncUnassignTasks.unassignVnf(execution); + } + + @Test + public void unassignNetworkTest() throws Exception { + String cloudRegionSdnc = "AAIAIC25"; + + cloudRegion.setCloudRegionVersion("2.5"); + + execution.setVariable("cloudRegionSdnc", cloudRegionSdnc); + + doReturn("response").when(sdncNetworkResources).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + assertNotEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId()); + sdncUnassignTasks.unassignNetwork(execution); + + verify(sdncNetworkResources, times(1)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + assertEquals("response", execution.getVariable("SDNCUnAssignNetworkResponse")); + assertEquals(cloudRegionSdnc, cloudRegion.getLcpCloudRegionId()); + } + + @Test + public void unassignNetworkTest_inventoried() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + sdncUnassignTasks.unassignNetwork(execution); + + verify(sdncNetworkResources, times(0)).unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + assertNull(execution.getVariable("SDNCUnAssignNetworkResponse")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java new file mode 100644 index 0000000000..b0b07d8cd7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java @@ -0,0 +1,182 @@ +/*- + * ============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.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.db.catalog.beans.BuildingBlockDetail; +import org.onap.so.db.catalog.beans.OrchestrationAction; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective; +import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective; +import org.onap.so.db.catalog.beans.ResourceType; +import org.springframework.beans.factory.annotation.Autowired; + +public class OrchestrationStatusValidatorTest extends BaseTaskTest { + @Autowired + protected OrchestrationStatusValidator orchestrationStatusValidator; + + @Test + public void test_validateOrchestrationStatus() throws Exception { + String flowToBeCalled = "AssignServiceInstanceBB"; + setServiceInstance().setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.SERVICE); + buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + + assertEquals(OrchestrationStatusValidationDirective.CONTINUE, execution.getVariable("orchestrationStatusValidationResult")); + } + + @Test + public void test_validateOrchestrationStatusConfiguration() throws Exception { + lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId"); + String flowToBeCalled = "UnassignFabricConfigurationBB"; + ServiceInstance si = setServiceInstance(); + List<Configuration> configurations = new ArrayList<>(); + Configuration config = new Configuration(); + + si.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + config.setConfigurationId("configurationId"); + config.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + configurations.add(config); + si.setConfigurations(configurations); + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("UnassignFabricConfigurationBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.CONFIGURATION); + buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.CONFIGURATION); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.UNASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.CONFIGURATION, OrchestrationStatus.PRECREATED, OrchestrationAction.UNASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + + assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS, execution.getVariable("orchestrationStatusValidationResult")); + } + + @Test + public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception { + expectedException.expect(BpmnError.class); + + String flowToBeCalled = "AssignServiceInstanceBB"; + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + doReturn(null).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + } + + @Test + public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception { + expectedException.expect(BpmnError.class); + + String flowToBeCalled = "AssignServiceInstanceBB"; + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.SERVICE); + buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + } + + @Test + public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception { + expectedException.expect(BpmnError.class); + + String flowToBeCalled = "AssignServiceInstanceBB"; + + execution.setVariable("flowToBeCalled", flowToBeCalled); + + BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail(); + buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB"); + buildingBlockDetail.setId(1); + buildingBlockDetail.setResourceType(ResourceType.SERVICE); + buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled); + + OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective = new OrchestrationStatusStateTransitionDirective(); + orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL); + orchestrationStatusStateTransitionDirective.setId(1); + orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE); + orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN); + + doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient).getOrchestrationStatusStateTransitionDirective(ResourceType.NETWORK, OrchestrationStatus.PRECREATED, OrchestrationAction.ASSIGN); + + orchestrationStatusValidator.validateOrchestrationStatus(execution); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java new file mode 100644 index 0000000000..d856b5e184 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java @@ -0,0 +1,188 @@ +/*- + * ============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.junit.Assert.assertEquals; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.List; + +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.springframework.beans.factory.annotation.Autowired; + +public class WorkflowActionBBTasksTest extends BaseTaskTest { + + @Autowired + protected WorkflowAction workflowAction; + + @Autowired + protected WorkflowActionBBTasks workflowActionBBTasks; + + private DelegateExecution execution; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance(); + servInstance.setServiceInstanceId("TEST"); + when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance); + workflowAction.setBbInputSetupUtils(bbSetupUtils); + workflowAction.setBbInputSetup(bbInputSetup); + } + + @Test + public void selectBBTest() throws Exception{ + String gAction = "Delete-Network-Collection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + execution.setVariable("gCurrentSequence", 0); + execution.setVariable("homing", false); + execution.setVariable("calledHoming", false); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + flowsToExecute.add(ebb); + execution.setVariable("flowsToExecute", flowsToExecute); + workflowActionBBTasks.selectBB(execution); + boolean success = (boolean) execution.getVariable("completed"); + assertEquals(true,success); + } + + @Test + public void select2BBTest() throws Exception{ + String gAction = "Delete-Network-Collection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + execution.setVariable("gCurrentSequence", 0); + execution.setVariable("homing", false); + execution.setVariable("calledHoming", false); + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + flowsToExecute.add(ebb); + flowsToExecute.add(ebb2); + execution.setVariable("flowsToExecute", flowsToExecute); + workflowActionBBTasks.selectBB(execution); + boolean success = (boolean) execution.getVariable("completed"); + assertEquals(false,success); + } + + @Test + public void msoCompleteProcessTest() throws Exception{ + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", "createInstance"); + execution.setVariable("resourceId", "123"); + execution.setVariable("source","MSO"); + execution.setVariable("resourceName", "Service"); + execution.setVariable("aLaCarte", true); + workflowActionBBTasks.setupCompleteMsoProcess(execution); + String response = (String) execution.getVariable("CompleteMsoProcessRequest"); + assertEquals(response,"<aetgt:MsoCompletionRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns=\"http://org.onap/so/request/types/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>MSO</source></request-info><status-message>ALaCarte-Service-createInstance request was executed correctly.</status-message><serviceInstanceId>123</serviceInstanceId><mso-bpel-name>WorkflowActionBB</mso-bpel-name></aetgt:MsoCompletionRequest>"); + } + + @Test + public void setupFalloutHandlerTest(){ + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("serviceInstanceId", "123"); + execution.setVariable("WorkflowActionErrorMessage", "Error in WorkFlowAction"); + execution.setVariable("requestAction", "createInstance"); + workflowActionBBTasks.setupFalloutHandler(execution); + assertEquals(execution.getVariable("falloutRequest"),"<aetgt:FalloutHandlerRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"xmlns:ns=\"http://org.onap/so/request/types/v1\"xmlns:wfsch=\"http://org.onap/so/workflow/schema/v1\"><request-info xmlns=\"http://org.onap/so/infra/vnf-request/v1\"><request-id>00f704ca-c5e5-4f95-a72c-6889db7b0688</request-id><action>createInstance</action><source>VID</source></request-info><aetgt:WorkflowException xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\"><aetgt:ErrorMessage>Error in WorkFlowAction</aetgt:ErrorMessage><aetgt:ErrorCode>7000</aetgt:ErrorCode></aetgt:WorkflowException></aetgt:FalloutHandlerRequest>"); + } + + @Test + public void rollbackExecutionPathTest(){ + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList(); + ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock(); + BuildingBlock bb1 = new BuildingBlock(); + bb1.setBpmnFlowName("CreateNetworkBB"); + flowsToExecute.add(ebb1); + ebb1.setBuildingBlock(bb1); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("ActivateNetworkBB"); + flowsToExecute.add(ebb2); + ebb2.setBuildingBlock(bb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("CreateVolumeGroupBB"); + flowsToExecute.add(ebb3); + ebb3.setBuildingBlock(bb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("ActivateVolumeGroupBB"); + flowsToExecute.add(ebb4); + ebb4.setBuildingBlock(bb4); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); + BuildingBlock bb5 = new BuildingBlock(); + bb5.setBpmnFlowName("CreateVfModuleBB"); + flowsToExecute.add(ebb5); + ebb5.setBuildingBlock(bb5); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); + BuildingBlock bb6 = new BuildingBlock(); + bb6.setBpmnFlowName("ActivateVfModuleBB"); + flowsToExecute.add(ebb6); + ebb6.setBuildingBlock(bb6); + ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock(); + BuildingBlock bb7 = new BuildingBlock(); + bb7.setBpmnFlowName("ActivateVnfBB"); + ebb7.setBuildingBlock(bb7); + flowsToExecute.add(ebb7); + ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock(); + BuildingBlock bb8 = new BuildingBlock(); + bb8.setBpmnFlowName("ActivateServiceInstance"); + ebb8.setBuildingBlock(bb8); + flowsToExecute.add(ebb8); + + execution.setVariable("flowsToExecute", flowsToExecute); + execution.setVariable("gCurrentSequence", 6); + + workflowActionBBTasks.rollbackExecutionPath(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeactivateVolumeGroupBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"DeleteVolumeGroupBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + } + + @Test + public void checkRetryStatusTest(){ + execution.setVariable("handlingCode","Retry"); + execution.setVariable("retryCount", 1); + execution.setVariable("gCurrentSequence",1); + workflowActionBBTasks.checkRetryStatus(execution); + assertEquals(0,execution.getVariable("gCurrentSequence")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java new file mode 100644 index 0000000000..c910ad19fa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java @@ -0,0 +1,1494 @@ +/*- + * ============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.containsString; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.anyObject; +import static org.mockito.Matchers.anyString; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.aai.domain.yang.GenericVnf; +import org.onap.aai.domain.yang.L3Network; +import org.onap.aai.domain.yang.ServiceInstance; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VfModules; +import org.onap.aai.domain.yang.VolumeGroup; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResource; +import org.onap.so.db.catalog.beans.CollectionResourceCustomization; +import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import org.onap.so.db.catalog.beans.HeatTemplate; +import org.onap.so.db.catalog.beans.InstanceGroup; +import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; +import org.onap.so.db.catalog.beans.NetworkResourceCustomization; +import org.onap.so.db.catalog.beans.Service; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import org.onap.so.serviceinstancebeans.ModelInfo; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.onap.so.serviceinstancebeans.RequestParameters; +import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; +import org.onap.so.serviceinstancebeans.SubscriberInfo; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class WorkflowActionTest extends BaseTaskTest { + @Autowired + protected WorkflowAction workflowAction; + + private DelegateExecution execution; + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Before + public void before() throws Exception { + execution = new DelegateExecutionFake(); + org.onap.aai.domain.yang.ServiceInstance servInstance = new org.onap.aai.domain.yang.ServiceInstance(); + servInstance.setServiceInstanceId("TEST"); + when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance); + workflowAction.setBbInputSetupUtils(bbSetupUtils); + workflowAction.setBbInputSetup(bbInputSetup); + } + /** + * ALACARTE TESTS + */ + @Test + public void selectExecutionListALaCarteNetworkCreateTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Network"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/networks/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignNetwork1802BB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch3); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + + + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignNetwork1802BB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + } + + @Test + public void selectExecutionListALaCarteNetworkDeleteTest() throws Exception{ + String gAction = "deleteInstance"; + String resource = "Network"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/networks/123"); + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("UnassignNetwork1802BB"); + orchFlows.add(orch3); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetwork1802BB"); + } + + @Test + public void selectExecutionListALaCarteServiceCreateTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", true); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch2); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,true)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + /** + * SERVICE MACRO TESTS + */ + @Test + public void selectExecutionListServiceMacroAssignTest() throws Exception{ + String gAction = "assignInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("AssignNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignVnfBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch5); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + HeatEnvironment volumeHeatEnv = new HeatEnvironment(); + vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv); + org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate volumeHeatTemplate = new HeatTemplate(); + vfModule.setVolumeHeatTemplate(volumeHeatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization(); + vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + HeatEnvironment heatEnvironment = new HeatEnvironment(); + vfModuleCustomization2.setHeatEnvironment(heatEnvironment); + org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate moduleHeatTemplate = new HeatTemplate(); + vfModule2.setModuleHeatTemplate(moduleHeatTemplate); + vfModuleCustomization2.setVfModule(vfModule2); + + VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; + vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignVnfBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignVolumeGroupBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + } + + @Test + public void selectExecutionListServiceMacroActivateTest() throws Exception{ + String gAction = "activateInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/si0"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("CreateNetworkBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("ActivateVnfBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch8); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("si0"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("vnf0"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule0"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule2); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroup0"); + vnf.getVolumeGroups().add(volumeGroup); + + serviceInstanceMSO.getVnfs().add(vnf); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("si0"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals("CreateVolumeGroupBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName()); + assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId()); + assertEquals("ActivateVolumeGroupBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName()); + assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId()); + assertEquals("CreateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule0", ebbs.get(2).getWorkflowResourceIds().getVfModuleId()); + assertEquals("CreateVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId()); + assertEquals("ActivateVfModuleBB", ebbs.get(4).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule0", ebbs.get(4).getWorkflowResourceIds().getVfModuleId()); + assertEquals("ActivateVfModuleBB", ebbs.get(5).getBuildingBlock().getBpmnFlowName()); + assertEquals("vfModule1", ebbs.get(5).getWorkflowResourceIds().getVfModuleId()); + assertEquals("ActivateVnfBB", ebbs.get(6).getBuildingBlock().getBpmnFlowName()); + assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId()); + assertEquals("ActivateServiceInstanceBB", ebbs.get(7).getBuildingBlock().getBpmnFlowName()); + assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId()); + + } + + @Test + public void selectExecutionListServiceMacroDeactivateTest() throws Exception{ + String gAction = "deactivateInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch = new OrchestrationFlow(); + orch.setFlowName("DeactivateServiceInstanceBB"); + orchFlows.add(orch); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroEmptyServiceTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setIsToplevelflow(true); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + Service service = new Service(); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroCreateJustNetworkTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setIsToplevelflow(true); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + Service service = new Service(); + NetworkResourceCustomization networkCustomization = new NetworkResourceCustomization(); + networkCustomization.setModelCustomizationUUID("1234"); + service.getNetworkCustomizations().add(networkCustomization); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroCreateWithNetworkCollectionTest() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + northBoundRequest.setIsToplevelflow(true); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + Service service = new Service(); + List<NetworkResourceCustomization> networkCustomizations = new ArrayList<>(); + NetworkResourceCustomization networkCust = new NetworkResourceCustomization(); + networkCust.setModelCustomizationUUID("123"); + networkCustomizations.add(networkCust); + service.setNetworkCustomizations(networkCustomizations); + NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization(); + collectionResourceCustomization.setModelCustomizationUUID("123"); + + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("NetworkCollection"); + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setToscaNodeType("NetworkCollectionResource"); + instanceGroup.setCollectionNetworkResourceCustomizations(new ArrayList<>()); + CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization(); + collectionNetworkResourceCust.setModelCustomizationUUID("123"); + instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust ); + List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>(); + CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3); + collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization); + collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup); + instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations); + collectionResource.setInstanceGroup(instanceGroup); + collectionResourceCustomization.setCollectionResource(collectionResource);; + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123"); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB"); + assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception{ + String gAction = "createInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AssignServiceInstanceBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("AssignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("AssignVnfBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AssignVolumeGroupBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("AssignVfModuleBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("CreateNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("CreateVolumeGroupBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("ActivateVolumeGroupBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("CreateVfModuleBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("ActivateVfModuleBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("ActivateVnfBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch14); + OrchestrationFlow orch15 = new OrchestrationFlow(); + orch15.setFlowName("ActivateServiceInstanceBB"); + orchFlows.add(orch15); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); + HeatEnvironment volumeHeatEnv = new HeatEnvironment(); + vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv); + org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate volumeHeatTemplate = new HeatTemplate(); + vfModule.setVolumeHeatTemplate(volumeHeatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization(); + vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + HeatEnvironment heatEnvironment = new HeatEnvironment(); + vfModuleCustomization2.setHeatEnvironment(heatEnvironment); + org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule(); + HeatTemplate moduleHeatTemplate = new HeatTemplate(); + vfModule2.setModuleHeatTemplate(moduleHeatTemplate); + vfModuleCustomization2.setVfModule(vfModule2); + + VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2; + vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2); + when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"AssignServiceInstanceBB"); + assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length()); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignVnfBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(1).getWorkflowResourceIds().getVnfId().length()); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"AssignVolumeGroupBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length()); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"AssignVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"CreateVolumeGroupBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(6).getWorkflowResourceIds().getVolumeGroupId().length()); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateVolumeGroupBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(7).getWorkflowResourceIds().getVolumeGroupId().length()); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(8).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(9).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"CreateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(10).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(13).getBuildingBlock().getBpmnFlowName(),"ActivateVfModuleBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length()); + assertEquals(ebbs.get(14).getBuildingBlock().getBpmnFlowName(),"ActivateVnfBB"); + assertEquals(UUID.randomUUID().toString().length(),ebbs.get(14).getWorkflowResourceIds().getVnfId().length()); + assertEquals(ebbs.get(15).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB"); + assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length()); + + } + + @Test + public void selectExecutionListServiceMacroDeleteTest() throws Exception{ + String gAction = "deleteInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateVfModuleBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteVfModuleBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("DeactivateVolumeGroupBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("DeleteVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("DeactivateVnfBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("DeleteNetworkCollectionBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("DeactivateServiceInstanceBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("UnassignVfModuleBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("UnassignVolumeGroupBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("UnassignVnfBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch14); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("aaisi123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("vnfId123"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule2"); + vnf.getVfModules().add(vfModule2); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup(); + volumeGroup.setVolumeGroupId("vg123"); + vnf.getVolumeGroups().add(volumeGroup); + + serviceInstanceMSO.getVnfs().add(vnf); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeactivateVfModuleBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeleteVfModuleBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeactivateVolumeGroupBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"DeleteVolumeGroupBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeactivateVnfBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB"); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(9).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(10).getBuildingBlock().getBpmnFlowName(),"UnassignVolumeGroupBB"); + assertEquals(ebbs.get(11).getBuildingBlock().getBpmnFlowName(),"UnassignVnfBB"); + assertEquals(ebbs.get(12).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroUnassignTest() throws Exception{ + String gAction = "unassignInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("UnassignVfModuleBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("UnassignVolumeGroupBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("UnassignVnfBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch5); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("aaisi123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf(); + vnf.setVnfId("vnfId123"); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule.setVfModuleId("vfModule1"); + vnf.getVfModules().add(vfModule); + org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule(); + vfModule2.setVfModuleId("vfModule2"); + vnf.getVfModules().add(vfModule2); + + org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup(); + volumeGroup.setVolumeGroupId("vg123"); + vnf.getVolumeGroups().add(volumeGroup); + + serviceInstanceMSO.getVnfs().add(vnf); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"UnassignVfModuleBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignVolumeGroupBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"UnassignVnfBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB"); + } + + @Test + public void selectExecutionListServiceMacroDeleteNetworkCollectionTest() throws Exception{ + String gAction = "deleteInstance"; + String resource = "Service"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateVfModuleBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteVfModuleBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("DeactivateVolumeGroupBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("DeleteVolumeGroupBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("DeactivateVnfBB"); + orchFlows.add(orch5); + OrchestrationFlow orch6 = new OrchestrationFlow(); + orch6.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch6); + OrchestrationFlow orch7 = new OrchestrationFlow(); + orch7.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch7); + OrchestrationFlow orch8 = new OrchestrationFlow(); + orch8.setFlowName("DeleteNetworkCollectionBB"); + orchFlows.add(orch8); + OrchestrationFlow orch9 = new OrchestrationFlow(); + orch9.setFlowName("DeactivateServiceInstanceBB"); + orchFlows.add(orch9); + OrchestrationFlow orch10 = new OrchestrationFlow(); + orch10.setFlowName("UnassignVfModuleBB"); + orchFlows.add(orch10); + OrchestrationFlow orch11 = new OrchestrationFlow(); + orch11.setFlowName("UnassignVolumeGroupBB"); + orchFlows.add(orch11); + OrchestrationFlow orch12 = new OrchestrationFlow(); + orch12.setFlowName("UnassignVnfBB"); + orchFlows.add(orch12); + OrchestrationFlow orch13 = new OrchestrationFlow(); + orch13.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch13); + OrchestrationFlow orch14 = new OrchestrationFlow(); + orch14.setFlowName("UnassignServiceInstanceBB"); + orchFlows.add(orch14); + + ServiceInstance serviceInstanceAAI = new ServiceInstance(); + serviceInstanceAAI.setServiceInstanceId("aaisi123"); + org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance(); + + org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network(); + network.setNetworkId("123"); + serviceInstanceMSO.getNetworks().add(network); + org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network(); + network2.setNetworkId("321"); + serviceInstanceMSO.getNetworks().add(network2); + + Collection collection = new Collection(); + serviceInstanceMSO.setCollection(collection); + + doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123"); + doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI); + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeactivateServiceInstanceBB"); + assertEquals(ebbs.get(8).getBuildingBlock().getBpmnFlowName(),"UnassignServiceInstanceBB"); + } + + @Ignore + @Test + public void selectExecutionListNetworkCollectionMacroCreate() throws Exception{ + String gAction = "createInstance"; + String resource = "NetworkCollection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("CreateNetworkCollectionBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("AssignNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("CreateNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("ActivateNetworkBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("ActivateNetworkCollectionBB"); + orchFlows.add(orch5); + + Service service = new Service(); + CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization(); + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("Data NetworkCollection Data"); + collectionResourceCustomization.setCollectionResource(collectionResource); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"CreateNetworkCollectionBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkCollectionBB"); + } + + @Ignore + @Test + public void selectExecutionListNetworkCollectionMacroDelete() throws Exception{ + String gAction = "deleteInstance"; + String resource = "NetworkCollection"; + execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688"); + execution.setVariable("requestAction", gAction); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json"))); + execution.setVariable("bpmnRequest", bpmnRequest); + execution.setVariable("aLaCarte", false); + execution.setVariable("apiVersion", "7"); + execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123"); + + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + northBoundRequest.setOrchestrationFlowList(orchFlows); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("DeactivateNetworkBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("DeleteNetworkBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("UnassignNetworkBB"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("DeactivateNetworkCollectionBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("DeleteNetworkCollectionBB"); + orchFlows.add(orch5); + + Service service = new Service(); + CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization(); + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("Data NetworkCollection Data"); + collectionResourceCustomization.setCollectionResource(collectionResource); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(gAction,resource,false)).thenReturn(northBoundRequest); + when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service); + workflowAction.selectExecutionList(execution); + List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); + assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(ebbs.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(ebbs.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(ebbs.get(6).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkCollectionBB"); + assertEquals(ebbs.get(7).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkCollectionBB"); + } + + /** + * WorkflowActionBB Tests + */ + + @Test + public void pluralTest() { + List<String> items = Arrays.asList( + "serviceInstances, Service", + "vnfs, Vnf", + "vfModules, VfModule", + "networks, Network", + "invalidNames, invalidNames"); + items.forEach(item -> { + String[] split = item.split(","); + String type = split[0].trim(); + String expected = split[1].trim(); + assertThat(workflowAction.convertTypeFromPlural(type), equalTo(expected)); + }); + } + + @Test + public void sortExecutionPathByObjectForVlanTaggingCreateTest() throws Exception{ + List<ExecuteBuildingBlock> executeFlows = new ArrayList<>(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock bb = new BuildingBlock(); + bb.setBpmnFlowName("AssignNetworkBB"); + bb.setKey("0"); + ebb.setBuildingBlock(bb); + executeFlows.add(ebb); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("AssignNetworkBB"); + bb2.setKey("1"); + ebb2.setBuildingBlock(bb2); + executeFlows.add(ebb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("CreateNetworkBB"); + bb3.setKey("0"); + ebb3.setBuildingBlock(bb3); + executeFlows.add(ebb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("CreateNetworkBB"); + bb4.setKey("1"); + ebb4.setBuildingBlock(bb4); + executeFlows.add(ebb4); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); + BuildingBlock bb5 = new BuildingBlock(); + bb5.setBpmnFlowName("ActivateNetworkBB"); + bb5.setKey("0"); + ebb5.setBuildingBlock(bb5); + executeFlows.add(ebb5); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); + BuildingBlock bb6 = new BuildingBlock(); + bb6.setBpmnFlowName("ActivateNetworkBB"); + bb6.setKey("1"); + ebb6.setBuildingBlock(bb6); + executeFlows.add(ebb6); + + List<ExecuteBuildingBlock> sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"createInstance"); + assertEquals(sorted.get(0).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(sorted.get(1).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(sorted.get(2).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + assertEquals(sorted.get(3).getBuildingBlock().getBpmnFlowName(),"AssignNetworkBB"); + assertEquals(sorted.get(4).getBuildingBlock().getBpmnFlowName(),"CreateNetworkBB"); + assertEquals(sorted.get(5).getBuildingBlock().getBpmnFlowName(),"ActivateNetworkBB"); + } + + @Test + public void sortExecutionPathByObjectForVlanTaggingDeleteTest() throws Exception{ + List<ExecuteBuildingBlock> executeFlows = new ArrayList<>(); + ExecuteBuildingBlock ebb = new ExecuteBuildingBlock(); + BuildingBlock bb = new BuildingBlock(); + bb.setBpmnFlowName("DeactivateNetworkBB"); + bb.setKey("0"); + ebb.setBuildingBlock(bb); + executeFlows.add(ebb); + ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock(); + BuildingBlock bb2 = new BuildingBlock(); + bb2.setBpmnFlowName("DeactivateNetworkBB"); + bb2.setKey("1"); + ebb2.setBuildingBlock(bb2); + executeFlows.add(ebb2); + ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock(); + BuildingBlock bb3 = new BuildingBlock(); + bb3.setBpmnFlowName("DeleteNetworkBB"); + bb3.setKey("0"); + ebb3.setBuildingBlock(bb3); + executeFlows.add(ebb3); + ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock(); + BuildingBlock bb4 = new BuildingBlock(); + bb4.setBpmnFlowName("DeleteNetworkBB"); + bb4.setKey("1"); + ebb4.setBuildingBlock(bb4); + executeFlows.add(ebb4); + ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock(); + BuildingBlock bb5 = new BuildingBlock(); + bb5.setBpmnFlowName("UnassignNetworkBB"); + bb5.setKey("0"); + ebb5.setBuildingBlock(bb5); + executeFlows.add(ebb5); + ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock(); + BuildingBlock bb6 = new BuildingBlock(); + bb6.setBpmnFlowName("UnassignNetworkBB"); + bb6.setKey("1"); + ebb6.setBuildingBlock(bb6); + executeFlows.add(ebb6); + + List<ExecuteBuildingBlock> sorted = workflowAction.sortExecutionPathByObjectForVlanTagging(executeFlows,"deleteInstance"); + assertEquals(sorted.get(0).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(sorted.get(1).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(sorted.get(2).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + assertEquals(sorted.get(3).getBuildingBlock().getBpmnFlowName(),"DeactivateNetworkBB"); + assertEquals(sorted.get(4).getBuildingBlock().getBpmnFlowName(),"DeleteNetworkBB"); + assertEquals(sorted.get(5).getBuildingBlock().getBpmnFlowName(),"UnassignNetworkBB"); + } + @Test + public void queryNorthBoundRequestCatalogDbNestedTest() throws MalformedURLException { + NorthBoundRequest northBoundRequest = new NorthBoundRequest(); + List<OrchestrationFlow> orchFlows = new LinkedList<>(); + OrchestrationFlow orch1 = new OrchestrationFlow(); + orch1.setFlowName("AAICheckVnfInMaintBB"); + orchFlows.add(orch1); + OrchestrationFlow orch2 = new OrchestrationFlow(); + orch2.setFlowName("AAISetVnfInMaintBB"); + orchFlows.add(orch2); + OrchestrationFlow orch3 = new OrchestrationFlow(); + orch3.setFlowName("VNF-Macro-Replace"); + orchFlows.add(orch3); + OrchestrationFlow orch4 = new OrchestrationFlow(); + orch4.setFlowName("SDNOVnfHealthCheckBB"); + orchFlows.add(orch4); + OrchestrationFlow orch5 = new OrchestrationFlow(); + orch5.setFlowName("AAIUnsetVnfInMaintBB"); + orchFlows.add(orch5); + northBoundRequest.setOrchestrationFlowList(orchFlows); + + List<OrchestrationFlow> macroFlows = new LinkedList<>(); + OrchestrationFlow o1 = new OrchestrationFlow(); + o1.setFlowName("DeactivateVfModuleBB"); + macroFlows.add(o1); + OrchestrationFlow o2 = new OrchestrationFlow(); + o2.setFlowName("DeleteVfModuleBB"); + macroFlows.add(o2); + OrchestrationFlow o3 = new OrchestrationFlow(); + o3.setFlowName("DeactivateVnfBB"); + macroFlows.add(o3); + OrchestrationFlow o4 = new OrchestrationFlow(); + o4.setFlowName("CreateVfModuleBB"); + macroFlows.add(o4); + OrchestrationFlow o5 = new OrchestrationFlow(); + o5.setFlowName("ActivateVfModuleBB"); + macroFlows.add(o5); + OrchestrationFlow o6 = new OrchestrationFlow(); + o6.setFlowName("ActivateVnfBB"); + macroFlows.add(o6); + + when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScope("replaceInstance","Vnf",false)).thenReturn(northBoundRequest); + when(catalogDbClient.getOrchestrationFlowByAction("VNF-Macro-Replace")).thenReturn(macroFlows); + List<OrchestrationFlow> flows = workflowAction.queryNorthBoundRequestCatalogDb(execution, "replaceInstance", WorkflowType.VNF, false); + assertEquals(flows.get(0).getFlowName(),"AAICheckVnfInMaintBB"); + assertEquals(flows.get(1).getFlowName(),"AAISetVnfInMaintBB"); + assertEquals(flows.get(2).getFlowName(),"DeactivateVfModuleBB"); + assertEquals(flows.get(3).getFlowName(),"DeleteVfModuleBB"); + assertEquals(flows.get(4).getFlowName(),"DeactivateVnfBB"); + assertEquals(flows.get(5).getFlowName(),"CreateVfModuleBB"); + assertEquals(flows.get(6).getFlowName(),"ActivateVfModuleBB"); + assertEquals(flows.get(7).getFlowName(),"ActivateVnfBB"); + assertEquals(flows.get(8).getFlowName(),"SDNOVnfHealthCheckBB"); + assertEquals(flows.get(9).getFlowName(),"AAIUnsetVnfInMaintBB"); + } + + @Test + public void extractResourceIdAndTypeFromUriTest(){ + String uri = "/v6/serviceInstances/123"; + String uri2 = "/v6/serviceInstances/123/vnfs/1234"; + String uri3 = "/v6/serviceInstances"; + String uri4 = "/v6/serviceInstances/assign"; + String uri5 = "'/v6/serviceInstances/123/vnfs"; + String uri6 = "/v6/serviceInstances/123/vnfs/1234/someAction"; + String uri7 = "/v6/serviceInstances/123/vnfs/1234/vfModules/5678/replace"; + + Resource expected1 = new Resource(WorkflowType.SERVICE, "123", true); + Resource expected2 = new Resource(WorkflowType.VNF, "1234", false); + Resource expected3 = new Resource(WorkflowType.VNF, "1234", false); + Resource expected4 = new Resource(WorkflowType.VFMODULE, "5678", false); + Resource result = workflowAction.extractResourceIdAndTypeFromUri(uri); + assertEquals(expected1.getResourceId(),result.getResourceId()); + assertEquals(expected1.getResourceType(),result.getResourceType()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri2); + assertEquals(expected2.getResourceId(),result.getResourceId()); + assertEquals(expected2.getResourceType(),result.getResourceType()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri3); + assertEquals("Service", result.getResourceType().toString()); + assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri4); + assertEquals("Service", result.getResourceType().toString()); + assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri5); + assertEquals("Vnf", result.getResourceType().toString()); + assertEquals(UUID.randomUUID().toString().length(),result.getResourceId().length()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri6); + assertEquals(expected3.getResourceId(),result.getResourceId()); + assertEquals(expected3.getResourceType(),result.getResourceType()); + result = workflowAction.extractResourceIdAndTypeFromUri(uri7); + assertEquals(expected4.getResourceId(),result.getResourceId()); + assertEquals(expected4.getResourceType(),result.getResourceType()); + } + + @Test + public void extractResourceIdAndTypeFromUriInvalidTypeTest() { + this.expectedException.expect(IllegalArgumentException.class); + this.expectedException.expectMessage(containsString("Uri could not be parsed. No type found.")); + workflowAction.extractResourceIdAndTypeFromUri("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace"); + } + + @Test + public void extractResourceIdAndTypeFromUriInvalidUriTest() { + this.expectedException.expect(IllegalArgumentException.class); + this.expectedException.expectMessage(containsString("Uri could not be parsed:")); + workflowAction.extractResourceIdAndTypeFromUri("something that doesn't match anything"); + } + + @Test + public void populateResourceIdsFromApiHandlerTest(){ + execution.setVariable("serviceInstanceId", "123"); + execution.setVariable("vnfId", "888"); + WorkflowResourceIds x = workflowAction.populateResourceIdsFromApiHandler(execution); + assertEquals("123",x.getServiceInstanceId()); + assertEquals("888",x.getVnfId()); + assertNull(x.getVolumeGroupId()); + } + + @Test + public void validateResourceIdInAAITest() throws Exception{ + //SI + RequestDetails reqDetails = new RequestDetails(); + SubscriberInfo subInfo = new SubscriberInfo(); + subInfo.setGlobalSubscriberId("id123"); + reqDetails.setSubscriberInfo(subInfo); + RequestParameters reqParams = new RequestParameters(); + reqParams.setSubscriptionServiceType("subServiceType123"); + reqDetails.setRequestParameters(reqParams ); + WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(); + ServiceInstance si = new ServiceInstance(); + si.setServiceInstanceId("siId123"); + Optional<ServiceInstance> siOp = Optional.of(si); + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "siName123")).thenReturn(siOp); + when(bbSetupUtils.getAAIServiceInstanceByName("id123", "subServiceType123", "111111")).thenReturn(Optional.empty()); + String id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "siName123", reqDetails, workflowResourceIds); + assertEquals("siId123",id); + String id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.SERVICE, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //Network + L3Network network = new L3Network(); + network.setNetworkId("id123"); + network.setNetworkName("name123"); + workflowResourceIds.setServiceInstanceId("siId123"); + Optional<L3Network> opNetwork = Optional.of(network); + when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123","name123")).thenReturn(opNetwork); + when(bbSetupUtils.getRelatedNetworkByNameFromServiceInstance("siId123","111111")).thenReturn(Optional.empty()); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.NETWORK, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //Vnf + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("id123"); + vnf.setVnfName("vnfName123"); + Optional<GenericVnf> opVnf = Optional.of(vnf); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123","name123")).thenReturn(opVnf); + when(bbSetupUtils.getRelatedVnfByNameFromServiceInstance("siId123","111111")).thenReturn(Optional.empty()); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VNF, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //VfModule + VfModules vfModules = new VfModules(); + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("id123"); + vfModule.setVfModuleName("name123"); + vfModules.getVfModule().add(vfModule); + vnf.setVfModules(vfModules); + workflowResourceIds.setVnfId("id123"); + when(bbSetupUtils.getAAIGenericVnf("id123")).thenReturn(vnf); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + + GenericVnf vnf2 = new GenericVnf(); + VfModules vfModules2 = new VfModules(); + VfModule vfModule2 = new VfModule(); + vfModule2.setVfModuleId("id123"); + vfModule2.setVfModuleName("name123"); + vfModules2.getVfModule().add(vfModule2); + vnf2.setVfModules(vfModules2); + workflowResourceIds.setVnfId("id111"); + when(bbSetupUtils.getAAIGenericVnf("id111")).thenReturn(vnf2); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VFMODULE, "111111", reqDetails, workflowResourceIds); + assertEquals("generatedId123",id2); + + //VolumeGroup + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("id123"); + volumeGroup.setVolumeGroupName("name123"); + workflowResourceIds.setVnfId("id123"); + Optional<VolumeGroup> opVolumeGroup = Optional.of(volumeGroup); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id123","name123")).thenReturn(opVolumeGroup); + id = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "name123", reqDetails, workflowResourceIds); + assertEquals("id123",id); + + workflowResourceIds.setVnfId("id444"); + when(bbSetupUtils.getAAIGenericVnf("id444")).thenReturn(vnf); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVfModule("id123","111111")).thenReturn(opVolumeGroup); + when(bbSetupUtils.getRelatedVolumeGroupByNameFromVnf("id444","111111")).thenReturn(Optional.empty()); + id2 = workflowAction.validateResourceIdInAAI("generatedId123", WorkflowType.VOLUMEGROUP, "111111", reqDetails, workflowResourceIds); + assertEquals("id123",id2); + } + + @Test + public void handleRuntimeExceptionTest(){ + execution.setVariable("BPMN_javaExpMsg", "test runtime error message"); + execution.setVariable("testProcessKey", "testProcessKeyValue"); + try{ + workflowAction.handleRuntimeException(execution); + } catch (BpmnError wfe) { + assertEquals("MSOWorkflowException",wfe.getErrorCode()); + } + } + + @Test + public void traverseCatalogDbServiceMultipleNetworkTest() throws IOException{ + execution.setVariable("testProcessKey", "testProcessKeyValue"); + Service service = new Service(); + List<NetworkResourceCustomization> networkCustomizations = new ArrayList<>(); + NetworkResourceCustomization networkCust = new NetworkResourceCustomization(); + networkCust.setModelCustomizationUUID("123"); + networkCustomizations.add(networkCust); + service.setNetworkCustomizations(networkCustomizations); + NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization(); + collectionResourceCustomization.setModelCustomizationUUID("123"); + CollectionResource collectionResource = new CollectionResource(); + collectionResource.setToscaNodeType("NetworkCollection"); + InstanceGroup instanceGroup = new InstanceGroup(); + List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>(); + CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization(); + collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3); + collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization); + instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations); + collectionResource.setInstanceGroup(instanceGroup); + collectionResourceCustomization.setCollectionResource(collectionResource);; + service.setModelUUID("abc"); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + service.getCollectionResourceCustomizations().add(collectionResourceCustomization); + doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); + doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123"); + String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json"))); + ObjectMapper mapper = new ObjectMapper(); + ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); + List<Resource> resourceCounter = new ArrayList<>(); + thrown.expect(BpmnError.class); + workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter); + } + + @Test + public void sortVfModulesByBaseFirstTest(){ + List<Resource> resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE,"111",false); + resource1.setBaseVfModule(false); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE,"222",false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE,"333",false); + resource3.setBaseVfModule(true); + resources.add(resource3); + List<Resource> result = workflowAction.sortVfModulesByBaseFirst(resources); + assertEquals("333",result.get(0).getResourceId()); + assertEquals("222",result.get(1).getResourceId()); + assertEquals("111",result.get(2).getResourceId()); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java new file mode 100644 index 0000000000..10599bdab4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/sdno/tasks/SDNOHealthCheckTasksTest.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.sdno.tasks; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import org.camunda.bpm.engine.delegate.BpmnError; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.SDNOHealthCheckResources; + + +@RunWith(MockitoJUnitRunner.class) +public class SDNOHealthCheckTasksTest extends TestDataSetup { + + @InjectMocks + protected SDNOHealthCheckTasks sdnoHealthCheckTasks = new SDNOHealthCheckTasks(); + + @Mock + SDNOHealthCheckResources MOCK_sdnoHealthCheckResources; + + + @Mock + private ExceptionBuilder exceptionUtil; + + @Mock + private ExtractPojosForBB extractPojosForBB; + + + private RequestContext requestContext; + private GenericVnf genericVnf; + + @Before + public void before() throws BBObjectNotFoundException { + genericVnf = setGenericVnf(); + requestContext = setRequestContext(); + when(extractPojosForBB.extractByKey(any(),any(), any())).thenReturn(genericVnf); + + } + + @Test + public void sdnoHealthCheckTest() throws Exception { + doReturn(true).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); + sdnoHealthCheckTasks.sdnoHealthCheck(execution); + verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); + } + + @Test + public void sdnoHealthCheckNoResponseTest() throws Exception { + + doReturn(false).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); + try { + sdnoHealthCheckTasks.sdnoHealthCheck(execution); + } catch (Exception e) { + verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + + } + + @Test + public void sdnoHealthCheckExceptionTest() throws Exception { + doThrow(new Exception("Unknown Error")).when(MOCK_sdnoHealthCheckResources).healthCheck(genericVnf, requestContext); + doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + try { + sdnoHealthCheckTasks.sdnoHealthCheck(execution); + } catch (Exception e) { + verify(MOCK_sdnoHealthCheckResources, times(1)).healthCheck(genericVnf, requestContext); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class)); + } + + } +} 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 new file mode 100644 index 0000000000..88f8526f31 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java @@ -0,0 +1,623 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.aai.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.assertThat; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +import org.junit.Test; +import org.onap.aai.domain.yang.RouteTargets; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; +import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +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; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectWriter; + +public class AAIObjectMapperTest{ + private AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + + @Test + public void mapConfigurationTest() { + Configuration configuration = new Configuration(); + configuration.setConfigurationId("configId"); + configuration.setConfigurationName("VNR"); + configuration.setConfigurationType("VNR-TYPE"); + configuration.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + configuration.setManagementOption("managementOption"); + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelCustomizationId("modelCustId"); + modelInfoConfiguration.setModelInvariantId("modelInvariantId"); + modelInfoConfiguration.setModelVersionId("modelVersionId"); + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + org.onap.aai.domain.yang.Configuration expectedConfiguration = new org.onap.aai.domain.yang.Configuration(); + expectedConfiguration.setConfigurationId(configuration.getConfigurationId()); + expectedConfiguration.setConfigurationName(configuration.getConfigurationName()); + expectedConfiguration.setConfigurationType(configuration.getConfigurationType()); + expectedConfiguration.setOrchestrationStatus(configuration.getOrchestrationStatus().toString()); + expectedConfiguration.setManagementOption(configuration.getManagementOption()); + expectedConfiguration.setModelInvariantId(configuration.getModelInfoConfiguration().getModelInvariantId()); + expectedConfiguration.setModelVersionId(configuration.getModelInfoConfiguration().getModelVersionId()); + expectedConfiguration.setModelCustomizationId(configuration.getModelInfoConfiguration().getModelCustomizationId()); + + org.onap.aai.domain.yang.Configuration actualConfiguration = aaiObjectMapper.mapConfiguration(configuration); + + assertThat(actualConfiguration, sameBeanAs(expectedConfiguration)); + } + + @Test + public void mapVolumeGroupTest() throws Exception { + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setHeatStackId("heatStackId"); + volumeGroup.setModelInfoVfModule(new ModelInfoVfModule()); + volumeGroup.getModelInfoVfModule().setModelCustomizationUUID("modelCustomizationId"); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + volumeGroup.setVnfType("vnfType"); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + org.onap.aai.domain.yang.VolumeGroup expectedVolumeGroup = new org.onap.aai.domain.yang.VolumeGroup(); + expectedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId()); + expectedVolumeGroup.setModelCustomizationId(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + expectedVolumeGroup.setOrchestrationStatus(volumeGroup.getOrchestrationStatus().toString()); + expectedVolumeGroup.setVfModuleModelCustomizationId(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + expectedVolumeGroup.setVnfType(volumeGroup.getVnfType()); + expectedVolumeGroup.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + expectedVolumeGroup.setVolumeGroupName(volumeGroup.getVolumeGroupName()); + + org.onap.aai.domain.yang.VolumeGroup actualVolumeGroup = aaiObjectMapper.mapVolumeGroup(volumeGroup); + + assertThat(actualVolumeGroup, sameBeanAs(expectedVolumeGroup)); + } + + @Test + public void serviceInstanceMap() { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("SIID"); + serviceInstance.setServiceInstanceName("SINAME"); + serviceInstance.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setServiceType("SITYPE"); + modelInfoServiceInstance.setServiceRole("SIROLE"); + modelInfoServiceInstance.setModelInvariantUuid("MIUUID"); + modelInfoServiceInstance.setModelUuid("MUUID"); + modelInfoServiceInstance.setEnvironmentContext("EC"); + modelInfoServiceInstance.setWorkloadContext("WC"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + org.onap.aai.domain.yang.ServiceInstance AAIServiceInstance = aaiObjectMapper.mapServiceInstance(serviceInstance); + + assertEquals(AAIServiceInstance.getServiceInstanceId(),serviceInstance.getServiceInstanceId()); + assertEquals(AAIServiceInstance.getServiceInstanceName(),serviceInstance.getServiceInstanceName()); + assertEquals(AAIServiceInstance.getOrchestrationStatus().toString(),serviceInstance.getOrchestrationStatus().toString()); + assertEquals(AAIServiceInstance.getServiceType(),serviceInstance.getModelInfoServiceInstance().getServiceType()); + assertEquals(AAIServiceInstance.getServiceRole(),serviceInstance.getModelInfoServiceInstance().getServiceRole()); + assertEquals(AAIServiceInstance.getModelInvariantId(),serviceInstance.getModelInfoServiceInstance().getModelInvariantUuid()); + assertEquals(AAIServiceInstance.getModelVersionId(),serviceInstance.getModelInfoServiceInstance().getModelUuid()); + assertEquals(AAIServiceInstance.getEnvironmentContext(),serviceInstance.getModelInfoServiceInstance().getEnvironmentContext()); + assertEquals(AAIServiceInstance.getWorkloadContext(),serviceInstance.getModelInfoServiceInstance().getWorkloadContext()); + } + + @Test + public void projectMap(){ + Project project = new Project(); + project.setProjectName("abc"); + + org.onap.aai.domain.yang.Project AAIProject = aaiObjectMapper.mapProject(project); + + assertEquals(AAIProject.getProjectName(),project.getProjectName()); + } + + @Test + public void serviceSubscriptionMap(){ + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("IP-FLEX"); + serviceSubscription.setTempUbSubAccountId("Account-ID"); + org.onap.aai.domain.yang.ServiceSubscription serviceSubscriptionMapped = aaiObjectMapper.mapServiceSubscription(serviceSubscription); + assertNotNull(serviceSubscriptionMapped); + assertEquals(serviceSubscription.getTempUbSubAccountId(),serviceSubscriptionMapped.getTempUbSubAccountId()); + assertEquals(serviceSubscription.getServiceType(),serviceSubscriptionMapped.getServiceType()); + } + + @Test + public void owningEntityMap(){ + OwningEntity oe = new OwningEntity(); + oe.setOwningEntityId("abc"); + oe.setOwningEntityName("bbb"); + + org.onap.aai.domain.yang.OwningEntity AAIOwningEntity = aaiObjectMapper.mapOwningEntity(oe); + + assertEquals(AAIOwningEntity.getOwningEntityId(),oe.getOwningEntityId()); + assertEquals(AAIOwningEntity.getOwningEntityName(),oe.getOwningEntityName()); + + } + + @Test + public void vnfMap(){ + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("a"); + vnf.setVnfName("b"); + vnf.setServiceId("c"); + vnf.setVnfType("d"); + vnf.setProvStatus("e"); + vnf.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelCustomizationUuid("f"); + modelInfoGenericVnf.setModelInvariantUuid("g"); + modelInfoGenericVnf.setModelUuid("h"); + modelInfoGenericVnf.setNfRole("i"); + modelInfoGenericVnf.setNfType("j"); + modelInfoGenericVnf.setNfFunction("k"); + modelInfoGenericVnf.setNfNamingCode("l"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + org.onap.aai.domain.yang.GenericVnf AAIVnf = aaiObjectMapper.mapVnf(vnf); + + assertEquals(AAIVnf.getVnfId(),vnf.getVnfId()); + assertEquals(AAIVnf.getVnfName(),vnf.getVnfName()); + assertEquals(AAIVnf.getServiceId(),vnf.getServiceId()); + assertEquals(AAIVnf.getVnfType(),vnf.getVnfType()); + assertEquals(AAIVnf.getProvStatus(),vnf.getProvStatus()); + assertEquals(AAIVnf.getOrchestrationStatus().toString(),vnf.getOrchestrationStatus().toString()); + assertEquals(AAIVnf.getModelCustomizationId(),vnf.getModelInfoGenericVnf().getModelCustomizationUuid()); + assertEquals(AAIVnf.getModelInvariantId(),vnf.getModelInfoGenericVnf().getModelInvariantUuid()); + assertEquals(AAIVnf.getModelVersionId(),vnf.getModelInfoGenericVnf().getModelUuid()); + assertEquals(AAIVnf.getModelVersionId(),vnf.getModelInfoGenericVnf().getModelUuid()); + assertEquals(AAIVnf.getNfType(),vnf.getModelInfoGenericVnf().getNfType()); + assertEquals(AAIVnf.getNfFunction(),vnf.getModelInfoGenericVnf().getNfFunction()); + assertEquals(AAIVnf.getNfNamingCode(),vnf.getModelInfoGenericVnf().getNfNamingCode()); + } + + @Test + public void vfModuleMap() throws Exception { + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("a"); + vfModule.setVfModuleName("b"); + vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelCustomizationUUID("f"); + modelInfoVfModule.setModelInvariantUUID("g"); + modelInfoVfModule.setModelUUID("h"); + modelInfoVfModule.setIsBaseBoolean(false); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleMap.json"))); + + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.VfModule reqMapper1 = omapper.readValue( + jsonToCompare, + org.onap.aai.domain.yang.VfModule.class); + + assertThat(reqMapper1, sameBeanAs(AAIVfModule)); + + } + + @Test + public void testMapInstanceGroup() { + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("test-id"); + instanceGroup.setDescription("test-description"); + instanceGroup.setInstanceGroupName("test-instanceGroupName"); + instanceGroup.setResourceVersion("test-resourceVersion"); + + + ModelInfoInstanceGroup model = new ModelInfoInstanceGroup(); + model.setFunction("test-function"); + model.setInstanceGroupRole("SUB-INTERFACE"); + model.setType("VNFC"); + model.setModelInvariantUUID("modelInvariantUUID-000"); + model.setModelUUID("modelUUID-000"); + model.setDescription("test-description"); + + instanceGroup.setModelInfoInstanceGroup(model); + + + org.onap.aai.domain.yang.InstanceGroup aaiInstanceGroup = aaiObjectMapper.mapInstanceGroup(instanceGroup); + + try { + com.fasterxml.jackson.databind.ObjectMapper mapper = new com.fasterxml.jackson.databind.ObjectMapper(); + String json = mapper.writeValueAsString(aaiInstanceGroup); + System.out.println("GGG - json:\n" + json); + + } + catch(Exception e) { + e.printStackTrace(); + } + + assertEquals(aaiInstanceGroup.getId(), instanceGroup.getId()); + assertEquals(aaiInstanceGroup.getDescription(), instanceGroup.getDescription()); + assertEquals(aaiInstanceGroup.getInstanceGroupRole(), instanceGroup.getModelInfoInstanceGroup().getInstanceGroupRole()); + assertEquals(aaiInstanceGroup.getModelInvariantId(), instanceGroup.getModelInfoInstanceGroup().getModelInvariantUUID()); + assertEquals(aaiInstanceGroup.getModelVersionId(), instanceGroup.getModelInfoInstanceGroup().getModelUUID()); + assertEquals(aaiInstanceGroup.getResourceVersion(), instanceGroup.getResourceVersion()); + assertEquals(aaiInstanceGroup.getInstanceGroupType(), instanceGroup.getModelInfoInstanceGroup().getType()); + } + + @Test + public void mapCustomerTest() { + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setSubscriberName("subscriberName"); + customer.setSubscriberType("subscriberType"); + + org.onap.aai.domain.yang.Customer expectedCustomer = new org.onap.aai.domain.yang.Customer(); + expectedCustomer.setGlobalCustomerId("globalCustomerId"); + expectedCustomer.setSubscriberName("subscriberName"); + expectedCustomer.setSubscriberType("subscriberType"); + + org.onap.aai.domain.yang.Customer actualCustomer = aaiObjectMapper.mapCustomer(customer); + + assertThat(actualCustomer, sameBeanAs(expectedCustomer)); + } + + @Test + public void networkMap() throws Exception { + L3Network l3Network = new L3Network(); + l3Network.setNetworkId("networkId"); + l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + l3Network.setNetworkName("networkName"); + l3Network.setNetworkRole("networkRole"); + l3Network.setNetworkTechnology("networkTechnology"); + l3Network.setNeutronNetworkId("neutronNetworkId"); + l3Network.setNetworkRoleInstance(0L); + l3Network.setContrailNetworkFqdn("contrailNetworkFqdn"); + l3Network.setIsBoundToVpn(false); + l3Network.setIsCascaded(false); + l3Network.setIsExternalNetwork(false); + l3Network.setHeatStackId("heatStackId"); + l3Network.setOperationalStatus("operationalStatus"); + l3Network.setPhysicalNetworkName("physicalNetworkName"); + l3Network.setIsProviderNetwork(false); + l3Network.setSelflink("selflink"); + l3Network.setServiceId("serviceId"); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID"); + modelInfoNetwork.setModelInvariantUUID("modelInvariantUUID"); + modelInfoNetwork.setModelUUID("modelUUID"); + + l3Network.setModelInfoNetwork(modelInfoNetwork); + + org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(l3Network); + + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.L3Network network = omapper.readValue( + getJson("aaiL3NetworkMapped.json"), + org.onap.aai.domain.yang.L3Network.class); + + com.shazam.shazamcrest.MatcherAssert.assertThat(aaiL3Network, sameBeanAs(network)); + + } + + @Test + public void mapCollectionTest() { + Collection networkCollection = new Collection(); + networkCollection.setId("networkCollectionId"); + ModelInfoCollection modelInfoCollection = new ModelInfoCollection(); + modelInfoCollection.setCollectionFunction("networkCollectionFunction"); + modelInfoCollection.setCollectionRole("networkCollectionRole"); + networkCollection.setModelInfoCollection(modelInfoCollection); + networkCollection.setName("networkCollectionName"); + + org.onap.aai.domain.yang.Collection expectedCollection = new org.onap.aai.domain.yang.Collection(); + expectedCollection.setCollectionId("networkCollectionId"); + expectedCollection.setCollectionFunction("networkCollectionFunction"); + expectedCollection.setCollectionRole("networkCollectionRole"); + expectedCollection.setCollectionName("networkCollectionName"); + + org.onap.aai.domain.yang.Collection actualCollection = aaiObjectMapper.mapCollection(networkCollection); + + assertThat(actualCollection, sameBeanAs(expectedCollection)); + } + + /* + * Helper method to load JSON data + */ + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename))); + } + + @Test + public void mapNetworkTest() throws Exception { + L3Network l3Network = new L3Network(); + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelCustomizationUUID("modelCustomization_id"); + modelInfoNetwork.setModelInvariantUUID("modelInvariant_id"); + modelInfoNetwork.setModelUUID("modelCustomization_id"); + modelInfoNetwork.setNetworkType("CONTRAIL_EXTERNAL"); + modelInfoNetwork.setNetworkRole("dmz_direct"); + modelInfoNetwork.setNetworkTechnology("contrail"); + l3Network.setModelInfoNetwork(modelInfoNetwork); + l3Network.setNetworkId("TESTING_ID"); + l3Network.setNetworkName("TESTING_NAME"); + l3Network.setIsBoundToVpn(true); + l3Network.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"); + l3Network.setNetworkRoleInstance(1L); + l3Network.setOrchestrationStatus(OrchestrationStatus.CREATED); + l3Network.setHeatStackId("heatStack_id"); + l3Network.setContrailNetworkFqdn("contrailNetwork_fqdn"); + l3Network.setWidgetModelId("widgetModel_id"); + l3Network.setWidgetModelVersion("widgetModel_version"); + l3Network.setPhysicalNetworkName("physicalNetwork_name"); + l3Network.setIsProviderNetwork(true); + l3Network.setIsSharedNetwork(false); + l3Network.setIsExternalNetwork(false); + l3Network.setSelflink("self_link"); + l3Network.setOperationalStatus("operationalStatus"); + + List<Subnet> subnets = new ArrayList<Subnet>(); + Subnet subnet1 = new Subnet(); + subnet1.setSubnetId("57e9a1ff-d14f-4071-a828-b19ae98eb2fc"); + subnet1.setSubnetName("subnetName"); + subnet1.setGatewayAddress("192.168.52.1"); + subnet1.setNetworkStartAddress("192.168.52.0"); + subnet1.setCidrMask("24"); + subnet1.setIpVersion("4"); + subnet1.setOrchestrationStatus(OrchestrationStatus.CREATED); + subnet1.setIpAssignmentDirection("true"); + subnet1.setDhcpEnabled(true); + subnet1.setDhcpStart("dhcpStart"); + subnet1.setDhcpEnd("dhcpEnd"); + subnet1.setSubnetRole("subnetRole"); + subnet1.setIpAssignmentDirection("true"); + subnet1.setSubnetSequence(new Integer(3)); + + List<HostRoute> hostRoutes = new ArrayList<HostRoute>(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setHostRouteId("string"); + hostRoute1.setRoutePrefix("192.10.16.0/24"); + hostRoute1.setNextHop("192.10.16.100/24"); + hostRoute1.setNextHopType("ip-address"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setHostRouteId("string"); + hostRoute2.setRoutePrefix("192.110.17.0/24"); + hostRoute2.setNextHop("192.110.17.110/24"); + hostRoute2.setNextHopType("ip-address"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + subnet1.getHostRoutes().addAll(hostRoutes); + + subnets.add(subnet1); + subnets.add(subnet1); + l3Network.getSubnets().addAll(subnets); + + List<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>(); + CtagAssignment ctagAssignment1 = new CtagAssignment(); + ctagAssignment1.setVlanIdInner(1L); + ctagAssignments.add(ctagAssignment1); + l3Network.getCtagAssignments().addAll(ctagAssignments); + + List<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>(); + SegmentationAssignment segmentationAssignment1 = new SegmentationAssignment(); + segmentationAssignment1.setSegmentationId("segmentationId1"); + SegmentationAssignment segmentationAssignment2 = new SegmentationAssignment(); + segmentationAssignment2.setSegmentationId("segmentationId2"); + segmentationAssignments.add(segmentationAssignment1); + segmentationAssignments.add(segmentationAssignment2); + l3Network.getSegmentationAssignments().addAll(segmentationAssignments); + + AAIObjectMapper l3NetworkMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.L3Network v12L3Network = l3NetworkMapper.mapNetwork(l3Network); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiL3NetworkMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.L3Network network = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.L3Network.class); + + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12L3Network); + String jsonExpected = ow.writeValueAsString(network); + assertEquals(jsonExpected, jsonGenerated); + + } + + @Test + public void mapToAAISubNetsTest() throws Exception { + List<Subnet> subnets = new ArrayList<Subnet>(); + Subnet subnet1 = new Subnet(); + subnet1.setSubnetId("57e9a1ff-d14f-4071-a828-b19ae98eb2fc"); + subnet1.setSubnetName("subnetName"); + subnet1.setGatewayAddress("192.168.52.1"); + subnet1.setNetworkStartAddress("192.168.52.0"); + subnet1.setCidrMask("24"); + subnet1.setIpVersion("4"); + subnet1.setOrchestrationStatus(OrchestrationStatus.CREATED); + subnet1.setIpAssignmentDirection("true"); + subnet1.setDhcpEnabled(true); + subnet1.setDhcpStart("dhcpStart"); + subnet1.setDhcpEnd("dhcpEnd"); + subnet1.setSubnetRole("subnetRole"); + subnet1.setIpAssignmentDirection("true"); + subnet1.setSubnetSequence(new Integer(3)); + + List<HostRoute> hostRoutes = new ArrayList<HostRoute>(); + HostRoute hostRoute1 = new HostRoute(); + hostRoute1.setHostRouteId("string"); + hostRoute1.setRoutePrefix("192.10.16.0/24"); + hostRoute1.setNextHop("192.10.16.100/24"); + hostRoute1.setNextHopType("ip-address"); + HostRoute hostRoute2 = new HostRoute(); + hostRoute2.setHostRouteId("string"); + hostRoute2.setRoutePrefix("192.110.17.0/24"); + hostRoute2.setNextHop("192.110.17.110/24"); + hostRoute2.setNextHopType("ip-address"); + hostRoutes.add(hostRoute1); + hostRoutes.add(hostRoute2); + subnet1.getHostRoutes().addAll(hostRoutes); + + subnets.add(subnet1); + subnets.add(subnet1); + + AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.Subnets v12Subnets = aaiObjectMapper.mapToAAISubNets(subnets); + + assertEquals(subnets.get(0).getDhcpEnd(), v12Subnets.getSubnet().get(0).getDhcpEnd()); + assertEquals(subnets.get(0).getCidrMask(), v12Subnets.getSubnet().get(0).getCidrMask()); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSubnetsMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.Subnets subnet = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.Subnets.class); + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12Subnets); + String jsonExpected = ow.writeValueAsString(subnet); + assertEquals(jsonExpected, jsonGenerated); + } + + @Test + public void mapToAAICtagAssignmentListTest() throws Exception { + List<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>(); + CtagAssignment ctagAssignment1 = new CtagAssignment(); + ctagAssignment1.setVlanIdInner(1L); + ctagAssignments.add(ctagAssignment1); + + AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.CtagAssignments v12CtagAssingments = aaiObjectMapper.mapToAAICtagAssignmentList(ctagAssignments); + + assertEquals(ctagAssignments.get(0).getVlanIdInner(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner()); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiCtagAssingmentsMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.CtagAssignments ctagAssignment = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.CtagAssignments.class); + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12CtagAssingments); + String jsonExpected = ow.writeValueAsString(ctagAssignment); + assertEquals(jsonExpected, jsonGenerated); + } + + @Test + public void mapToAAISegmentationAssignmentListTest() throws Exception { + List<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>(); + SegmentationAssignment segmentationAssignment1 = new SegmentationAssignment(); + segmentationAssignment1.setSegmentationId("segmentationId1"); + SegmentationAssignment segmentationAssignment2 = new SegmentationAssignment(); + segmentationAssignment2.setSegmentationId("segmentationId2"); + segmentationAssignments.add(segmentationAssignment1); + segmentationAssignments.add(segmentationAssignment2); + + AAIObjectMapper aaiObjectMapper = new AAIObjectMapper(); + org.onap.aai.domain.yang.SegmentationAssignments v12SegmentationAssignments = aaiObjectMapper.mapToAAISegmentationAssignmentList(segmentationAssignments); + + assertEquals(segmentationAssignments.get(0).getSegmentationId(), v12SegmentationAssignments.getSegmentationAssignment().get(0).getSegmentationId()); + assertEquals(segmentationAssignments.get(1).getSegmentationId(), v12SegmentationAssignments.getSegmentationAssignment().get(1).getSegmentationId()); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiSegmentationAssignmentsMapped_to_aai.json"))); + ObjectMapper omapper = new ObjectMapper(); + org.onap.aai.domain.yang.SegmentationAssignments segmentationAssignment = omapper.readValue(jsonToCompare, + org.onap.aai.domain.yang.SegmentationAssignments.class); + ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter(); + String jsonGenerated = ow.writeValueAsString(v12SegmentationAssignments); + String jsonExpected = ow.writeValueAsString(segmentationAssignment); + assertEquals(jsonExpected, jsonGenerated); + + } + + @Test + public void mapVpnBindingTest() { + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("testVpnId"); + vpnBinding.setVpnName("testVpn"); + vpnBinding.setVpnPlatform("AVPN"); + vpnBinding.setCustomerVpnId("testCustomerVpnId"); + vpnBinding.setVpnType("testVpnType"); + vpnBinding.setVpnRegion("testVpnRegion"); + vpnBinding.setRouteDistinguisher("testRD"); + RouteTarget routeTarget = new RouteTarget(); + routeTarget.setRouteTargetRole("testRtRole"); + routeTarget.setGlobalRouteTarget("testGrt"); + vpnBinding.getRouteTargets().add(routeTarget); + + + org.onap.aai.domain.yang.VpnBinding expectedVpnBinding = new org.onap.aai.domain.yang.VpnBinding(); + expectedVpnBinding.setVpnId("testVpnId"); + expectedVpnBinding.setVpnName("testVpn"); + expectedVpnBinding.setVpnPlatform("AVPN"); + expectedVpnBinding.setCustomerVpnId("testCustomerVpnId"); + expectedVpnBinding.setVpnType("testVpnType"); + expectedVpnBinding.setVpnRegion("testVpnRegion"); + expectedVpnBinding.setRouteDistinguisher("testRD"); + + org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget(); + expectedRouteTarget.setRouteTargetRole("testRtRole"); + expectedRouteTarget.setGlobalRouteTarget("testGrt"); + + RouteTargets expectedRouteTargets = new RouteTargets(); + expectedRouteTargets.getRouteTarget().add(expectedRouteTarget); + + expectedVpnBinding.setRouteTargets(expectedRouteTargets); + + org.onap.aai.domain.yang.VpnBinding actualVpnBinding = aaiObjectMapper.mapVpnBinding(vpnBinding); + + assertThat(actualVpnBinding, sameBeanAs(expectedVpnBinding)); + } + + @Test + public void mapRouteTargetTest() { + RouteTarget routeTarget = new RouteTarget(); + routeTarget.setRouteTargetRole("testRtRole"); + routeTarget.setGlobalRouteTarget("testGrt"); + + org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget(); + expectedRouteTarget.setRouteTargetRole("testRtRole"); + expectedRouteTarget.setGlobalRouteTarget("testGrt"); + + org.onap.aai.domain.yang.RouteTarget actualRouteTarget = aaiObjectMapper.mapRouteTarget(routeTarget); + + assertThat(actualRouteTarget, sameBeanAs(expectedRouteTarget)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java new file mode 100644 index 0000000000..207b9f3f98 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java @@ -0,0 +1,227 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.network; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.adapters.nwrest.CreateNetworkError; +import org.onap.so.adapters.nwrest.CreateNetworkRequest; +import org.onap.so.adapters.nwrest.CreateNetworkResponse; +import org.onap.so.adapters.nwrest.DeleteNetworkError; +import org.onap.so.adapters.nwrest.DeleteNetworkRequest; +import org.onap.so.adapters.nwrest.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.QueryNetworkError; +import org.onap.so.adapters.nwrest.QueryNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkError; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkError; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.openstack.beans.NetworkRollback; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + +public class NetworkAdapterClientIT extends BaseTest{ + + private static final String TESTING_ID = "___TESTING___"; + private static final String AAI_NETWORK_ID = "test"; + private static final String REST_ENDPOINT = "/networks/rest/v1/networks"; + + private NetworkAdapterClientImpl client = new NetworkAdapterClientImpl(); + private ObjectMapper mapper = new ObjectMapper(); + + @BeforeClass + public static void setUp() { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void createNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + CreateNetworkRequest request = new CreateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateNetworkResponse mockResponse = new CreateNetworkResponse(); + mockResponse.setNetworkCreated(true); + stubFor(post(urlPathEqualTo(REST_ENDPOINT)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + CreateNetworkResponse response = client.createNetwork(request); + assertEquals("Testing CreateVfModule response", true, response.getNetworkCreated()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void createNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + CreateNetworkRequest request = new CreateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateNetworkError mockResponse = new CreateNetworkError(); + mockResponse.setMessage("Error in create network"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.createNetwork(request); + } + + @Test + public void deleteNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + DeleteNetworkRequest request = new DeleteNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteNetworkResponse mockResponse = new DeleteNetworkResponse(); + mockResponse.setNetworkDeleted(true); + + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + DeleteNetworkResponse response = client.deleteNetwork(AAI_NETWORK_ID, request); + assertEquals("Testing DeleteVfModule response", true, response.getNetworkDeleted()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void deleteNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + DeleteNetworkRequest request = new DeleteNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteNetworkError mockResponse = new DeleteNetworkError(); + mockResponse.setMessage("Error in delete network"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.deleteNetwork(AAI_NETWORK_ID, request); + } + + @Test + public void rollbackNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + RollbackNetworkRequest request = new RollbackNetworkRequest(); + NetworkRollback rollback = new NetworkRollback(); + rollback.setCloudId(TESTING_ID); + request.setNetworkRollback(rollback); + + RollbackNetworkResponse mockResponse = new RollbackNetworkResponse(); + mockResponse.setNetworkRolledBack(true); + + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + RollbackNetworkResponse response = client.rollbackNetwork(AAI_NETWORK_ID, request); + assertEquals("Testing DeleteVfModule response", true, response.getNetworkRolledBack()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void rollbackNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + RollbackNetworkRequest request = new RollbackNetworkRequest(); + NetworkRollback rollback = new NetworkRollback(); + rollback.setCloudId(TESTING_ID); + request.setNetworkRollback(rollback); + + RollbackNetworkError mockResponse = new RollbackNetworkError(); + mockResponse.setMessage("Error in rollback network"); + + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.rollbackNetwork(AAI_NETWORK_ID, request); + } + + @Test + public void queryNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + QueryNetworkResponse mockResponse = new QueryNetworkResponse(); + mockResponse.setNetworkExists(true); + + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + QueryNetworkResponse response = client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, "networkStackId", + true, "testRequestId", "serviceInstanceId"); + assertEquals("Testing QueryVfModule response", true, response.getNetworkExists()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void queryNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + QueryNetworkError mockResponse = new QueryNetworkError(); + mockResponse.setMessage("Error in query network"); + + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)).withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("networkStackId", equalTo("networkStackId")).withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.queryNetwork(AAI_NETWORK_ID, TESTING_ID, TESTING_ID, "networkStackId", + true, "testRequestId", "serviceInstanceId"); + } + + @Test + public void updateNetworkTest() throws NetworkAdapterClientException, JsonProcessingException { + UpdateNetworkRequest request = new UpdateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + request.setNetworkId("test1"); + + UpdateNetworkResponse mockResponse = new UpdateNetworkResponse(); + mockResponse.setNetworkId("test1"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + UpdateNetworkResponse response = client.updateNetwork(AAI_NETWORK_ID, request); + assertEquals("Testing UpdateVfModule response", "test1", response.getNetworkId()); + } + + @Test(expected = NetworkAdapterClientException.class) + public void updateNetworkTestThrowException() throws NetworkAdapterClientException, JsonProcessingException { + UpdateNetworkRequest request = new UpdateNetworkRequest(); + request.setCloudSiteId(TESTING_ID); + request.setNetworkId("test1"); + + UpdateNetworkError mockResponse = new UpdateNetworkError(); + mockResponse.setMessage("Error in update network"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.updateNetwork(AAI_NETWORK_ID, request); + } +} 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 new file mode 100644 index 0000000000..96fbe7ffb7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java @@ -0,0 +1,301 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.network.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.mockito.Mockito.doReturn; + +import java.io.UnsupportedEncodingException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +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.ProviderVlanNetwork; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.NetworkRollback; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class NetworkAdapterObjectMapperTest extends TestDataSetup{ + + private NetworkAdapterObjectMapper SPY_networkAdapterObjectMapper = Mockito.spy(NetworkAdapterObjectMapper.class); + + private L3Network l3Network; + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Customer customer; + Map<String, String> userInput; + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/NetworkMapper/"; + + @Before + public void before() { + requestContext = setRequestContext(); + + customer = buildCustomer(); + + serviceInstance = setServiceInstance(); + + cloudRegion = setCloudRegion(); + + orchestrationContext = setOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + userInput = setUserInput(); + + l3Network = setL3Network(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + } + + @Test + public void buildCreateNetworkRequestFromBbobjectTest() throws Exception { + + String cloudRegionPo = "cloudRegionPo"; + CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest(); + + expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo); + expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId()); + expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName()); + expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType()); + expectedCreateNetworkRequest.setBackout(false); + expectedCreateNetworkRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateNetworkRequest.setMsoRequest(msoRequest); + expectedCreateNetworkRequest.setSkipAAI(true); + + Subnet openstackSubnet = new Subnet(); + HostRoute hostRoute = new HostRoute(); + hostRoute.setHostRouteId("hostRouteId"); + hostRoute.setNextHop("nextHop"); + hostRoute.setRoutePrefix("routePrefix"); + openstackSubnet.getHostRoutes().add(hostRoute); + List<Subnet> subnetList = new ArrayList<Subnet>(); + subnetList.add(openstackSubnet); + l3Network.getSubnets().add(openstackSubnet); + + 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")); + } + + @Test + public void createNetworkRollbackRequestMapperTest() throws Exception { + + String cloudRegionPo = "cloudRegionPo"; + RollbackNetworkRequest expectedRollbackNetworkRequest = new RollbackNetworkRequest(); + + expectedRollbackNetworkRequest.setMessageId(requestContext.getMsoRequestId()); + NetworkRollback networkRollback = new NetworkRollback(); + networkRollback.setCloudId(cloudRegionPo); + networkRollback.setNetworkCreated(true); + networkRollback.setNetworkId(l3Network.getNetworkId()); + networkRollback.setNetworkType(l3Network.getNetworkType()); + networkRollback.setTenantId(cloudRegion.getTenantId()); + expectedRollbackNetworkRequest.setNetworkRollback(networkRollback); + expectedRollbackNetworkRequest.setSkipAAI(true); + + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setNetworkCreated(true); + + RollbackNetworkRequest rollbackNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + + assertThat(rollbackNetworkRequest, sameBeanAs(expectedRollbackNetworkRequest).ignoring("contrailNetwork").ignoring("providerVlanNetwork").ignoring("subnets").ignoring("networkParams").ignoring("messageId")); + } + + @Test + public void updateNetworkRequestMapperTest() throws UnsupportedEncodingException { + org.onap.so.openstack.beans.Subnet subnet = new org.onap.so.openstack.beans.Subnet(); + subnet.setSubnetId("subnetId"); + subnet.setHostRoutes(new ArrayList<org.onap.so.openstack.beans.HostRoute>()); + + List<org.onap.so.openstack.beans.Subnet> subnets = new ArrayList<>(); + subnets.add(subnet); + + ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("physicalNetworkName", new ArrayList<Integer>()); + + List<String> policyFqdns = Arrays.asList("networkPolicyFqdn"); + + org.onap.so.openstack.beans.RouteTarget expectedRouteTarget = new org.onap.so.openstack.beans.RouteTarget(); + expectedRouteTarget.setRouteTarget("globalRouteTarget"); + + ContrailNetwork contrailNetwork = new ContrailNetwork(); + contrailNetwork.setPolicyFqdns(policyFqdns); + contrailNetwork.setRouteTableFqdns(new ArrayList<String>()); + contrailNetwork.setRouteTargets(new ArrayList<org.onap.so.openstack.beans.RouteTarget>()); + contrailNetwork.getRouteTargets().add(expectedRouteTarget); + contrailNetwork.getRouteTableFqdns().add("routeTableReferenceFqdn"); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setServiceInstanceId("testServiceInstanceId1"); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setNetworkType("networkType"); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid"); + modelInfoNetwork.setModelVersion("modelVersion"); + + Subnet actualSubnet = new Subnet(); + actualSubnet.setSubnetId("subnetId"); + actualSubnet.setIpVersion("4"); + + RouteTarget routeTarget = new RouteTarget(); + routeTarget.setGlobalRouteTarget("globalRouteTarget"); + + VpnBinding vpnBinding = new VpnBinding(); + vpnBinding.setVpnId("vpnId"); + vpnBinding.getRouteTargets().add(routeTarget); + + Customer customer = new Customer(); + customer.getVpnBindings().add(vpnBinding); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + customer.setServiceSubscription(serviceSubscription); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + NetworkPolicy networkPolicy = new NetworkPolicy(); + networkPolicy.setNetworkPolicyId("networkPolicyId"); + networkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn"); + + RouteTableReference routeTableReference = new RouteTableReference(); + routeTableReference.setRouteTableReferenceFqdn("routeTableReferenceFqdn"); + + l3Network.setModelInfoNetwork(modelInfoNetwork); + l3Network.setPhysicalNetworkName("physicalNetworkName"); + l3Network.getSubnets().add(actualSubnet); + l3Network.getNetworkPolicies().add(networkPolicy); + l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference); + + UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest(); + expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + expectedUpdateNetworkRequest.setTenantId(cloudRegion.getTenantId()); + expectedUpdateNetworkRequest.setNetworkId(l3Network.getNetworkId()); + expectedUpdateNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + expectedUpdateNetworkRequest.setNetworkName(l3Network.getNetworkName()); + expectedUpdateNetworkRequest.setNetworkType(l3Network.getModelInfoNetwork().getNetworkType()); + expectedUpdateNetworkRequest.setNetworkTypeVersion(l3Network.getModelInfoNetwork().getModelVersion()); + expectedUpdateNetworkRequest.setModelCustomizationUuid(l3Network.getModelInfoNetwork().getModelCustomizationUUID()); + expectedUpdateNetworkRequest.setSubnets(subnets); + expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork); + expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork); + expectedUpdateNetworkRequest.setNetworkParams(userInput); + expectedUpdateNetworkRequest.setMsoRequest(msoRequest); + expectedUpdateNetworkRequest.setSkipAAI(true); + expectedUpdateNetworkRequest.setBackout(!Boolean.valueOf(orchestrationContext.getIsRollbackEnabled())); + expectedUpdateNetworkRequest.setMessageId("messageId"); + expectedUpdateNetworkRequest.setNotificationUrl("http://localhost:28080/mso/WorkflowMesssage/NetworkAResponse/messageId"); + + doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid(); + doReturn("http://localhost:28080/mso/WorkflowMesssage").when(SPY_networkAdapterObjectMapper).getEndpoint(); + UpdateNetworkRequest actualUpdateNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer); + + assertThat(actualUpdateNetworkRequest, sameBeanAs(expectedUpdateNetworkRequest).ignoring("msoRequest.requestId")); + } + + @Test + public void deleteNetworkRequestMapperTest() throws Exception { + DeleteNetworkRequest expectedDeleteNetworkRequest = new DeleteNetworkRequest(); + + String messageId = "messageId"; + expectedDeleteNetworkRequest.setMessageId(messageId); + doReturn(messageId).when(SPY_networkAdapterObjectMapper).getRandomUuid(); + + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + l3Network.setModelInfoNetwork(modelInfoNetwork); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid"); + expectedDeleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID()); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedDeleteNetworkRequest.setMsoRequest(msoRequest); + + expectedDeleteNetworkRequest.setNetworkId(l3Network.getNetworkId()); + + l3Network.setHeatStackId("heatStackId"); + expectedDeleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId()); + + expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType()); + + expectedDeleteNetworkRequest.setSkipAAI(true); + + expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId()); + + expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + + DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + + assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest)); + } + + @Test + public void buildOpenstackSubnetListTest() throws Exception { + + ObjectMapper omapper = new ObjectMapper(); + String bbJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "generalBB.json"))); + org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock gbb = omapper.readValue( + bbJson, + org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock.class); + L3Network myNetwork = gbb.getServiceInstance().getNetworks().get(0); + + String expectedCreateNetworkRequestJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "createNetworkRequest.json"))); + org.onap.so.adapters.nwrest.CreateNetworkRequest expectedCreateNetworkRequest = omapper.readValue( + expectedCreateNetworkRequestJson, + org.onap.so.adapters.nwrest.CreateNetworkRequest.class); + + String cloudRegionPo = "cloudRegionPo"; + CreateNetworkRequest createNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, myNetwork, userInput, cloudRegionPo, customer); + //ignoring dynamic fields and networkParams that throws parsing exception on json file load + assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("messageId").ignoring("msoRequest.requestId").ignoring("networkParams")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java new file mode 100644 index 0000000000..85f787faa7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java @@ -0,0 +1,224 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.vnf; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.equalTo; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.put; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertEquals; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.so.BaseTest; +import org.onap.so.adapters.vnfrest.CreateVfModuleRequest; +import org.onap.so.adapters.vnfrest.CreateVfModuleResponse; +import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest; +import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse; +import org.onap.so.adapters.vnfrest.QueryVfModuleResponse; +import org.onap.so.adapters.vnfrest.RollbackVfModuleRequest; +import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse; +import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest; +import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse; +import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse; +import org.onap.so.adapters.vnfrest.VfModuleRollback; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VnfAdapterClientIT extends BaseTest{ + + private static final String TESTING_ID = "___TESTING___"; + private static final String AAI_VNF_ID = "test"; + private static final String AAI_VF_MODULE_ID = "test"; + private static final String REST_ENDPOINT = "/services/rest/v1/vnfs"; + + private VnfAdapterClientImpl client = new VnfAdapterClientImpl(); + private ObjectMapper mapper = new ObjectMapper(); + + @BeforeClass + public static void setUp() { + System.setProperty("mso.config.path", "src/test/resources"); + } + + @Test + public void createVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + CreateVfModuleRequest request = new CreateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateVfModuleResponse mockResponse = new CreateVfModuleResponse(); + mockResponse.setVfModuleCreated(true); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + CreateVfModuleResponse response = client.createVfModule(AAI_VNF_ID, request); + assertEquals("Testing CreateVfModule response", true, response.getVfModuleCreated()); + } + + @Test(expected = VnfAdapterClientException.class) + public void createVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + CreateVfModuleRequest request = new CreateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in create Vf module"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.createVfModule(AAI_VNF_ID, request); + } + + @Test + public void rollbackVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + RollbackVfModuleRequest request = new RollbackVfModuleRequest(); + VfModuleRollback rollback = new VfModuleRollback(); + rollback.setCloudSiteId(TESTING_ID); + request.setVfModuleRollback(rollback); + + RollbackVfModuleResponse mockResponse = new RollbackVfModuleResponse(); + mockResponse.setVfModuleRolledback(true); + stubFor( + post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + RollbackVfModuleResponse response = client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + assertEquals("Testing RollbackVfModule response", true, response.getVfModuleRolledback()); + } + + @Test(expected = VnfAdapterClientException.class) + public void rollbackVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + RollbackVfModuleRequest request = new RollbackVfModuleRequest(); + VfModuleRollback rollback = new VfModuleRollback(); + rollback.setCloudSiteId(TESTING_ID); + request.setVfModuleRollback(rollback); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in rollback Vf module"); + stubFor( + post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID + "/rollback")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.rollbackVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + } + + @Test + public void deleteVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + DeleteVfModuleRequest request = new DeleteVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteVfModuleResponse mockResponse = new DeleteVfModuleResponse(); + mockResponse.setVfModuleDeleted(true); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + DeleteVfModuleResponse response = client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + assertEquals("Testing DeleteVfModule response", true, response.getVfModuleDeleted()); + } + + @Test(expected = VnfAdapterClientException.class) + public void deleteVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + DeleteVfModuleRequest request = new DeleteVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in delete Vf module"); + stubFor(post(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.deleteVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + } + + @Test + public void updateVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + UpdateVfModuleRequest request = new UpdateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + request.setVfModuleId("test1"); + + UpdateVfModuleResponse mockResponse = new UpdateVfModuleResponse(); + mockResponse.setVfModuleId("test1"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + + UpdateVfModuleResponse response = client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + assertEquals("Testing UpdateVfModule response", "test1", response.getVfModuleId()); + } + + @Test(expected = VnfAdapterClientException.class) + public void updateVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + UpdateVfModuleRequest request = new UpdateVfModuleRequest(); + request.setCloudSiteId(TESTING_ID); + request.setVfModuleId("test1"); + + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in update Vf module"); + stubFor(put(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + + client.updateVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, request); + } + + @Test + public void queryVfModuleTest() throws JsonProcessingException, VnfAdapterClientException { + QueryVfModuleResponse mockResponse = new QueryVfModuleResponse(); + mockResponse.setVnfId(AAI_VNF_ID); + mockResponse.setVfModuleId(AAI_VF_MODULE_ID); + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("vfModuleName", equalTo("someName")) + .withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(200))); + QueryVfModuleResponse response = client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID, + "someName", true, "testRequestId", "serviceInstanceId"); + assertEquals("Testing QueryVfModule response", AAI_VF_MODULE_ID, response.getVfModuleId()); + } + + @Test(expected = VnfAdapterClientException.class) + public void queryVfModuleTestThrowException() throws JsonProcessingException, VnfAdapterClientException { + VfModuleExceptionResponse mockResponse = new VfModuleExceptionResponse(); + mockResponse.setMessage("Error in update Vf module"); + stubFor(get(urlPathEqualTo(REST_ENDPOINT + "/" + AAI_VNF_ID + "/vf-modules/" + AAI_VF_MODULE_ID)) + .withQueryParam("cloudSiteId", equalTo(TESTING_ID)) + .withQueryParam("tenantId", equalTo(TESTING_ID)) + .withQueryParam("vfModuleName", equalTo("someName")) + .withQueryParam("skipAAI", equalTo("true")) + .withQueryParam("msoRequest.requestId", equalTo("testRequestId")) + .withQueryParam("msoRequest.serviceInstanceId", equalTo("serviceInstanceId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(mapper.writeValueAsString(mockResponse)).withStatus(500))); + client.queryVfModule(AAI_VNF_ID, AAI_VF_MODULE_ID, TESTING_ID, TESTING_ID, + "someName", true, "testRequestId", "serviceInstanceId"); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java new file mode 100644 index 0000000000..b356b21de4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java @@ -0,0 +1,214 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.vnf; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; + +import javax.ws.rs.InternalServerErrorException; +import javax.ws.rs.core.UriBuilder; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockitoAnnotations; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.BaseTest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse; +import org.onap.so.client.adapter.rest.AdapterRestClient; + + +@RunWith(MockitoJUnitRunner.class) +public class VnfVolumeAdapterClientIT extends BaseTest{ + + private static final String TESTING_ID = "___TESTING___"; + private static final String AAI_VOLUME_GROUP_ID = "test"; + private static final String CLOUD_SITE_ID = "test"; + private static final String TENANT_ID = "test"; + private static final String VOLUME_GROUP_STACK_ID = "test"; + private static final boolean SKIP_AAI = true; + private static final String REQUEST_ID = "test"; + private static final String SERVICE_INSTANCE_ID = "test"; + + @Test + public void createVolumeGroupTest() throws VnfAdapterClientException { + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateVolumeGroupResponse mockResponse = new CreateVolumeGroupResponse(); + mockResponse.setVolumeGroupCreated(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + + doReturn(mockClient).when(client).getAdapterRestClient(""); + when(mockClient.post(request, CreateVolumeGroupResponse.class)).thenReturn(mockResponse); + + CreateVolumeGroupResponse response = client.createVNFVolumes(request); + assertEquals("Testing CreateVolumeGroup response", mockResponse.getVolumeGroupCreated(), + response.getVolumeGroupCreated()); + } + + @Test(expected = VnfAdapterClientException.class) + public void createVolumeGroupTestThrowException() throws VnfAdapterClientException { + CreateVolumeGroupRequest request = new CreateVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + CreateVolumeGroupResponse mockResponse = new CreateVolumeGroupResponse(); + mockResponse.setVolumeGroupCreated(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + + doReturn(mockClient).when(client).getAdapterRestClient(""); + when(mockClient.post(request, CreateVolumeGroupResponse.class)).thenThrow(new InternalServerErrorException("Error in create volume group")); + + client.createVNFVolumes(request); + } + + @Test + public void deleteVolumeGroupTest() throws VnfAdapterClientException { + DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteVolumeGroupResponse mockResponse = new DeleteVolumeGroupResponse(); + mockResponse.setVolumeGroupDeleted(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.delete(request, DeleteVolumeGroupResponse.class)).thenReturn(mockResponse); + MockitoAnnotations.initMocks(this); + + DeleteVolumeGroupResponse response = client.deleteVNFVolumes(AAI_VOLUME_GROUP_ID, request); + assertEquals("Testing DeleteVolumeGroup response", mockResponse.getVolumeGroupDeleted(), + response.getVolumeGroupDeleted()); + } + + @Test(expected = VnfAdapterClientException.class) + public void deleteVolumeGroupTestThrowException() throws VnfAdapterClientException { + DeleteVolumeGroupRequest request = new DeleteVolumeGroupRequest(); + request.setCloudSiteId(TESTING_ID); + + DeleteVolumeGroupResponse mockResponse = new DeleteVolumeGroupResponse(); + mockResponse.setVolumeGroupDeleted(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.delete(request, DeleteVolumeGroupResponse.class)) + .thenThrow(new InternalServerErrorException("Error in delete volume group")); + MockitoAnnotations.initMocks(this); + + client.deleteVNFVolumes(AAI_VOLUME_GROUP_ID, request); + } + + @Test + public void rollbackVolumeGroupTest() throws VnfAdapterClientException { + RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest(); + + RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse(); + mockResponse.setVolumeGroupRolledBack(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback"); + when(mockClient.delete(request, RollbackVolumeGroupResponse.class)).thenReturn(mockResponse); + MockitoAnnotations.initMocks(this); + + RollbackVolumeGroupResponse response = client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request); + assertEquals("Testing RollbackVolumeGroup response", mockResponse.getVolumeGroupRolledBack(), + response.getVolumeGroupRolledBack()); + } + + @Test(expected = VnfAdapterClientException.class) + public void rollbackVolumeGroupTestThrowException() throws VnfAdapterClientException { + RollbackVolumeGroupRequest request = new RollbackVolumeGroupRequest(); + + RollbackVolumeGroupResponse mockResponse = new RollbackVolumeGroupResponse(); + mockResponse.setVolumeGroupRolledBack(true); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID + "/rollback"); + when(mockClient.delete(request, RollbackVolumeGroupResponse.class)) + .thenThrow(new InternalServerErrorException("Error in rollback volume group")); + MockitoAnnotations.initMocks(this); + + client.rollbackVNFVolumes(AAI_VOLUME_GROUP_ID, request); + } + + @Test + public void updateVolumeGroupTest() throws VnfAdapterClientException { + UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest(); + + UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse(); + mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.put(request, UpdateVolumeGroupResponse.class)).thenReturn(mockResponse); + MockitoAnnotations.initMocks(this); + + UpdateVolumeGroupResponse response = client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request); + assertEquals("Testing DeleteVfModule response", mockResponse.getVolumeGroupId(), response.getVolumeGroupId()); + } + + @Test(expected = VnfAdapterClientException.class) + public void updateVolumeGroupTestThrowException() throws VnfAdapterClientException { + UpdateVolumeGroupRequest request = new UpdateVolumeGroupRequest(); + + UpdateVolumeGroupResponse mockResponse = new UpdateVolumeGroupResponse(); + mockResponse.setVolumeGroupId(AAI_VOLUME_GROUP_ID); + + VnfVolumeAdapterClientImpl client = spy(VnfVolumeAdapterClientImpl.class); + AdapterRestClient mockClient = mock(AdapterRestClient.class); + doReturn(mockClient).when(client).getAdapterRestClient("/" + AAI_VOLUME_GROUP_ID); + when(mockClient.put(request, UpdateVolumeGroupResponse.class)) + .thenThrow(new InternalServerErrorException("Error in update volume group")); + MockitoAnnotations.initMocks(this); + + client.updateVNFVolumes(AAI_VOLUME_GROUP_ID, request); + } + + public void buildQueryPathTest() { + String expectedOutput = "/" + AAI_VOLUME_GROUP_ID + "?cloudSiteId=" + CLOUD_SITE_ID + "&tenantId=" + TENANT_ID + + "&volumeGroupStackId=" + VOLUME_GROUP_STACK_ID + "&skipAAI=" + SKIP_AAI + "&msoRequest.requestId=" + + REQUEST_ID + "&msoRequest.serviceInstanceId=" + SERVICE_INSTANCE_ID; + VnfVolumeAdapterClientImpl client = new VnfVolumeAdapterClientImpl(); + assertEquals("Test build query path", expectedOutput, client.buildQueryPath(AAI_VOLUME_GROUP_ID, CLOUD_SITE_ID, + TENANT_ID, VOLUME_GROUP_STACK_ID, SKIP_AAI, REQUEST_ID, SERVICE_INSTANCE_ID)); + } + + protected UriBuilder getUri(String path) { + return UriBuilder.fromPath(path); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java new file mode 100644 index 0000000000..df48596893 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterRestPropertiesTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.vnf; + +import static org.junit.Assert.assertEquals; + +import java.net.MalformedURLException; + +import org.junit.Test; + +public class VnfVolumeAdapterRestPropertiesTest{ + private VnfVolumeAdapterRestProperties props = new VnfVolumeAdapterRestProperties(); + + @Test + public void testGetAuth(){ + assertEquals("mso.adapters.po.auth", VnfVolumeAdapterRestProperties.authProp); + } + + @Test + public void testGetKey(){ + assertEquals("mso.msoKey", VnfVolumeAdapterRestProperties.keyProp); + } + + @Test + public void testGetUrl() throws MalformedURLException{ + assertEquals("mso.adapters.volume-groups.rest.endpoint", VnfVolumeAdapterRestProperties.endpointProp); + } +} 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 new file mode 100644 index 0000000000..25149aea13 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java @@ -0,0 +1,372 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.vnf.mapper; + +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.reset; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.mockito.MockitoAnnotations; +import org.mockito.Spy; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.entity.MsoRequest; + +public class VnfAdapterObjectMapperTest { + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + @Spy + private VnfAdapterObjectMapper vnfAdapterObjectMapper = new VnfAdapterObjectMapper(); + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + + } + + @After + public void after() { + reset(vnfAdapterObjectMapper); + } + + @Test + public void test_createVolumeGroupRequestMapper() throws Exception { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + genericVnf.setVnfType("vnfType"); + serviceInstance.getVnfs().add(genericVnf); + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelName("modelName"); + modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID"); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + volumeGroup.setModelInfoVfModule(modelInfoVfModule); + + serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup); + + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest(); + + expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName()); + expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType()); + expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName()); + expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + + Map<String, String> volumeGroupParams = new HashMap<>(); + volumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + volumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + volumeGroupParams.put("paramOne", "paramOneValue"); + volumeGroupParams.put("paramTwo", "paramTwoValue"); + volumeGroupParams.put("paramThree", "paramThreeValue"); + expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams); + + expectedCreateVolumeGroupRequest.setSkipAAI(true); + expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled()); + expectedCreateVolumeGroupRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest); + + expectedCreateVolumeGroupRequest.setMessageId("messageId"); + expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId"); + + doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class)); + doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid(); + + CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); + } + + @Test + public void test_createVolumeGroupRequestMapper_for_alaCarte_flow() throws Exception { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + genericVnf.setVnfType("vnfType"); + serviceInstance.getVnfs().add(genericVnf); + + + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelName("modelName"); + modelInfoVfModule.setModelCustomizationUUID("modelCustomizationUUID"); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + volumeGroup.setModelInfoVfModule(modelInfoVfModule); + serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + CreateVolumeGroupRequest expectedCreateVolumeGroupRequest = new CreateVolumeGroupRequest(); + + expectedCreateVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + expectedCreateVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + expectedCreateVolumeGroupRequest.setVolumeGroupName(volumeGroup.getVolumeGroupName()); + expectedCreateVolumeGroupRequest.setVnfType(genericVnf.getVnfType()); + expectedCreateVolumeGroupRequest.setVnfVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion()); + expectedCreateVolumeGroupRequest.setVfModuleType(volumeGroup.getModelInfoVfModule().getModelName()); + expectedCreateVolumeGroupRequest.setModelCustomizationUuid(volumeGroup.getModelInfoVfModule().getModelCustomizationUUID()); + + Map<String, String> volumeGroupParams = new HashMap<>(); + volumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + volumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + volumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + volumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + + expectedCreateVolumeGroupRequest.setVolumeGroupParams(volumeGroupParams); + + expectedCreateVolumeGroupRequest.setSkipAAI(true); + expectedCreateVolumeGroupRequest.setSuppressBackout(orchestrationContext.getIsRollbackEnabled()); + expectedCreateVolumeGroupRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateVolumeGroupRequest.setMsoRequest(msoRequest); + + expectedCreateVolumeGroupRequest.setMessageId("messageId"); + expectedCreateVolumeGroupRequest.setNotificationUrl("endpoint/VNFAResponse/messageId"); + + doReturn("endpoint/").when(vnfAdapterObjectMapper).getProperty(isA(String.class)); + doReturn("messageId").when(vnfAdapterObjectMapper).getRandomUuid(); + + CreateVolumeGroupRequest actualCreateVolumeGroupRequest = vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, null); + + assertThat(actualCreateVolumeGroupRequest, sameBeanAs(expectedCreateVolumeGroupRequest)); + } + + @Test + public void test_deleteVolumeGroupRequestMapper() throws Exception { + DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest(); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("lcpCloudRegionId"); + expectedDeleteVolumeGroupRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId()); + + cloudRegion.setTenantId("tenantId"); + expectedDeleteVolumeGroupRequest.setTenantId(cloudRegion.getTenantId()); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + expectedDeleteVolumeGroupRequest.setVolumeGroupId(volumeGroup.getVolumeGroupId()); + + volumeGroup.setHeatStackId("heatStackId"); + expectedDeleteVolumeGroupRequest.setVolumeGroupStackId(volumeGroup.getHeatStackId()); + + expectedDeleteVolumeGroupRequest.setSkipAAI(true); + + MsoRequest msoRequest = new MsoRequest(); + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedDeleteVolumeGroupRequest.setMsoRequest(msoRequest); + + String messageId = "messageId"; + String endpoint = "endpoint"; + doReturn(messageId).when(vnfAdapterObjectMapper).getRandomUuid(); + doReturn(endpoint).when(vnfAdapterObjectMapper).getProperty(isA(String.class)); + expectedDeleteVolumeGroupRequest.setMessageId(messageId); + expectedDeleteVolumeGroupRequest.setNotificationUrl(endpoint + "/VNFAResponse/" + messageId); + + DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); + + assertThat(actualDeleteVolumeGroupRequest, sameBeanAs(expectedDeleteVolumeGroupRequest)); + } + + @Test + public void test_createVolumeGroupParams() throws Exception { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + + RequestContext requestContext = new RequestContext(); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + Map<String, String> expectedVolumeGroupParams = new HashMap<>(); + expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + expectedVolumeGroupParams.put("paramOne", "paramOneValue"); + expectedVolumeGroupParams.put("paramTwo", "paramTwoValue"); + expectedVolumeGroupParams.put("paramThree", "paramThreeValue"); + + Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); + } + + @Test + public void test_createVolumeGroupParams_without_sdncResponse() throws Exception { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + Map<String, String> expectedVolumeGroupParams = new HashMap<>(); + expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + RequestContext requestContext = new RequestContext(); + Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, null); + + assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); + } + + @Test + public void test_createVolumeGroupParams_with_user_params() throws Exception { + GenericVnf genericVnf = new GenericVnf(); + genericVnf.setVnfId("vnfId"); + genericVnf.setVnfName("vnfName"); + + RequestContext requestContext = new RequestContext(); + Map<String, Object> userParamsMap = new HashMap<>(); + userParamsMap.put("name", "userParamKey"); + userParamsMap.put("value", "userParamValue"); + List<Map<String, Object>> userParams = new ArrayList<>(); + userParams.add(userParamsMap); + RequestParameters requestParameters = new RequestParameters(); + requestParameters.setUserParams(userParams); + requestContext.setRequestParameters(requestParameters); + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + Map<String, String> expectedVolumeGroupParams = new HashMap<>(); + expectedVolumeGroupParams.put("vnf_id", genericVnf.getVnfId()); + expectedVolumeGroupParams.put("vnf_name", genericVnf.getVnfName()); + expectedVolumeGroupParams.put("vf_module_id", volumeGroup.getVolumeGroupId()); + expectedVolumeGroupParams.put("vf_module_name", volumeGroup.getVolumeGroupName()); + expectedVolumeGroupParams.put("paramOne", "paramOneValue"); + expectedVolumeGroupParams.put("paramTwo", "paramTwoValue"); + expectedVolumeGroupParams.put("paramThree", "paramThreeValue"); + expectedVolumeGroupParams.put("userParamKey", "userParamValue"); + + Map<String, String> actualVolumeGroupParams = vnfAdapterObjectMapper.createVolumeGroupParams(requestContext,genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertEquals(expectedVolumeGroupParams, actualVolumeGroupParams); + } + + @Test + public void test_createMsoRequest() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("msoRequestId"); + + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + MsoRequest expectedMsoRequest = new MsoRequest(); + expectedMsoRequest.setRequestId(requestContext.getMsoRequestId()); + expectedMsoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + + MsoRequest actualMsoRequest = vnfAdapterObjectMapper.createMsoRequest(requestContext, serviceInstance); + + assertThat(expectedMsoRequest, sameBeanAs(actualMsoRequest)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java new file mode 100644 index 0000000000..bbc5e56141 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperIntegrationTest.java @@ -0,0 +1,449 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.adapter.vnf.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Test; +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.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; + +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VnfAdapterVfModuleObjectMapperIntegrationTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + @Test + public void createVfModuleRequestMapperTest() 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); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + 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"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequest.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperWithCloudResourcesTest() 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); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestWithCloudResources.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperDhcpDisabledTest() 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); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestDhcpDisabled.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void createVfModuleRequestMapperMultipleDhcpTest() 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); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + String sdncVnfQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json"))); + String sdncVfModuleQueryResponse = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleSdncVfModuleTopology.json"))); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + CreateVfModuleRequest vfModuleVNFAdapterRequest = mapper.createVfModuleRequestMapper( + requestContext, cloudRegion, orchestrationContext, serviceInstance, + vnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterCreateVfModuleRequestMultipleDhcp.json"))); + + ObjectMapper omapper = new ObjectMapper(); + CreateVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + CreateVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } + + @Test + public void DeleteVfModuleRequestMapperTest() throws Exception { + 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); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + 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); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("vfModuleId"); + vfModule.setVfModuleName("vfModuleName"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + cloudRegion.setLcpCloudRegionId("cloudRegionId"); + cloudRegion.setTenantId("tenantId"); + + OrchestrationContext orchestrationContext = new OrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(false); + + VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + mapper.vnfAdapterObjectMapperUtils = new VnfAdapterObjectMapperUtils(); + + DeleteVfModuleRequest vfModuleVNFAdapterRequest = mapper.deleteVfModuleRequestMapper( + requestContext, cloudRegion, serviceInstance, + vnf, vfModule); + + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "vnfAdapterDeleteVfModuleRequest.json"))); + + ObjectMapper omapper = new ObjectMapper(); + DeleteVfModuleRequest reqMapper1 = omapper.readValue( + jsonToCompare, + DeleteVfModuleRequest.class); + + assertThat(vfModuleVNFAdapterRequest, sameBeanAs(reqMapper1).ignoring("messageId").ignoring("notificationUrl")); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java new file mode 100644 index 0000000000..c8f4a222f3 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapperTest.java @@ -0,0 +1,67 @@ +/*- + * ============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.client.adapter.vnf.mapper; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; + +public class VnfAdapterVfModuleObjectMapperTest{ + + private VnfAdapterVfModuleObjectMapper mapper = new VnfAdapterVfModuleObjectMapper(); + + @Test + public void createVnfcSubInterfaceKeyTest() { + + assertEquals("type_0_subint_role_port_0", mapper.createVnfcSubInterfaceKey("type", 0, "role", 0)); + } + + @Test + public void createGlobalVnfcSubInterfaceKeyTest() { + + assertEquals("type_subint_role_port_0", mapper.createGlobalVnfcSubInterfaceKey("type", "role", 0)); + } + + @Test + public void addPairToMapTest() { + Map<String, String> map = new HashMap<>(); + + mapper.addPairToMap(map, "test", "_key", Arrays.asList("a", "b")); + + assertEquals("a,b", map.get("test_key")); + + mapper.addPairToMap(map, "test", "_key2", Arrays.asList()); + + assertThat(map.containsKey("test_key2"), equalTo(false)); + + mapper.addPairToMap(map, "test", "_key3", "myVal"); + + assertEquals("myVal", map.get("test_key3")); + + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java new file mode 100644 index 0000000000..fff4fc72fb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAICollectionResourcesTest.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +@RunWith(MockitoJUnitRunner.class) +public class AAICollectionResourcesTest extends TestDataSetup{ + + @InjectMocks + private AAICollectionResources aaiCollectionResources = new AAICollectionResources(); + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + private Collection networkCollection; + + @Before + public void before() { + networkCollection = buildCollection(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createCollectionTest() throws Exception { + networkCollection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection); + + aaiCollectionResources.createCollection(networkCollection); + + assertEquals(OrchestrationStatus.INVENTORIED, networkCollection.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).create(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), isA(org.onap.aai.domain.yang.Collection.class)); + } + + @Test + public void updateCollectionTest() throws Exception { + doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(networkCollection); + aaiCollectionResources.updateCollection(networkCollection); + verify(MOCK_aaiResourcesClient, times(1)).update(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId())), isA(org.onap.aai.domain.yang.Collection.class)); + } + + @Test + public void deleteCollectionTest() throws Exception { + aaiCollectionResources.deleteCollection(networkCollection); + verify(MOCK_aaiResourcesClient, times(1)).delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, networkCollection.getId()))); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java new file mode 100644 index 0000000000..cc48c46508 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java @@ -0,0 +1,180 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.bpmn.common.data.TestDataSetup; + + +@RunWith(MockitoJUnitRunner.class) +public class AAIConfigurationResourcesTest extends TestDataSetup{ + + + + private Configuration configuration; + private ServiceProxy serviceProxy; + private ServiceInstance serviceInstance; + private GenericVnf genericVnf; + private VpnBinding vpnBinding; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + private AAIConfigurationResources aaiConfigurationResources = new AAIConfigurationResources(); + + @Before + public void before() { + configuration = buildConfiguration(); + serviceProxy = buildServiceProxy(); + serviceInstance = buildServiceInstance(); + genericVnf = buildGenericVnf(); + vpnBinding = buildVpnBinding(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createConfigurationTest() { + doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper).mapConfiguration(configuration); + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); + + aaiConfigurationResources.createConfiguration(configuration); + + assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); + } + + @Test + public void updateConfigurationTest() { + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class)); + configuration.setConfigurationType("VNR"); + configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE); + aaiConfigurationResources.updateConfiguration(configuration); + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Configuration.class)); + } + + @Test + public void connectConfigurationToServiceInstanceTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToServiceInstance(configuration.getConfigurationId(), serviceInstance.getServiceInstanceId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void disconnectConfigurationToServiceInstanceTest(){ + doNothing().when(MOCK_aaiResourcesClient).disconnect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.disconnectConfigurationToServiceInstance("TEST_CONFIGURATION_ID", "TEST_SERVICE_INSTANCE_ID"); + verify(MOCK_aaiResourcesClient, times(1)).disconnect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectConfigurationToGenericVnfTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToGenericVnf(configuration.getConfigurationId(), genericVnf.getVnfId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectConfigurationToVpnBindingTest() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectConfigurationToVpnBinding(configuration.getConfigurationId(), vpnBinding.getVpnId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void getConfigurationFromRelatedLinkTest () { + Optional<org.onap.aai.domain.yang.Configuration> configuration = Optional.of(new org.onap.aai.domain.yang.Configuration()); + configuration.get().setConfigurationId("config1"); + doReturn(configuration).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.Configuration.class),isA(AAIResourceUri.class)); + aaiConfigurationResources.getConfigurationFromRelatedLink("http://localhost:8090/aai/v12/network/configurations/configuration/config1"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.Configuration.class),isA(AAIResourceUri.class)); + } + + @Test + public void connectVrfConfigurationToVnrConfigurationTest() throws Exception { + Configuration vrfConfiguration = buildConfiguration(); + Configuration vnrConfiguration = buildConfiguration(); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiConfigurationResources.connectVrfConfigurationToVnrConfiguration(vrfConfiguration.getConfigurationId(),vnrConfiguration.getConfigurationId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectConfigurationToPnfObjectTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + Pnf primaryPnf = serviceProxy.getServiceInstance().getPnfs().stream().filter(o -> o.getRole().equals("Primary")).findFirst().get(); + + aaiConfigurationResources.connectConfigurationToPnfObject(primaryPnf.getPnfId(), configuration.getConfigurationId()); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void getConfigurationTest() { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); + aaiConfigurationResources.getConfiguration("configurationId"); + verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri); + } + + @Test + public void deleteConfigurationTest() { + AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, "configurationId"); + doNothing().when(MOCK_aaiResourcesClient).delete(aaiResourceUri); + aaiConfigurationResources.deleteConfiguration("configurationId"); + verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri); + } +}
\ No newline at end of file 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 new file mode 100644 index 0000000000..aef25e5ded --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +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.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +@RunWith(MockitoJUnitRunner.class) +public class AAIInstanceGroupResourcesTest extends TestDataSetup{ + + @InjectMocks + private AAIInstanceGroupResources aaiInstanceGroupResources = new AAIInstanceGroupResources(); + + private InstanceGroup instanceGroup; + private GenericVnf vnf; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + instanceGroup = buildInstanceGroup(); + vnf = buildGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createInstanceGroupTest() throws Exception { + doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup); + aaiInstanceGroupResources.createInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), isA(Optional.class)); + } + + @Test + public void deleteInstanceGroupTest() throws Exception { + aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).delete(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + } + + @Test + public void connectInstanceGroupTest() throws Exception { + aaiInstanceGroupResources.connectInstanceGroupToVnf(instanceGroup, vnf); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()))); + } + + @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 new file mode 100644 index 0000000000..fa3324840c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java @@ -0,0 +1,317 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +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.assertTrue; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aai.domain.yang.NetworkPolicy; +import org.onap.aai.domain.yang.RouteTableReference; +import org.onap.aai.domain.yang.VpnBinding; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.common.data.TestDataSetup; +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.ServiceInstance; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.Relationships; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAINetworkResourcesTest extends TestDataSetup{ + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + private L3Network network; + private Collection collection; + private InstanceGroup instanceGroup; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + private AAINetworkResources aaiNetworkResources = new AAINetworkResources(); + + @Before + public void before() { + network = buildL3Network(); + + collection = buildCollection(); + + List<L3Network> l3NetworkList = new ArrayList<L3Network>(); + l3NetworkList.add(network); + + instanceGroup = buildInstanceGroup(); + + serviceInstance = buildServiceInstance(); + + cloudRegion = buildCloudRegion(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + + @Test + public void updateNetworkTest() throws Exception { + + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn(new org.onap.aai.domain.yang.L3Network()).when(MOCK_aaiObjectMapper).mapNetwork(network); + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.L3Network.class)); + + aaiNetworkResources.updateNetwork(network); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.L3Network.class)); + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void createNetworkConnectToServiceInstanceTest() throws Exception { + + network.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doReturn(new org.onap.aai.domain.yang.L3Network()).when(MOCK_aaiObjectMapper).mapNetwork(network); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), any(AAIResourceUri.class)); + + aaiNetworkResources.createNetworkConnectToServiceInstance(network, serviceInstance); + + assertEquals(OrchestrationStatus.INVENTORIED, network.getOrchestrationStatus()); + + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void deleteNetworkTest() throws Exception { + + network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiNetworkResources.deleteNetwork(network); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void getVpnBindingTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiVpnBinding.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional<VpnBinding> oVpnBinding = Optional.empty(); + AAIResourceUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oVpnBinding = aaiNetworkResources.getVpnBinding(aaiUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oVpnBinding.isPresent()) { + VpnBinding vpnBinding = oVpnBinding.get(); + assertThat(aaiResultWrapper.asBean(VpnBinding.class).get(), sameBeanAs(vpnBinding)); + } + } + + @Test + public void getNetworkPolicyTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicy.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional<NetworkPolicy> oNetPolicy = Optional.empty(); + AAIResourceUri netPolicyUri = AAIUriFactory.createResourceUri(AAIObjectType.NETWORK_POLICY, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oNetPolicy.isPresent()) { + NetworkPolicy networkPolicy = oNetPolicy.get(); + assertThat(aaiResultWrapper.asBean(NetworkPolicy.class).get(), sameBeanAs(networkPolicy)); + } + } + + @Test + public void getRouteTableTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkTableRefs.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + Optional<RouteTableReference> oRtref = Optional.empty(); + AAIResourceUri rTRefUri = AAIUriFactory.createResourceUri(AAIObjectType.ROUTE_TABLE_REFERENCE, "ModelInvariantUUID", "serviceModelVersionId"); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + oRtref = aaiNetworkResources.getRouteTable(rTRefUri); + verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class)); + + if (oRtref.isPresent()) { + RouteTableReference rTref = oRtref.get(); + assertThat(aaiResultWrapper.asBean(RouteTableReference.class).get(), sameBeanAs(rTref)); + } + } + + @Test + public void queryNetworkByIdTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiQueryAAIResponse-Wrapper.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + L3Network network = new L3Network(); + network.setNetworkId("0384d743-f69b-4cc8-9aa8-c3ae66662c44"); + network.setNetworkName("Dev_Bindings_1802_020118"); + network.setOrchestrationStatus(OrchestrationStatus.CREATED); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + Optional<org.onap.aai.domain.yang.L3Network> l3NetworkOpt = aaiNetworkResources.queryNetworkById(network); + org.onap.aai.domain.yang.L3Network l3Network = l3NetworkOpt.isPresent() ? l3NetworkOpt.get() : null; + + verify(MOCK_aaiResourcesClient, times(1)).get(isA(AAIResourceUri.class)); + assertNotNull(l3Network); + assertEquals("0384d743-f69b-4cc8-9aa8-c3ae66662c44", l3Network.getNetworkId()); + assertEquals("Dev_Bindings_1802_020118", l3Network.getNetworkName()); + } + + @Test + public void queryNetworkWrapperByIdTest() throws Exception { + final String content = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiQueryAAIResponse-Wrapper.json"))); + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content); + L3Network network = new L3Network(); + network.setNetworkId("0384d743-f69b-4cc8-9aa8-c3ae66662c44"); + network.setNetworkName("Dev_Bindings_1802_020118"); + network.setOrchestrationStatus(OrchestrationStatus.CREATED); + + doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class)); + AAIResultWrapper result = aaiNetworkResources.queryNetworkWrapperById(network); + + verify(MOCK_aaiResourcesClient, times(1)).get(isA(AAIResourceUri.class)); + assertEquals(aaiResultWrapper.getJson(), result.getJson()); + assertNotNull(result); + Optional<Relationships> resultNetworkRelationships = result.getRelationships(); + assertTrue(resultNetworkRelationships.isPresent()); + Optional<org.onap.aai.domain.yang.L3Network> aaiL3Network = result.asBean(org.onap.aai.domain.yang.L3Network.class); + assertEquals(network.getNetworkId(),aaiL3Network.get().getNetworkId()); + assertEquals(network.getNetworkName(),aaiL3Network.get().getNetworkName()); + + + } + + @Test + public void createNetworkCollectionTest() throws Exception { + + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Collection.class)); + doReturn(new org.onap.aai.domain.yang.Collection()).when(MOCK_aaiObjectMapper).mapCollection(collection); + collection.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + aaiNetworkResources.createNetworkCollection(collection); + assertEquals(OrchestrationStatus.INVENTORIED, collection.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Collection.class)); + } + + @Test + public void createNetworkInstanceGroupTest() throws Exception { + doReturn(new org.onap.aai.domain.yang.InstanceGroup()).when(MOCK_aaiObjectMapper).mapInstanceGroup(instanceGroup); + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.InstanceGroup.class)); + aaiNetworkResources.createNetworkInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), isA(org.onap.aai.domain.yang.InstanceGroup.class)); + } + + @Test + public void connectNetworkToNetworkCollectionInstanceGroupTest() throws Exception { + aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(network, instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkToNetworkCollectionServiceInstanceTest() throws Exception { + aaiNetworkResources.connectNetworkToNetworkCollectionServiceInstance(network, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkToCloudRegionTest() throws Exception { + aaiNetworkResources.connectNetworkToCloudRegion(network, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkToTenantTest() throws Exception { + aaiNetworkResources.connectNetworkToTenant(network, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.TENANT, + cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), cloudRegion.getTenantId())), + eq(AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, network.getNetworkId()))); + } + + @Test + public void connectNetworkCollectionInstanceGroupToNetworkCollectionTest() throws Exception { + aaiNetworkResources.connectNetworkCollectionInstanceGroupToNetworkCollection(instanceGroup, collection); + verify(MOCK_aaiResourcesClient, times(1)).connect(eq(AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, collection.getId())), eq(AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroup.getId()))); + } + + @Test + public void connectNetworkCollectionToServiceInstanceTest() throws Exception { + aaiNetworkResources.connectNetworkCollectionToServiceInstance(collection, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void deleteCollectionTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + aaiNetworkResources.deleteCollection(collection); + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void deleteInstanceGroupTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + aaiNetworkResources.deleteNetworkInstanceGroup(instanceGroup); + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java new file mode 100644 index 0000000000..46d4135b6d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java @@ -0,0 +1,181 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIServiceInstanceResourcesTest extends TestDataSetup{ + + @InjectMocks + private AAIServiceInstanceResources aaiServiceInstanceResources = new AAIServiceInstanceResources(); + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + private ServiceInstance serviceInstance; + private ServiceSubscription serviceSubscription; + private Customer customer; + private Project project; + private OwningEntity owningEntity; + + @Before + public void before() { + serviceInstance = buildServiceInstance(); + serviceSubscription = buildServiceSubscription(); + customer = buildCustomer(); + project = buildProject(); + owningEntity = buildOwningEntity(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void deleteServiceInstanceSuccessTest() throws Exception { + aaiServiceInstanceResources.deleteServiceInstance(serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void deleteServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doThrow(Exception.class).when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + aaiServiceInstanceResources.deleteServiceInstance(serviceInstance); + } + + @Test + public void existsServiceInstanceTest() { + aaiServiceInstanceResources.existsServiceInstance(serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).exists(any(AAIResourceUri.class)); + } + + @Test + public void createServiceSubscriptionTest() { + serviceSubscription.setServiceType("IP-FLEX"); + customer.setServiceSubscription(serviceSubscription); + doReturn(new org.onap.aai.domain.yang.ServiceSubscription()).when(MOCK_aaiObjectMapper).mapServiceSubscription(customer.getServiceSubscription()); + aaiServiceInstanceResources.createServiceSubscription(customer); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void createServiceInstanceTest() { + serviceSubscription.setServiceType("testSubscriberType"); + customer.setServiceSubscription(serviceSubscription); + doReturn(new org.onap.aai.domain.yang.ServiceInstance()).when(MOCK_aaiObjectMapper).mapServiceInstance(serviceInstance); + serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + aaiServiceInstanceResources.createServiceInstance(serviceInstance, customer); + + assertEquals(OrchestrationStatus.INVENTORIED, serviceInstance.getOrchestrationStatus()); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void createProjectTest() { + doReturn(new org.onap.aai.domain.yang.Project()).when(MOCK_aaiObjectMapper).mapProject(project); + aaiServiceInstanceResources.createProject(project); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void createProjectandConnectServiceInstanceTest() { + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + doReturn(new org.onap.aai.domain.yang.Project()).when(MOCK_aaiObjectMapper).mapProject(project); + aaiServiceInstanceResources.createProjectandConnectServiceInstance(project, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void createOwningEntityTest() { + doReturn(new org.onap.aai.domain.yang.OwningEntity()).when(MOCK_aaiObjectMapper).mapOwningEntity(owningEntity); + aaiServiceInstanceResources.createOwningEntity(owningEntity); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + } + + @Test + public void existsOwningEntityTest() { + aaiServiceInstanceResources.existsOwningEntity(owningEntity); + verify(MOCK_aaiResourcesClient, times(1)).exists(any(AAIResourceUri.class)); + } + + @Test + public void connectOwningEntityandServiceInstanceTest() { + aaiServiceInstanceResources.connectOwningEntityandServiceInstance(owningEntity, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void createOwningEntityandConnectServiceInstanceTest() { + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + doReturn(new org.onap.aai.domain.yang.OwningEntity()).when(MOCK_aaiObjectMapper).mapOwningEntity(owningEntity); + aaiServiceInstanceResources.createOwningEntityandConnectServiceInstance(owningEntity, serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void updateOrchestrationStatusServiceInstanceTest() { + aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE); + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.ServiceInstance.class)); + } + + @Test + public void test_updateServiceInstance() { + aaiServiceInstanceResources.updateServiceInstance(serviceInstance); + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.ServiceInstance.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java new file mode 100644 index 0000000000..0c4c8fc443 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java @@ -0,0 +1,127 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVfModuleResourcesTest extends TestDataSetup{ + @InjectMocks + private AAIVfModuleResources aaiVfModuleResources = new AAIVfModuleResources(); + + private VfModule vfModule; + private GenericVnf vnf; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + vfModule = buildVfModule(); + vnf = buildGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void updateOrchestrationStatusVfModuleTest() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class)); + + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class)); + + assertEquals(OrchestrationStatus.ACTIVE, vfModule.getOrchestrationStatus()); + } + + @Test + public void createVfModuleTest() throws Exception { + vfModule.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doReturn(new org.onap.aai.domain.yang.VfModule()).when(MOCK_aaiObjectMapper).mapVfModule(vfModule); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + aaiVfModuleResources.createVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + assertEquals(OrchestrationStatus.INVENTORIED, vfModule.getOrchestrationStatus()); + } + + @Test + public void deleteVfModuleTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiVfModuleResources.deleteVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void changeAssignVfModuleTest() throws Exception { + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VfModule.class)); + + aaiVfModuleResources.changeAssignVfModule(vfModule, vnf); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VfModule.class)); + } + + @Test + public void connectVfModuleToVolumeGroupTest() throws Exception { + VolumeGroup volumeGroup = buildVolumeGroup(); + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CloudRegion cloudRegion = buildCloudRegion(); + + aaiVfModuleResources.connectVfModuleToVolumeGroup(vnf, vfModule, volumeGroup, cloudRegion); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java new file mode 100644 index 0000000000..db719d3151 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java @@ -0,0 +1,161 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +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.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVnfResourcesTest extends TestDataSetup { + + private GenericVnf genericVnf; + + private ServiceInstance serviceInstance; + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + AAIVnfResources aaiVnfResources = new AAIVnfResources(); + + @Before + public void before() { + serviceInstance = buildServiceInstance(); + genericVnf = buildGenericVnf(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createVnfandConnectServiceInstanceTest() { + doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(MOCK_aaiObjectMapper).mapVnf(genericVnf); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + doNothing().when(MOCK_aaiResourcesClient).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + genericVnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + aaiVnfResources.createVnfandConnectServiceInstance(genericVnf, serviceInstance); + + assertEquals(OrchestrationStatus.INVENTORIED, genericVnf.getOrchestrationStatus()); + verify(MOCK_aaiObjectMapper, times(1)).mapVnf(genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class)); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void createPlatformandConnectVnfTest() { + Platform platform = new Platform(); + platform.setPlatformName("a123"); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class)); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + aaiVnfResources.createPlatformandConnectVnf(platform, genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),isA(AAIResourceUri.class)); + } + + @Test + public void createLineOfBusinessandConnectVnfTest() { + LineOfBusiness lob = new LineOfBusiness(); + lob.setLineOfBusinessName("a123"); + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class),isA(AAIResourceUri.class)); + doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), any(Optional.class)); + aaiVnfResources.createLineOfBusinessandConnectVnf(lob, genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class),isA(AAIResourceUri.class)); + } + + @Test + public void deleteVnfTest() { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiVnfResources.deleteVnf(genericVnf); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } + + @Test + public void updateOrchestrationStatusVnfTest() { + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Vnf.class)); + + aaiVnfResources.updateOrchestrationStatusVnf(genericVnf, OrchestrationStatus.ACTIVE); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Vnf.class)); + + assertEquals(OrchestrationStatus.ACTIVE, genericVnf.getOrchestrationStatus()); + } + + @Test + public void updateObjectVnfTest() { + doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(MOCK_aaiObjectMapper).mapVnf(genericVnf); + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.GenericVnf.class)); + + aaiVnfResources.updateObjectVnf(genericVnf); + + verify(MOCK_aaiObjectMapper, times(1)).mapVnf(genericVnf); + verify(MOCK_aaiResourcesClient, times(1)).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.GenericVnf.class)); + } + + @Test + public void getGenericVnfTest () { + Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf()); + vnf.get().setVnfId("vnfId"); + doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + aaiVnfResources.getGenericVnf("vnfId"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + } + + @Test + public void checkInMaintFlagTest () { + Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf()); + vnf.get().setVnfId("vnfId"); + vnf.get().setInMaint(true); + doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + boolean inMaintFlag = aaiVnfResources.checkInMaintFlag("vnfId"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class)); + assertEquals(inMaintFlag, true); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java new file mode 100644 index 0000000000..de15e0a550 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVolumeGroupResourcesTest extends TestDataSetup{ + @InjectMocks + private AAIVolumeGroupResources aaiVolumeGroupResources = new AAIVolumeGroupResources(); + + private CloudRegion cloudRegion; + private VolumeGroup volumeGroup; + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + cloudRegion = buildCloudRegion(); + volumeGroup = buildVolumeGroup(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + + + @Test + public void updateOrchestrationStatusVolumeGroupTest() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class)); + + aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE); + + verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class)); + + assertEquals(OrchestrationStatus.ACTIVE, volumeGroup.getOrchestrationStatus()); + } + + @Test + public void createVolumeGroupTest() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.PRECREATED); + + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VolumeGroup.class)); + + aaiVolumeGroupResources.createVolumeGroup(volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.VolumeGroup.class)); + + assertEquals(OrchestrationStatus.ASSIGNED, volumeGroup.getOrchestrationStatus()); + } + + @Test + public void connectVolumeGroupToVnfTest() throws Exception { + + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiVolumeGroupResources.connectVolumeGroupToTenant(volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void connectVolumeGroupToTenantTest() throws Exception { + GenericVnf genericVnf = buildGenericVnf(); + + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiVolumeGroupResources.connectVolumeGroupToVnf(genericVnf, volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class)); + } + + @Test + public void deleteVolumeGroupTest() { + doNothing().when(MOCK_aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion); + + verify(MOCK_aaiResourcesClient, times(1)).delete(any(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java new file mode 100644 index 0000000000..7c31040f1d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doNothing; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.aai.domain.yang.VpnBindings; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.mapper.AAIObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class AAIVpnBindingResourcesTest extends TestDataSetup{ + + @Mock + protected AAIResourcesClient MOCK_aaiResourcesClient; + + @Mock + protected AAIObjectMapper MOCK_aaiObjectMapper; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @InjectMocks + private AAIVpnBindingResources aaiVpnBindingResources = new AAIVpnBindingResources(); + + private Customer customer; + + @Before + public void before() { + customer = buildCustomer(); + doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient(); + } + + @Test + public void createCustomerTest() { + org.onap.aai.domain.yang.Customer mappedCustomer = new org.onap.aai.domain.yang.Customer(); + mappedCustomer.setGlobalCustomerId(customer.getGlobalCustomerId()); + + doReturn(mappedCustomer).when(MOCK_aaiObjectMapper).mapCustomer(customer); + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Customer.class)); + + aaiVpnBindingResources.createCustomer(customer); + + verify(MOCK_aaiResourcesClient, times(1)).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Customer.class)); + verify(MOCK_aaiObjectMapper, times(1)).mapCustomer(customer); + } + + @Test + public void getVpnBindingTest () { + org.onap.aai.domain.yang.VpnBinding vpnBinding = new org.onap.aai.domain.yang.VpnBinding(); + vpnBinding.setVpnId("vnfId"); + when(MOCK_aaiResourcesClient.get(eq(org.onap.aai.domain.yang.VpnBinding.class),isA(AAIResourceUri.class))).thenReturn(Optional.of(vpnBinding)); + aaiVpnBindingResources.getVpnBinding("vpnId"); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBinding.class),isA(AAIResourceUri.class)); + } + + @Test + public void existsCustomerTest() { + when(MOCK_aaiResourcesClient.exists(isA(AAIResourceUri.class))).thenReturn(true); + boolean isCustomerExist = aaiVpnBindingResources.existsCustomer(customer); + verify(MOCK_aaiResourcesClient, times(1)).exists(isA(AAIResourceUri.class)); + assertEquals(true,isCustomerExist); + } + + @Test + public void getVpnBindingByCustomerVpnIdTest() { + when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class),isA(AAIResourceUri.class))).thenReturn(Optional.of(new VpnBindings())); + Optional<VpnBindings> vpnBindings = aaiVpnBindingResources.getVpnBindingByCustomerVpnId("testCustomerVpnId"); + assertNotNull(vpnBindings.get()); + verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBindings.class),isA(AAIResourceUri.class)); + } + + @Test + public void createVpnBindingTest() { + doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VpnBinding.class)); + org.onap.aai.domain.yang.VpnBinding mappedVpnBinding = new org.onap.aai.domain.yang.VpnBinding(); + mappedVpnBinding.setVpnName("test"); + + doReturn(mappedVpnBinding).when(MOCK_aaiObjectMapper).mapVpnBinding(isA(VpnBinding.class)); + VpnBinding vpnBinding = buildVpnBinding(); + aaiVpnBindingResources.createVpnBinding(vpnBinding); + + verify(MOCK_aaiResourcesClient, times(1)).create(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.VpnBinding.class)); + verify(MOCK_aaiObjectMapper, times(1)).mapVpnBinding(isA(VpnBinding.class)); + } + + @Test + public void connectCustomerToVpnBinding() { + doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + aaiVpnBindingResources.connectCustomerToVpnBinding("testCustId","testVpnId"); + verify(MOCK_aaiResourcesClient,times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java new file mode 100644 index 0000000000..0669b84fd6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/NetworkAdapterResourcesTest.java @@ -0,0 +1,219 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +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.DeleteNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; +import org.onap.so.adapters.nwrest.UpdateNetworkRequest; +import org.onap.so.adapters.nwrest.UpdateNetworkResponse; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +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.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.network.NetworkAdapterClientException; +import org.onap.so.client.adapter.network.NetworkAdapterClientImpl; +import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; +import org.onap.so.entity.MsoRequest; + +import com.shazam.shazamcrest.matcher.Matchers; + + +@RunWith(MockitoJUnitRunner.class) +public class NetworkAdapterResourcesTest extends TestDataSetup{ + + @InjectMocks + private NetworkAdapterResources networkAdapterResources = new NetworkAdapterResources(); + + @Mock + protected NetworkAdapterClientImpl MOCK_networkAdapterClient; + + @Mock + protected NetworkAdapterObjectMapper MOCK_networkAdapterObjectMapper; + + private L3Network l3Network; + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private Customer customer; + Map<String, String> userInput; + + @Before + public void before() { + requestContext = buildRequestContext(); + + customer = buildCustomer(); + + serviceInstance = buildServiceInstance(); + + cloudRegion = buildCloudRegion(); + + orchestrationContext = buildOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + userInput = buildUserInput(); + + l3Network = buildL3Network(); + } + + @Test + public void createNetworTest() throws Exception { + String cloudRegionPo = "cloudRegionPo"; + CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest(); + + expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo); + expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId()); + expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId()); + expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName()); + expectedCreateNetworkRequest.setBackout(false); + expectedCreateNetworkRequest.setFailIfExists(true); + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(requestContext.getMsoRequestId()); + msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId()); + expectedCreateNetworkRequest.setMsoRequest(msoRequest); + expectedCreateNetworkRequest.setSkipAAI(true); + + Subnet openstackSubnet = new Subnet(); + HostRoute hostRoute = new HostRoute(); + hostRoute.setHostRouteId("hostRouteId"); + hostRoute.setNextHop("nextHop"); + hostRoute.setRoutePrefix("routePrefix"); + openstackSubnet.getHostRoutes().add(hostRoute); + List<Subnet> subnetList = new ArrayList<Subnet>(); + subnetList.add(openstackSubnet); + l3Network.getSubnets().add(openstackSubnet); + + l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest(); + createNetworkRequest.setCloudSiteId("cloudSiteId"); + + CreateNetworkResponse expectedCreateNetworkResponse = new CreateNetworkResponse(); + expectedCreateNetworkResponse.setNetworkStackId("networkStackId"); + expectedCreateNetworkResponse.setNetworkCreated(true); + + + doReturn(expectedCreateNetworkResponse).when(MOCK_networkAdapterClient).createNetwork(isA(CreateNetworkRequest.class)); + + doReturn(createNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(Customer.class)); + + CreateNetworkResponse actualCreateNetwrokResponse = (networkAdapterResources.createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer)).get(); + + verify(MOCK_networkAdapterClient, times(1)).createNetwork(createNetworkRequest); + + verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer); + + assertThat(expectedCreateNetworkResponse, Matchers.sameBeanAs(actualCreateNetwrokResponse)); + } + + @Test + public void rollbackCreateNetworkTest() throws Exception { + String cloudRegionPo = "cloudRegionPo"; + RollbackNetworkResponse expectedRollbackNetworkResponse = new RollbackNetworkResponse(); + expectedRollbackNetworkResponse.setMessageId("messageId"); + expectedRollbackNetworkResponse.setNetworkRolledBack(true); + + RollbackNetworkRequest rollbackNetworkRequest = new RollbackNetworkRequest(); + rollbackNetworkRequest.setMessageId("messageId"); + + RollbackNetworkResponse rollbackNetworkResponse = new RollbackNetworkResponse(); + rollbackNetworkResponse.setMessageId("messageId"); + rollbackNetworkResponse.setNetworkRolledBack(true); + + CreateNetworkResponse createNetworkResponse = new CreateNetworkResponse(); + createNetworkResponse.setMessageId("messageId"); + + doReturn(rollbackNetworkResponse).when(MOCK_networkAdapterClient).rollbackNetwork(isA(String.class), isA(RollbackNetworkRequest.class)); + + doReturn(rollbackNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRollbackRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(CreateNetworkResponse.class)); + + RollbackNetworkResponse actualRollbackCreateNetwrokResponse = (networkAdapterResources.rollbackCreateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse)).get(); + + verify(MOCK_networkAdapterClient, times(1)).rollbackNetwork(l3Network.getNetworkId(), rollbackNetworkRequest); + + verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRollbackRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, createNetworkResponse); + + assertThat(expectedRollbackNetworkResponse, Matchers.sameBeanAs(actualRollbackCreateNetwrokResponse)); + } + + @Test + public void updateNetworkTest() throws UnsupportedEncodingException, NetworkAdapterClientException { + + doReturn(new UpdateNetworkRequest()).when(MOCK_networkAdapterObjectMapper).createNetworkUpdateRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(Customer.class)); + + doReturn(new UpdateNetworkResponse()).when(MOCK_networkAdapterClient).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class)); + + Optional<UpdateNetworkResponse> actualUpdateNetworkResponse = networkAdapterResources.updateNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer); + + + verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer); + verify(MOCK_networkAdapterClient, times(1)).updateNetwork(isA(String.class), isA(UpdateNetworkRequest.class)); + assertNotNull(actualUpdateNetworkResponse); + } + + @Test + public void deleteNetwork_DeleteAction_Test() throws UnsupportedEncodingException, NetworkAdapterClientException { + + DeleteNetworkRequest deleteNetworkRequest = new DeleteNetworkRequest(); + doReturn(deleteNetworkRequest).when(MOCK_networkAdapterObjectMapper).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + + DeleteNetworkResponse expectedDeleteNetworkResponse = new DeleteNetworkResponse(); + + doReturn(expectedDeleteNetworkResponse).when(MOCK_networkAdapterClient).deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest); + + Optional<DeleteNetworkResponse> actualODeleteNetworkResponse = networkAdapterResources.deleteNetwork(requestContext, cloudRegion, serviceInstance, l3Network); + DeleteNetworkResponse actualDeleteNetworkResponse = actualODeleteNetworkResponse.get(); + + verify(MOCK_networkAdapterObjectMapper, times(1)).deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network); + verify(MOCK_networkAdapterClient, times(1)).deleteNetwork(l3Network.getNetworkId(), deleteNetworkRequest); + assertThat(expectedDeleteNetworkResponse, Matchers.sameBeanAs(actualDeleteNetworkResponse)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java new file mode 100644 index 0000000000..7de5faac0c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java @@ -0,0 +1,116 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +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.common.data.TestDataSetup; +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.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper; + +import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCConfigurationResourcesTest extends TestDataSetup{ + + @InjectMocks + private SDNCConfigurationResources sdncConfigurationResources = new SDNCConfigurationResources(); + + @Spy + GCTopologyOperationRequestMapper MOCK_gcTopologyMapper ; + + @Mock + protected SDNCClient MOCK_sdncClient; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private VpnBondingLink vpnBondingLink; + private GenericVnf vnf; + private Customer customer; + + @Before + public void setUp(){ + + customer = buildCustomer(); + + requestContext = buildRequestContext(); + + serviceInstance = buildServiceInstance(); + + vpnBondingLink = buildVpnBondingLink(); + + vnf = vpnBondingLink.getInfrastructureServiceProxy().getServiceInstance().getVnfs().get(0); + } + + @Test + public void activateVnrConfigurationTest() throws BadResponseException, MapperException { + + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.activateVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } + + @Test + public void assignVnrConfigurationTest() throws BadResponseException, MapperException { + + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.assignVnrConfiguration(serviceInstance,requestContext,customer,vpnBondingLink.getVnrConfiguration(),vnf); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } + + @Test + public void unAssignVnrConfigurationTest() throws BadResponseException, MapperException { + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.unAssignVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration()); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } + + @Test + public void deactivateVnrConfigurationTest() throws BadResponseException, MapperException { + doReturn("success").when(MOCK_sdncClient).post(isA(GenericResourceApiGcTopologyOperationInformation.class), isA(SDNCTopology.class)); + String response = sdncConfigurationResources.deactivateVnrConfiguration(serviceInstance,requestContext,vpnBondingLink.getVnrConfiguration()); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiGcTopologyOperationInformation.class), any(SDNCTopology.class)); + assertNotNull(response); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java new file mode 100644 index 0000000000..b91d935c8e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java @@ -0,0 +1,204 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +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.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCNetworkResourcesTest extends TestDataSetup{ + + @InjectMocks + private SDNCNetworkResources sdncNetworkResources; + + @Mock + protected SDNCClient MOCK_sdncClient; + + @Mock + protected NetworkTopologyOperationRequestMapper MOCK_networkTopologyOperationRequestMapper; + + private L3Network network; + private ServiceInstance serviceInstance; + private Customer customer; + private RequestContext requestContext; + private CloudRegion cloudRegion; + + @Before + public void before() { + network = buildL3Network(); + + customer = buildCustomer(); + + serviceInstance = buildServiceInstance(); + + requestContext = buildRequestContext(); + + cloudRegion = new CloudRegion(); + } + + @Test + public void assignNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.assignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void rollbackAssignNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.rollbackAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void activateNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.activateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void deleteNetworkTest() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.deleteNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.ASSIGNED, network.getOrchestrationStatus()); + } + + @Test + public void test_deactivateNetwork() throws MapperException, BadResponseException { + serviceInstance.getNetworks().add(network); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("gcustId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + GenericResourceApiNetworkOperationInformation expectedGenericResourceApiNetworkOperationInformation = new GenericResourceApiNetworkOperationInformation(); + + String expectedResponse = "response"; + + doReturn(expectedResponse).when(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK); + + doReturn(expectedGenericResourceApiNetworkOperationInformation).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + + String actualResponse = sdncNetworkResources.deactivateNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.DEACTIVATE, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_sdncClient).post(expectedGenericResourceApiNetworkOperationInformation, SDNCTopology.NETWORK); + + assertEquals(expectedResponse, actualResponse); + } + + @Test + public void changeAssignNetworkTest() throws MapperException, BadResponseException { + String expectedSdncResponse = "SDNCChangeAssignNetworkResponse"; + + serviceInstance.getNetworks().add(network); + + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + GenericResourceApiNetworkOperationInformation sdncReq = new GenericResourceApiNetworkOperationInformation(); + + doReturn(sdncReq).when(MOCK_networkTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class), isA(GenericResourceApiRequestActionEnumeration.class), isA(L3Network.class), isA(ServiceInstance.class), isA(Customer.class), isA(RequestContext.class), isA(CloudRegion.class)); + + doReturn(expectedSdncResponse).when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), isA(SDNCTopology.class)); + + String actualSdncResponse = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, customer, requestContext, cloudRegion); + + verify(MOCK_networkTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, requestContext, cloudRegion); + verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.NETWORK); + assertEquals(actualSdncResponse, expectedSdncResponse); + } + + @Test + public void unassignNetwork_Test() throws Exception { + network.setOrchestrationStatus(OrchestrationStatus.CREATED); + + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, + requestContext, cloudRegion); + + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiNetworkOperationInformation.class), eq(SDNCTopology.NETWORK)); + + assertEquals(OrchestrationStatus.CREATED, network.getOrchestrationStatus()); + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java new file mode 100644 index 0000000000..79419c342e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java @@ -0,0 +1,149 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper; + +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCServiceInstanceResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNCServiceInstanceResources sdncServiceInstanceResources; + + + @Mock + protected ServiceTopologyOperationMapper MOCK_serviceTopologyOperationMapper; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private Customer customer; + + @Mock + protected SDNCClient MOCK_sdncClient; + + @Before + public void before() { + requestContext = buildRequestContext(); + + serviceInstance = buildServiceInstance(); + + customer = buildCustomer(); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + } + + @Test + public void assignServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void assignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.assignServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void deleteServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void deleteServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deleteServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void unassignServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.unassignServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void unassignServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DELETE), eq(GenericResourceApiRequestActionEnumeration.DELETESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.unassignServiceInstance(serviceInstance,customer, requestContext); + } + + @Test + public void deactivateServiceInstanceSuccessTest() throws Exception { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } + + @Test + public void deactivateServiceInstanceExceptionTest() throws Exception { + expectedException.expect(Exception.class); + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.deactivateServiceInstance(serviceInstance, customer, requestContext); + } + + @Test + public void test_changeModelServiceInstance() throws MapperException, BadResponseException { + doReturn(new GenericResourceApiServiceOperationInformation()).when(MOCK_serviceTopologyOperationMapper).reqMapper(eq(SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION), eq(SDNCSvcAction.CHANGE_ASSIGN), eq(GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE), any(ServiceInstance.class), any(Customer.class), any(RequestContext.class)); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + sdncServiceInstanceResources.changeModelServiceInstance(serviceInstance, customer, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.SERVICE)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java new file mode 100644 index 0000000000..c7ab47ba5a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java @@ -0,0 +1,126 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +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.common.data.TestDataSetup; +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; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper; + +import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation;; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCVfModuleResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNCVfModuleResources sdncVfModuleResources = new SDNCVfModuleResources(); + + private VfModule vfModule; + private GenericVnf vnf; + private ServiceInstance serviceInstance; + private VolumeGroup volumeGroup; + private Customer customer; + private CloudRegion cloudRegion; + private RequestContext requestContext; + + @Mock + protected SDNCClient MOCK_sdncClient; + + @Spy + protected VfModuleTopologyOperationRequestMapper vfModuleTopologyMapper; + + @Before + public void before() { + vfModule = buildVfModule(); + vnf = buildGenericVnf(); + serviceInstance = buildServiceInstance(); + volumeGroup = buildVolumeGroup(); + customer = buildCustomer(); + cloudRegion = buildCloudRegion(); + requestContext = buildRequestContext(); + } + + @Test + public void assignVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.assignVfModule(vfModule, volumeGroup, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void unassignVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + + sdncVfModuleResources.unassignVfModule(vfModule, vnf, serviceInstance); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void activateVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.activateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void deactivateVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } + + @Test + public void changeAssignVfModuleTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVfModuleOperationInformation.class), isA(SDNCTopology.class)); + + sdncVfModuleResources.changeAssignVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVfModuleOperationInformation.class), eq(SDNCTopology.VFMODULE)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java new file mode 100644 index 0000000000..46764c221c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java @@ -0,0 +1,185 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyBoolean; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.so.bpmn.common.data.TestDataSetup; +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.generalobjects.RequestContext; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SDNCClient; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; +import org.onap.so.client.sdnc.endpoint.SDNCTopology; +import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper; + +@RunWith(MockitoJUnitRunner.class) +public class SDNCVnfResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNCVnfResources sdncVnfResources; + + @Mock + protected VnfTopologyOperationRequestMapper MOCK_vnfTopologyOperationRequestMapper; + + @Mock + protected SDNCClient MOCK_sdncClient; + + private GenericVnf genericVnf; + private ServiceInstance serviceInstance; + private Customer customer; + private CloudRegion cloudRegion; + private RequestContext requestContext; + private GenericResourceApiVnfOperationInformation sdncReq; + + @Before + public void before() { + serviceInstance = buildServiceInstance(); + + genericVnf = buildGenericVnf(); + + customer = buildCustomer(); + + cloudRegion = buildCloudRegion(); + + requestContext = buildRequestContext(); + + sdncReq = new GenericResourceApiVnfOperationInformation(); + } + + @Test + public void assignVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + sdncVnfResources.assignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void activateVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + sdncVnfResources.activateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void deleteVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + sdncVnfResources.deleteVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_sdncClient, times(1)).post(isA(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void queryVnfTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).get(isA(String.class)); + + genericVnf.setSelflink("testSelflink"); + + sdncVnfResources.queryVnf(genericVnf); + + verify(MOCK_sdncClient, times(1)).get(isA(String.class)); + } + + @Test + public void queryVnfWithResourcePrefixTest() throws MapperException, BadResponseException { + doReturn("test").when(MOCK_sdncClient).get(isA(String.class)); + + genericVnf.setSelflink("restconf/test:testSelflink"); + + sdncVnfResources.queryVnf(genericVnf); + + verify(MOCK_sdncClient, times(1)).get(isA(String.class)); + } + + @Test + public void changeModelVnfTest() throws MapperException, BadResponseException { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(isA(SDNCSvcOperation.class), isA(SDNCSvcAction.class),isA(GenericResourceApiRequestActionEnumeration.class), isA(GenericVnf.class), isA(ServiceInstance.class), isA(Customer.class), isA(CloudRegion.class), isA(RequestContext.class), anyBoolean()); + doReturn("SDNCChangeModelVnfResponse").when(MOCK_sdncClient).post(isA(GenericResourceApiVnfOperationInformation.class), isA(SDNCTopology.class)); + + String actualResponse = sdncVnfResources.changeModelVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + + verify(MOCK_vnfTopologyOperationRequestMapper, times(1)).reqMapper(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.CHANGE_ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, genericVnf, serviceInstance, customer, cloudRegion, requestContext, false); + verify(MOCK_sdncClient, times(1)).post(sdncReq, SDNCTopology.VNF); + assertEquals("SDNCChangeModelVnfResponse", actualResponse); + } + + @Test + public void deactivateVnfSuccessTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + + } + + @Test(expected = Exception.class) + public void deactivateVnfExceptionTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.DEACTIVATE),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.deactivateVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test + public void unassignVnfSuccessTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doReturn("test").when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + verify(MOCK_sdncClient, times(1)).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + } + + @Test(expected = Exception.class) + public void unassignVnfExceptionTest() throws Exception { + doReturn(sdncReq).when(MOCK_vnfTopologyOperationRequestMapper).reqMapper(eq(SDNCSvcOperation.VNF_TOPOLOGY_OPERATION), eq(SDNCSvcAction.UNASSIGN),isA(GenericResourceApiRequestActionEnumeration.class), any(GenericVnf.class),any(ServiceInstance.class), any(Customer.class), any(CloudRegion.class),any(RequestContext.class), anyBoolean()); + doThrow(Exception.class).when(MOCK_sdncClient).post(any(GenericResourceApiVnfOperationInformation.class), eq(SDNCTopology.VNF)); + sdncVnfResources.unassignVnf(genericVnf, serviceInstance, customer, cloudRegion, requestContext); + //verify(client, times(1)).post(any(GenericResourceApiServiceOperationInformation.class), eq(SDNCTopology.VNF)); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java new file mode 100644 index 0000000000..38113b8078 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNOHealthCheckResourcesTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; + +import java.util.UUID; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.bpmn.common.InjectionHelper; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdno.SDNOValidator; + +@RunWith(MockitoJUnitRunner.class) +public class SDNOHealthCheckResourcesTest extends TestDataSetup{ + @InjectMocks + private SDNOHealthCheckResources sdnoHealthCheckResources = new SDNOHealthCheckResources(); + + private GenericVnf genericVnf; + private RequestContext requestContext; + + @Mock + protected SDNOValidator MOCK_sdnoValidator; + + @Mock + protected InjectionHelper MOCK_injectionHelper; + + @Before + public void before() { + genericVnf = buildGenericVnf(); + requestContext = buildRequestContext(); + doReturn(MOCK_sdnoValidator).when(MOCK_injectionHelper).getSdnoValidator(); + } + + @Test + public void healthCheckTest() throws Exception { + doReturn(true).when(MOCK_sdnoValidator).healthDiagnostic(isA(String.class), isA(UUID.class), isA(String.class)); + assertTrue(sdnoHealthCheckResources.healthCheck(genericVnf, requestContext)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java new file mode 100644 index 0000000000..dfed3c8929 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResourcesTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Matchers.isA; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +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.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper; + +@RunWith(MockitoJUnitRunner.class) +public class VnfAdapterVfModuleResourcesTest extends TestDataSetup{ + @InjectMocks + private VnfAdapterVfModuleResources vnfAdapterVfModuleResources = new VnfAdapterVfModuleResources(); + + @Mock + protected VnfAdapterVfModuleObjectMapper MOCK_vnfAdapterVfModuleObjectMapper; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private ModelInfoServiceInstance modelInfoServiceInstance; + private GenericVnf genericVnf; + private VfModule vfModule; + private ModelInfoVfModule modelInfoVfModule; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + private CreateVfModuleRequest createVfModuleRequest; + private String sdncVnfQueryResponse; + private String sdncVfModuleQueryResponse; + private DeleteVfModuleRequest deleteVfModuleRequest; + + @Before + public void before() { + requestContext = buildRequestContext(); + + serviceInstance = buildServiceInstance(); + + genericVnf = buildGenericVnf(); + + vfModule = buildVfModule(); + + cloudRegion = buildCloudRegion(); + + orchestrationContext = buildOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + + sdncVnfQueryResponse = new String(); + sdncVfModuleQueryResponse = new String(); + + createVfModuleRequest = new CreateVfModuleRequest(); + createVfModuleRequest.setCloudSiteId("cloudSiteId"); + + deleteVfModuleRequest = new DeleteVfModuleRequest(); + deleteVfModuleRequest.setCloudSiteId("cloudSiteId"); + } + + @Test + public void test_createVfModule() throws Exception { + doReturn(createVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + CreateVfModuleRequest actualCreateVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).createVfModuleRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, + genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse); + + assertNotNull(createVfModuleRequest); + assertNotNull(actualCreateVfModuleRequest); + assertEquals(createVfModuleRequest, actualCreateVfModuleRequest); + } + + @Test + public void test_deleteVfModule() throws Exception { + doReturn(deleteVfModuleRequest).when(MOCK_vnfAdapterVfModuleObjectMapper).deleteVfModuleRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(ServiceInstance.class), + isA(GenericVnf.class), isA(VfModule.class)); + + DeleteVfModuleRequest actualDeleteVfModuleRequest = vnfAdapterVfModuleResources.deleteVfModuleRequest(requestContext, cloudRegion, serviceInstance, + genericVnf, vfModule); + + verify(MOCK_vnfAdapterVfModuleObjectMapper, times(1)).deleteVfModuleRequestMapper(requestContext, cloudRegion, serviceInstance, genericVnf, vfModule); + assertEquals(deleteVfModuleRequest, actualDeleteVfModuleRequest); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java new file mode 100644 index 0000000000..ee0e60c38a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.orchestration; + +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; +import org.onap.so.bpmn.common.data.TestDataSetup; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest; +import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl; +import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper; +import org.onap.so.db.catalog.beans.OrchestrationStatus; + +import com.shazam.shazamcrest.matcher.Matchers; + +@RunWith(MockitoJUnitRunner.class) +public class VnfAdapterVolumeGroupResourcesTest extends TestDataSetup { + @InjectMocks + private VnfAdapterVolumeGroupResources vnfAdapterVolumeGroupResources; + + @Mock + protected VnfAdapterObjectMapper MOCK_vnfAdapterObjectMapper; + + @Mock + protected VnfVolumeAdapterClientImpl MOCK_vnfVolumeAdapterClient; + + private RequestContext requestContext; + private ServiceInstance serviceInstance; + private GenericVnf genericVnf; + private VfModule vfModule; + private VolumeGroup volumeGroup; + private CloudRegion cloudRegion; + private OrchestrationContext orchestrationContext; + + @Before + public void before() { + requestContext = buildRequestContext(); + serviceInstance = buildServiceInstance(); + genericVnf = buildGenericVnf(); + serviceInstance.getVnfs().add(genericVnf); + vfModule = buildVfModule(); + genericVnf.getVfModules().add(vfModule); + volumeGroup = buildVolumeGroup(); + serviceInstance.getVnfs().get(0).getVolumeGroups().add(volumeGroup); + cloudRegion = buildCloudRegion(); + orchestrationContext = buildOrchestrationContext(); + orchestrationContext.setIsRollbackEnabled(true); + } + + @Test + public void test_createVolumeGroup() throws Exception { + volumeGroup.setOrchestrationStatus(OrchestrationStatus.ASSIGNED); + + CreateVolumeGroupRequest createVolumeGroupRequest = new CreateVolumeGroupRequest(); + createVolumeGroupRequest.setCloudSiteId("cloudSiteId"); + + CreateVolumeGroupResponse expectedCreateVolumeGroupResponse = new CreateVolumeGroupResponse(); + expectedCreateVolumeGroupResponse.setVolumeGroupStackId("volumeGroupStackId"); + expectedCreateVolumeGroupResponse.setVolumeGroupCreated(true); + + String sdncVfModuleQueryResponse = "sdncVfModuleQueryResponse"; + + doReturn(createVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + CreateVolumeGroupRequest actualCreateVolumeGroupResponse = vnfAdapterVolumeGroupResources.createVolumeGroupRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + verify(MOCK_vnfAdapterObjectMapper, times(1)).createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse); + + assertThat(createVolumeGroupRequest, Matchers.sameBeanAs(actualCreateVolumeGroupResponse)); + } + + @Test + public void test_deleteVolumeGroup() throws Exception { + DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest(); + doReturn(deleteVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); + + DeleteVolumeGroupResponse expectedDeleteVolumeGroupResponse = new DeleteVolumeGroupResponse(); + doReturn(expectedDeleteVolumeGroupResponse).when(MOCK_vnfVolumeAdapterClient).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest); + + DeleteVolumeGroupResponse actualDeleteVolumeGroupResponse = vnfAdapterVolumeGroupResources.deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup); + + verify(MOCK_vnfVolumeAdapterClient, times(1)).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest); + verify(MOCK_vnfAdapterObjectMapper, times(1)).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup); + assertThat(expectedDeleteVolumeGroupResponse, Matchers.sameBeanAs(actualDeleteVolumeGroupResponse)); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java new file mode 100644 index 0000000000..e3f6a1829e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/policy/CommonObjectMapperProviderTest.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.policy; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.MapperFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +public class CommonObjectMapperProviderTest { + + @Test + public void shouldSetCorrectMapperProperties() throws Exception { + // given + CommonObjectMapperProvider provider = new CommonObjectMapperProvider(); + // when + ObjectMapper context = provider.getMapper(); + // then + assertTrue(context.isEnabled(MapperFeature.USE_ANNOTATIONS)); + assertFalse(context.isEnabled(SerializationFeature.WRAP_ROOT_VALUE)); + assertFalse(context.isEnabled(DeserializationFeature.UNWRAP_ROOT_VALUE)); + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java new file mode 100644 index 0000000000..eb17ad0ff9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java @@ -0,0 +1,83 @@ +/*- + * ============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.client.sdn.common; + +import java.util.LinkedHashMap; + +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.onap.so.client.sdnc.SdnCommonTasks; + + +public class SdnCommonTasksTest{ + + + SdnCommonTasks sdnCommonTasks = new SdnCommonTasks(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void buildJsonRequestTest() throws MapperException { + String jsonStr = sdnCommonTasks.buildJsonRequest(""); + Assert.assertNotNull(jsonStr); + } + + @Test + public void buildJsonRequestTestException() throws MapperException { + expectedException.expect(MapperException.class); + sdnCommonTasks.buildJsonRequest(new Object()); + } + + @Test + public void getHttpHeadersTest() { + Assert.assertNotNull(sdnCommonTasks.getHttpHeaders("")); + } + + @Test + public void validateSDNResponseTest() throws BadResponseException { + LinkedHashMap responseMap = new LinkedHashMap(); + responseMap.put("response-code", "0"); + responseMap.put("response-message", "success"); + Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + } + + @Test + public void validateSDNResponseTestException() throws BadResponseException { + expectedException.expect(BadResponseException.class); + LinkedHashMap responseMap = new LinkedHashMap(); + Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + } + + @Test + public void validateSDNResponseTestRespCodeNot200() throws BadResponseException { + expectedException.expect(BadResponseException.class); + LinkedHashMap responseMap = new LinkedHashMap(); + responseMap.put("response-code", "300"); + responseMap.put("response-message", "Failed"); + Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap)); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java new file mode 100644 index 0000000000..2492638520 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientTest.java @@ -0,0 +1,58 @@ +/*- + * ============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.client.sdnc; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; + +import org.junit.Rule; +import org.junit.Test; +import org.onap.so.bpmn.BaseTaskTest; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.MapperException; +import org.skyscreamer.jsonassert.JSONAssert; + +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +public class SDNCClientTest extends BaseTaskTest { + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/"; + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8446)); + + @Test + public void getTest() throws BadResponseException, MapperException, IOException { + String responseJson = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json"))); + String queryLink = "/topologyQuery"; + + wireMockRule.stubFor(get(urlEqualTo(queryLink)) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json").withBody(responseJson))); + String response = SPY_sdncClient.get(queryLink); + JSONAssert.assertEquals(responseJson, response, false); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..d0d2510b73 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java @@ -0,0 +1,138 @@ +/*- + * ============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.client.sdnc.mapper; + +import java.util.HashMap; +import java.util.List; + +import org.junit.Assert; +import org.junit.Test; +import org.onap.so.bpmn.common.data.TestDataSetup; +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.ServiceProxy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; + +import org.onap.sdnc.apps.client.model.GenericResourceApiGcTopologyOperationInformation; + + +public class GCTopologyOperationRequestMapperTest extends TestDataSetup{ + + private GCTopologyOperationRequestMapper genObjMapper = new GCTopologyOperationRequestMapper(); + + @Test + public void deactivateOrUnassignVnrReqMapperTest() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("MsoRequestId"); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("ServiceInstanceId"); + Configuration Configuration = new Configuration(); + Configuration.setConfigurationId("ConfigurationId"); + GenericResourceApiGcTopologyOperationInformation genericInfo = genObjMapper.deactivateOrUnassignVnrReqMapper + (SDNCSvcAction.UNASSIGN, serviceInstance, requestContext, Configuration); + + Assert.assertNotNull(genericInfo); + Assert.assertNotNull(genericInfo.getSdncRequestHeader().getSvcRequestId()); + } + + + + private VpnBondingLink getVpnBondingLink() { + VpnBondingLink vpnBondingLink = new VpnBondingLink(); + Configuration vrfConfiguration = getVRFConfiguration(); + vpnBondingLink.setVrfConfiguration(vrfConfiguration); + Configuration vnrConfiguration = getVNRConfiguration(); + vpnBondingLink.setVnrConfiguration(vnrConfiguration); + vpnBondingLink.setTransportServiceProxy(buildServiceProxy(buildServiceInstance(buildGenericVnf()))); + return vpnBondingLink; + } + + private RequestContext getRequestContext() { + RequestContext requestContext = new RequestContext(); + requestContext.setMsoRequestId("MsoRequestId"); + HashMap<String, String> userParams = getUserParams(); + requestContext.setUserParams(userParams); + return requestContext; + } + + private HashMap<String, String> getUserParams() { + HashMap<String,String> userParams = new HashMap<>(); + userParams.put("lppCustomerId","lppCustomerId"); + return userParams; + } + + private ServiceProxy buildServiceProxy(ServiceInstance serviceInstance) { + ServiceProxy serviceProxy = new ServiceProxy(); + serviceProxy.setServiceInstance(serviceInstance); + return serviceProxy; + } + + private Configuration getVRFConfiguration() { + Configuration vrfConfiguration = new Configuration(); + vrfConfiguration.setConfigurationId("ConfigurationId"); + vrfConfiguration.setConfigurationName("ConfigurationName"); + vrfConfiguration.setConfigurationSubType("ConfigurationSubType"); + vrfConfiguration.setConfigurationType("VRF-ENTRY"); + return vrfConfiguration; + } + + public Configuration getVNRConfiguration() { + Configuration vnrConfiguration = new Configuration(); + vnrConfiguration.setConfigurationId("ConfigurationId"); + vnrConfiguration.setConfigurationName("ConfigurationName"); + vnrConfiguration.setConfigurationSubType("ConfigurationSubType"); + vnrConfiguration.setConfigurationType("VNRConfiguration"); + L3Network l3Network = getL3Network(); + vnrConfiguration.setNetwork(l3Network); + return vnrConfiguration; + } + + public L3Network getL3Network() { + L3Network l3Network = new L3Network(); + l3Network.setNetworkId("l3NetworkId"); + Subnet ipv4subnet = getSubnet("ipv4CidrMask", "ipv4NetworkStartAddress", "IPV4"); + Subnet ipv6subnet = getSubnet("ipv6CidrMask", "ipv6NetworkStartAddress", "IPV6"); + l3Network.getSubnets().add(ipv4subnet); + l3Network.getSubnets().add(ipv6subnet); + return l3Network; + } + + private Subnet getSubnet(String ipv4CidrMask, String ipv4NetworkStartAddress, String ipv4) { + Subnet ipv4subnet = new Subnet(); + ipv4subnet.setCidrMask(ipv4CidrMask); + ipv4subnet.setNetworkStartAddress(ipv4NetworkStartAddress); + ipv4subnet.setIpVersion(ipv4); + return ipv4subnet; + } + + private ServiceInstance buildServiceInstance(GenericVnf vnf) { + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("ServiceInstanceId"); + List<GenericVnf> vnfs = serviceInstance.getVnfs(); + vnfs.add(vnf); + return serviceInstance; + } +} 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 new file mode 100644 index 0000000000..6f3d137541 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java @@ -0,0 +1,225 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.sdnc.mapper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import java.util.HashMap; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.InjectMocks; +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.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.ModelInfoServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; + +import org.onap.sdnc.apps.client.model.GenericResourceApiConfigurationinformationConfigurationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiGcrequestinputGcRequestInput; +import org.onap.sdnc.apps.client.model.GenericResourceApiParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiParamParam; +import org.onap.sdnc.apps.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceinformationServiceInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiSvcActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfinformationVnfInformation; + + +public class GeneralTopologyObjectMapperTest extends TestDataSetup{ + @InjectMocks + private GeneralTopologyObjectMapper genObjMapper = new GeneralTopologyObjectMapper(); + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void before() { + + } + + @After + public void after() { + + } + + @Test + public void testBuildServiceInformation() { + // 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"); + + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericResourceApiServiceinformationServiceInformation serviceInfo = genObjMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); + + assertEquals("serviceModelInvariantUuid", serviceInfo.getOnapModelInformation().getModelInvariantUuid()); + assertEquals("serviceModelName", serviceInfo.getOnapModelInformation().getModelName()); + assertEquals("serviceModelUuid", serviceInfo.getOnapModelInformation().getModelUuid()); + assertEquals("serviceModelVersion", serviceInfo.getOnapModelInformation().getModelVersion()); + assertNull(serviceInfo.getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("serviceInstanceId", serviceInfo.getServiceInstanceId()); + assertEquals("serviceInstanceId", serviceInfo.getServiceId()); + assertEquals("globalCustomerId", serviceInfo.getGlobalCustomerId()); + assertEquals("productFamilyId", serviceInfo.getSubscriptionServiceType()); + } + + @Test + public void buildSdncRequestHeaderActivateTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ACTIVATE, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.ACTIVATE, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderAssignTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ASSIGN, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.ASSIGN, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderDeactivateTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.DEACTIVATE, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.DEACTIVATE, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderDeleteTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.DELETE, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.DELETE, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildSdncRequestHeaderChangeAssignTest() { + GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.CHANGE_ASSIGN, "sdncReqId"); + + assertEquals(GenericResourceApiSvcActionEnumeration.CHANGEASSIGN, requestHeader.getSvcAction()); + assertEquals("sdncReqId", requestHeader.getSvcRequestId()); + } + + @Test + public void buildConfigurationInformationTest_excludesOnapModelInfo() { + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId"); + configuration.setConfigurationType("VNR"); + configuration.setConfigurationName("VNRCONF"); + GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation =genObjMapper.buildConfigurationInformation(configuration,false); + assertEquals(configuration.getConfigurationId(),configurationInformation.getConfigurationId()); + assertEquals(configuration.getConfigurationType(),configurationInformation.getConfigurationType()); + assertEquals(configuration.getConfigurationName(),configurationInformation.getConfigurationName()); + assertNull(configurationInformation.getOnapModelInformation()); + } + + @Test + public void buildConfigurationInformationTest_includesOnapModelInfo() { + Configuration configuration = new Configuration(); + configuration.setConfigurationId("testConfigurationId"); + configuration.setConfigurationType("VNR"); + configuration.setConfigurationName("VNRCONF"); + ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration(); + modelInfoConfiguration.setModelVersionId("modelVersionId"); + modelInfoConfiguration.setModelInvariantId("modelInvariantId"); + modelInfoConfiguration.setModelCustomizationId("modelCustomizationId"); + configuration.setModelInfoConfiguration(modelInfoConfiguration); + + GenericResourceApiConfigurationinformationConfigurationInformation configurationInformation = genObjMapper.buildConfigurationInformation(configuration,true); + + assertEquals(configuration.getConfigurationId(),configurationInformation.getConfigurationId()); + assertEquals(configuration.getConfigurationType(),configurationInformation.getConfigurationType()); + assertEquals(configuration.getConfigurationName(),configurationInformation.getConfigurationName()); + assertNotNull(configurationInformation.getOnapModelInformation()); + assertEquals(configuration.getModelInfoConfiguration().getModelVersionId(),configurationInformation.getOnapModelInformation().getModelUuid()); + assertEquals(configuration.getModelInfoConfiguration().getModelInvariantId(),configurationInformation.getOnapModelInformation().getModelInvariantUuid()); + assertEquals(configuration.getModelInfoConfiguration().getModelCustomizationId(),configurationInformation.getOnapModelInformation().getModelCustomizationUuid()); + + } + + @Test + public void buildGcRequestInformationTest() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("TestVnfId"); + GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf,null); + assertNotNull(gcRequestInput); + assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId()); + assertNull(gcRequestInput.getInputParameters()); + } + + @Test + public void buildGcRequestInformationTest_withInputParams() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("TestVnfId"); + GenericResourceApiParam genericResourceApiParam =new GenericResourceApiParam(); + genericResourceApiParam.addParamItem(new GenericResourceApiParamParam()); + GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf,genericResourceApiParam); + assertNotNull(gcRequestInput); + assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId()); + assertNotNull(gcRequestInput.getInputParameters()); + } + + @Test + public void buildVnfInformationTest_withNullData() { + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("TestVnfId"); + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + GenericResourceApiVnfinformationVnfInformation gcRequestInput = genObjMapper.buildVnfInformation(vnf,serviceInstance,true); + assertNotNull(gcRequestInput); + assertNull(vnf.getModelInfoGenericVnf()); + assertNull(gcRequestInput.getOnapModelInformation()); + assertEquals(vnf.getVnfId(),gcRequestInput.getVnfId()); + assertNotNull(gcRequestInput.getVnfId()); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..615f8a5710 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java @@ -0,0 +1,198 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.sdnc.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Before; +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +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.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +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.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiNetworkOperationInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class NetworkTopologyOperationRequestMapperTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + private ServiceInstance serviceInstance; + private ServiceInstance serviceInstanceNoCollection; + private Customer customer; + private RequestContext requestContext; + private L3Network network; + private CloudRegion cloudRegion; + + @Before + public void before() { + // prepare and set service instance + serviceInstance = new ServiceInstance(); + serviceInstanceNoCollection = new ServiceInstance(); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid"); + modelInfoServiceInstance.setModelName("modelName"); + modelInfoServiceInstance.setModelUuid("modelUuid"); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + serviceInstanceNoCollection.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + //serviceInstance.setCustomer(customer); + // set Customer on service instance + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + customer.getServiceSubscription().getServiceInstances().add(serviceInstanceNoCollection); + // + InstanceGroup networkInstanceGroup = new InstanceGroup(); + networkInstanceGroup.setId("networkInstanceGroupId"); + networkInstanceGroup.setInstanceGroupFunction("instanceGroupFunction"); + Collection networkCollection = new Collection(); + networkCollection.setInstanceGroup(networkInstanceGroup); + serviceInstance.setCollection(networkCollection); + // + requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + network = new L3Network(); + network.setNetworkId("TEST_NETWORK_ID"); + network.setNetworkName("TEST_NETWORK_NAME"); + ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork(); + modelInfoNetwork.setModelInvariantUUID("modelInvariantUuid"); + modelInfoNetwork.setModelName("modelName"); + modelInfoNetwork.setModelVersion("modelVersion"); + modelInfoNetwork.setModelUUID("modelUuid"); + modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID"); + network.setModelInfoNetwork(modelInfoNetwork); + + cloudRegion = new CloudRegion(); + } + + @Test + public void createGenericResourceApiNetworkOperationInformationTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiNetworkOperationInformation reqMapper1 = omapper.readValue( + getJson("genericResourceApiNetworkOperationInformation.json"), + GenericResourceApiNetworkOperationInformation.class); + + assertThat(networkSDNCrequest, sameBeanAs(reqMapper1).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + @Test + public void reqMapperTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + assertNull(networkSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("modelCustomizationUUID", networkSDNCrequest.getNetworkInformation().getOnapModelInformation().getModelCustomizationUuid()); + } + + @Test + public void reqMapperNoCollectionTest() throws Exception { + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstanceNoCollection, customer, + requestContext, cloudRegion); + + assertNull(networkSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("modelCustomizationUUID", networkSDNCrequest.getNetworkInformation().getOnapModelInformation().getModelCustomizationUuid()); + } + @Test + public void createGenericResourceApiNetworkOperationInformation_UnassignTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapperUnassign = new NetworkTopologyOperationRequestMapper(); + GenericResourceApiNetworkOperationInformation networkSDNCrequestUnassign = mapperUnassign.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, GenericResourceApiRequestActionEnumeration.DELETENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + ObjectMapper omapperUnassign = new ObjectMapper(); + GenericResourceApiNetworkOperationInformation reqMapperUnassign = omapperUnassign.readValue( + getJson("genericResourceApiNetworkOperationInformationUnAssign.json"), + GenericResourceApiNetworkOperationInformation.class); + + assertThat(reqMapperUnassign, sameBeanAs(networkSDNCrequestUnassign).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + + } + + @Test + public void createGenericResourceApiNetworkOperationInformationNoNetworkNameTest() throws Exception { + + NetworkTopologyOperationRequestMapper mapper = new NetworkTopologyOperationRequestMapper(); + //set network name NULL + network.setNetworkName(null); + GenericResourceApiNetworkOperationInformation networkSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.NETWORK_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATENETWORKINSTANCE, network, serviceInstance, customer, + requestContext, cloudRegion); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiNetworkOperationInformation reqMapper1 = omapper.readValue( + getJson("genericResourceApiNetworkOperationInformationNoNetworkName.json"), + GenericResourceApiNetworkOperationInformation.class); + + assertThat(reqMapper1, sameBeanAs(networkSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + /* + * Helper method to load JSON data + */ + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + filename))); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java new file mode 100644 index 0000000000..727a088d80 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java @@ -0,0 +1,85 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.sdnc.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +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.ModelInfoServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation; +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiServiceOperationInformation; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class ServiceTopologyOperationMapperTest { + + @Test + public void reqMapperTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid"); + modelInfoServiceInstance.setModelName("modelName"); + modelInfoServiceInstance.setModelUuid("modelUuid"); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + //prepare RequestContext + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + ServiceTopologyOperationMapper mapper = new ServiceTopologyOperationMapper(); + GenericResourceApiServiceOperationInformation serviceOpInformation = mapper.reqMapper( + SDNCSvcOperation.SERVICE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, GenericResourceApiRequestActionEnumeration.CREATESERVICEINSTANCE, serviceInstance, customer, + requestContext); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json"))); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiOnapmodelinformationOnapModelInformation reqMapper1 = omapper.readValue(jsonToCompare, + GenericResourceApiOnapmodelinformationOnapModelInformation.class); + + assertThat(reqMapper1, sameBeanAs(serviceOpInformation.getServiceInformation().getOnapModelInformation())); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..2ebe6d4f0f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java @@ -0,0 +1,221 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.sdnc.mapper; + +import static com.shazam.shazamcrest.MatcherAssert.assertThat; +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.HashMap; + +import org.junit.Test; +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.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiVfModuleOperationInformation; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class VfModuleTopologyOperationRequestMapperTest { + + private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/"; + + @Test + public void assignGenericResourceApiVfModuleInformationTest() 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"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("testVnfId"); + vnf.setVnfType("testVnfType"); + vnf.setVnfName("testVnfName"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId"); + vfModule.setVfModuleName("testVfModuleName"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + VolumeGroup volumeGroup = new VolumeGroup(); + volumeGroup.setVolumeGroupId("volumeGroupId"); + volumeGroup.setVolumeGroupName("volumeGroupName"); + + CloudRegion cloudRegion = new CloudRegion(); + + VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, volumeGroup, vnf, serviceInstance, customer, + cloudRegion, requestContext, null); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationAssign.json"))); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue( + jsonToCompare, + GenericResourceApiVfModuleOperationInformation.class); + + assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + @Test + public void unassignGenericResourceApiVfModuleInformationTest() throws Exception { + + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + serviceInstance.setServiceInstanceId("serviceInstanceId"); + + // prepare and set vnf instance + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("testVnfId"); + vnf.setVnfType("testVnfType"); + + // prepare and set vf module instance + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId"); + vfModule.setVfModuleName("testVfModuleName"); + + VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.UNASSIGN, vfModule, null, vnf, serviceInstance, null, + null, null, null); + + String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "genericResourceApiVfModuleOperationInformationUnassign.json"))); + + ObjectMapper omapper = new ObjectMapper(); + GenericResourceApiVfModuleOperationInformation reqMapper1 = omapper.readValue( + jsonToCompare, + GenericResourceApiVfModuleOperationInformation.class); + + assertThat(reqMapper1, sameBeanAs(vfModuleSDNCrequest).ignoring("sdncRequestHeader.svcRequestId") + .ignoring("requestInformation.requestId")); + } + + @Test + public void reqMapperTest() 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"); + + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + customer.setServiceSubscription(new ServiceSubscription()); + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + // + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("testVnfId"); + vnf.setVnfType("testVnfType"); + ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf(); + modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid"); + modelInfoGenericVnf.setModelName("vnfModelName"); + modelInfoGenericVnf.setModelVersion("vnfModelVersion"); + modelInfoGenericVnf.setModelUuid("vnfModelUuid"); + modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid"); + vnf.setModelInfoGenericVnf(modelInfoGenericVnf); + + VfModule vfModule = new VfModule(); + vfModule.setVfModuleId("testVfModuleId"); + vfModule.setVfModuleName("testVfModuleName"); + ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule(); + modelInfoVfModule.setModelInvariantUUID("vfModuleModelInvariantUuid"); + modelInfoVfModule.setModelName("vfModuleModelName"); + modelInfoVfModule.setModelVersion("vfModuleModelVersion"); + modelInfoVfModule.setModelUUID("vfModuleModelUuid"); + modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid"); + vfModule.setModelInfoVfModule(modelInfoVfModule); + + CloudRegion cloudRegion = new CloudRegion(); + + VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper(); + GenericResourceApiVfModuleOperationInformation vfModuleSDNCrequest = mapper.reqMapper( + SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer, + cloudRegion, requestContext, null); + + assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid()); + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java new file mode 100644 index 0000000000..ed61486ff3 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 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.client.sdnc.mapper; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import org.junit.Test; +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.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; +import org.onap.so.bpmn.servicedecomposition.generalobjects.License; +import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; +import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance; +import org.onap.so.client.sdnc.beans.SDNCSvcAction; +import org.onap.so.client.sdnc.beans.SDNCSvcOperation; + +import org.onap.sdnc.apps.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.apps.client.model.GenericResourceApiVnfOperationInformation; + +public class VnfTopologyOperationRequestMapperTest { + + @Test + public void reqMapperTest() throws Exception { + // prepare and set service instance + ServiceInstance serviceInstance = new ServiceInstance(); + ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance(); + modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid"); + modelInfoServiceInstance.setModelName("modelName"); + modelInfoServiceInstance.setModelUuid("modelUuid"); + modelInfoServiceInstance.setModelVersion("modelVersion"); + serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance); + + //prepare VNF + ModelInfoGenericVnf genericVnf = new ModelInfoGenericVnf(); + genericVnf.setModelInvariantUuid("vnfModelInvariantUUID"); + genericVnf.setModelVersion("vnfModelVersion"); + genericVnf.setModelName("vnfModelName"); + genericVnf.setModelUuid("vnfModelUUID"); + genericVnf.setModelCustomizationUuid("vnfModelCustomizationUUID"); + + ModelInfoInstanceGroup modelL3Network = new ModelInfoInstanceGroup(); + modelL3Network.setType("networkInstanceGroup"); + + InstanceGroup instanceGroup1 = new InstanceGroup(); + instanceGroup1.setId("l3-network-ig-111"); + instanceGroup1.setModelInfoInstanceGroup(modelL3Network); + + InstanceGroup instanceGroup2 = new InstanceGroup(); + instanceGroup2.setId("l3-network-ig-222"); + instanceGroup2.setModelInfoInstanceGroup(modelL3Network); + + GenericVnf vnf = new GenericVnf(); + vnf.setModelInfoGenericVnf(genericVnf); + vnf.setVnfId("vnfId"); + vnf.setVnfType("vnfType"); + vnf.getInstanceGroups().add(instanceGroup1); + vnf.getInstanceGroups().add(instanceGroup2); + License license = new License(); + List<String> entitlementPoolUuids = new ArrayList<>(); + entitlementPoolUuids.add("entitlementPoolUuid"); + List<String> licenseKeyGroupUuids = new ArrayList<>(); + licenseKeyGroupUuids.add("licenseKeyGroupUuid"); + license.setEntitlementPoolUuids(entitlementPoolUuids); + license.setLicenseKeyGroupUuids(licenseKeyGroupUuids); + vnf.setLicense(license); + + // prepare Customer object + Customer customer = new Customer(); + customer.setGlobalCustomerId("globalCustomerId"); + + ServiceSubscription serviceSubscription = new ServiceSubscription(); + serviceSubscription.setServiceType("productFamilyId"); + customer.setServiceSubscription(serviceSubscription); + + // set Customer on service instance + customer.getServiceSubscription().getServiceInstances().add(serviceInstance); + + + //prepare RequestContext + RequestContext requestContext = new RequestContext(); + HashMap<String, String> userParams = new HashMap<String, String>(); + userParams.put("key1", "value1"); + requestContext.setUserParams(userParams); + requestContext.setProductFamilyId("productFamilyId"); + + CloudRegion cloudRegion = new CloudRegion(); + + VnfTopologyOperationRequestMapper mapper = new VnfTopologyOperationRequestMapper(); + GenericResourceApiVnfOperationInformation vnfOpInformation = mapper.reqMapper( + SDNCSvcOperation.VNF_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN,GenericResourceApiRequestActionEnumeration.CREATEVNFINSTANCE, vnf, serviceInstance, customer, + cloudRegion, requestContext,true); + + assertNull(vnfOpInformation.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals("vnfModelCustomizationUUID", vnfOpInformation.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid()); + assertEquals(2, vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().size()); + assertEquals("l3-network-ig-111", vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().get(0).getVnfNetworkInstanceGroupId()); + assertEquals("l3-network-ig-222", vnfOpInformation.getVnfRequestInput().getVnfNetworkInstanceGroupIds().get(1).getVnfNetworkInstanceGroupId()); + assertEquals("entitlementPoolUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(1).getValue()); + assertEquals("licenseKeyGroupUuid", vnfOpInformation.getVnfRequestInput().getVnfInputParameters().getParam().get(2).getValue()); + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java new file mode 100644 index 0000000000..e5eb6bce54 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java @@ -0,0 +1,175 @@ +/*- + * ============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.client.sniro; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; +import org.junit.Test; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.sniro.beans.SniroConductorRequest; +import org.onap.so.client.sniro.beans.SniroManagerRequest; +import org.springframework.beans.factory.annotation.Autowired; + +import com.fasterxml.jackson.core.JsonProcessingException; +import static com.github.tomakehurst.wiremock.client.WireMock.*; + + +public class SniroClientTestIT{ + + @Autowired + private SniroClient client; + + + @Test(expected = Test.None.class) + public void testPostDemands_success() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postDemands(new SniroManagerRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + + //TODO assertEquals("missing data", ); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException { + String mockResponse = "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException { + String mockResponse = "{ }"; + + stubFor(post(urlEqualTo("/sniro/api/placement/v2")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + + client.postDemands(new SniroManagerRequest()); + } + + @Test(expected = Test.None.class) + public void testPostRelease_success() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"success\", \"message\": \"corys cool\"}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_failed() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"failure\", \"message\": \"corys cool\"}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_noStatus() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"\", \"message\": \"corys cool\"}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_noMessage() throws BadResponseException, JsonProcessingException { + String mockResponse = "{\"status\": \"failure\", \"message\": null}"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + + } + + @Test(expected = BadResponseException.class) + public void testPostRelease_error_empty() throws BadResponseException, JsonProcessingException { + String mockResponse = "{ }"; + + stubFor(post(urlEqualTo("/v1/release-orders")) + .willReturn(aResponse().withStatus(200) + .withHeader("Content-Type", "application/json") + .withBody(mockResponse))); + + client.postRelease(new SniroConductorRequest()); + + } + +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml new file mode 100644 index 0000000000..34079bd23f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkRequest.xml @@ -0,0 +1,75 @@ +<createNetworkRequest> + <cloudSiteId>mtn6</cloudSiteId> + <tenantId>0422ffb57ba042c0800a29dc85ca70f8</tenantId> + <networkId>8d35a433-c1db-4d54-a611-6de10aeb76f9</networkId> + <networkName>Dev_Bindings_1802_1311</networkName> + <networkType>CONTRAIL30_BASIC</networkType> + <modelCustomizationUuid>f1fc12e8-afe4-4716-954d-ed4d21a480ad</modelCustomizationUuid> + <networkTechnology>CONTRAIL</networkTechnology> + <providerVlanNetwork> + <physicalNetworkName>tbd</physicalNetworkName> + <vlans/> + </providerVlanNetwork> + <contrailNetwork> + <shared>true</shared> + <external>false</external> + <routeTargets> + <routeTarget>2001:051111</routeTarget> + <routeTargetRole>EXPORT</routeTargetRole> + </routeTargets> + <routeTargets> + <routeTarget>1000:051113</routeTarget> + <routeTargetRole>IMPORT</routeTargetRole> + </routeTargets> + <routeTargets> + <routeTarget>1000:051112</routeTarget> + <routeTargetRole>BOTH</routeTargetRole> + </routeTargets> + <routeTargets> + <routeTarget>1000:051115</routeTarget> + <routeTargetRole>EXPORT</routeTargetRole> + </routeTargets> + <routeTargets> + <routeTarget>1000:051114</routeTarget> + <routeTargetRole>IMPORT</routeTargetRole> + </routeTargets> + <policyFqdns>default-domain:ECOMP_MSO_DND:MSOPolicyD</policyFqdns> + <policyFqdns>default-domain:ECOMP_MSO_DND:MSOPolicyC</policyFqdns> + <routeTableFqdns/> + </contrailNetwork> + <subnets> + <allocationPools> + <start>107.118.41.3</start> + <end>107.118.41.45</end> + </allocationPools> + <cidr>107.118.41.0/24</cidr> + <enableDHCP>true</enableDHCP> + <gatewayIp>107.118.41.1</gatewayIp> + <ipVersion>4</ipVersion> + <subnetId>9dbb9e7e-fe18-421f-bad6-2305bd282471</subnetId> + <subnetName/> + <addrFromStart>true</addrFromStart> + </subnets> + <subnets> + <allocationPools> + <start>107.118.42.3</start> + <end>107.118.42.45</end> + </allocationPools> + <cidr>107.118.42.0/24</cidr> + <enableDHCP>true</enableDHCP> + <gatewayIp>107.118.42.1</gatewayIp> + <ipVersion>4</ipVersion> + <subnetId>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</subnetId> + <subnetName/> + <addrFromStart>true</addrFromStart> + </subnets> + <skipAAI>true</skipAAI> + <backout>true</backout> + <failIfExists>false</failIfExists> + <msoRequest> + <requestId>3d35ca0c-2da5-4f60-84d9-3e005de335c0</requestId> + <serviceInstanceId>f1d1c7da-fc42-4c31-866e-cfe963e55723</serviceInstanceId> + </msoRequest> + <messageId>d4515ea9-2852-4d3a-b424-9d7b6cf69d8e</messageId> + <notificationUrl/> +</createNetworkRequest>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml new file mode 100644 index 0000000000..607dd5af92 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/createNetworkResponse.xml @@ -0,0 +1,31 @@ +<createNetworkResponse> + <messageId>d4515ea9-2852-4d3a-b424-9d7b6cf69d8e</messageId> + <networkCreated>true</networkCreated> + <networkFqdn>default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311</networkFqdn> + <networkId>8d35a433-c1db-4d54-a611-6de10aeb76f9</networkId> + <networkStackId>Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7</networkStackId> + <neutronNetworkId>b6a7820c-4734-4ef2-8a73-a22c824423fa</neutronNetworkId> + <rollback> + <cloudId>mtn6</cloudId> + <modelCustomizationUuid>f1fc12e8-afe4-4716-954d-ed4d21a480ad</modelCustomizationUuid> + <msoRequest> + <requestId>3d35ca0c-2da5-4f60-84d9-3e005de335c0</requestId> + <serviceInstanceId>f1d1c7da-fc42-4c31-866e-cfe963e55723</serviceInstanceId> + </msoRequest> + <networkCreated>true</networkCreated> + <networkStackId>Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7</networkStackId> + <networkType>CONTRAIL30_BASIC</networkType> + <neutronNetworkId>b6a7820c-4734-4ef2-8a73-a22c824423fa</neutronNetworkId> + <tenantId>0422ffb57ba042c0800a29dc85ca70f8</tenantId> + </rollback> + <subnetMap> + <entry> + <key>9dbb9e7e-fe18-421f-bad6-2305bd282471</key> + <value>27d414c7-1076-4595-aa45-4717ee992cef</value> + </entry> + <entry> + <key>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</key> + <value>db64710c-fbbc-4dc9-8109-3925b87268fa</value> + </entry> + </subnetMap> +</createNetworkResponse>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json new file mode 100644 index 0000000000..dda149a560 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/defaultNetwork.json @@ -0,0 +1,10 @@ +{ + "networkTechnology": "NEUTRON", + "failIfExists": false, + "backout": true, + "networkParams": [], + "msoRequest": {}, + "contrailRequest": false, + "skipAAI": false, + "synchronous": true +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json new file mode 100644 index 0000000000..d5d234cbf6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/l3NetworkBbObject.json @@ -0,0 +1,226 @@ +{ + "sharedNetwork": false, + "boundToVpn": false, + "externalNetwork": false, + "providerNetwork": false, + "network-id": "TEST_NETWORK_ID", + "cascaded": false, + "cloud-params": null, + "network-name": "TEST_NETWORK_NAME", + "is-bound-to-vpn": false, + "service-id": null, + "network-role-instance": null, + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "widget-model-id": null, + "widget-model-version": null, + "physical-network-name": null, + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "self-link": null, + "operational-status": null, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + }, + "ctag-assignments": [ + ], + "segmentation-assignments": [ + ], + "model-info-network": null +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json new file mode 100644 index 0000000000..aa6320801e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/payloadUpdateCreated.json @@ -0,0 +1,216 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": { + "subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497", + "host-routes": { + "host-route": [ + { + "host-route-id": "400d286b-7e44-4514-b9b3-f70f7360ff32", + "route-prefix": "172.20.1.0/24", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857300987" + }, + { + "host-route-id": "6f038013-8b15-4eb8-914b-507489fbc8ee", + "route-prefix": "10.102.0.0/16", + "next-hop": "10.102.200.1", + "next-hop-type": "ip-address", + "resource-version": "1505857301151" + }, + { + "host-route-id": "8811c5f8-f1ed-4fa0-a505-e1be60396e28", + "route-prefix": "192.168.2.0/25", + "next-hop": "10.102.200.1", + "resource-version": "1505857301954" + } + ] + } + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + } + ] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + } + ] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + } + ] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ + { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + } + ], + "related-to-property": [ + { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + } + ] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ + { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + } + ], + "related-to-property": [ + { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + } + ] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +} diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json new file mode 100644 index 0000000000..5addff2d70 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json new file mode 100644 index 0000000000..fadbf9c244 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegion25.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "2.5", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json new file mode 100644 index 0000000000..97611c1d62 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAICloudRegionError.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "ERROR", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json new file mode 100644 index 0000000000..181494dff2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json @@ -0,0 +1,141 @@ +{ + "network-id": "467e3349-bec1-4922-bcb1-d0bb041bce30", + "network-name": "vprobes_pktinternal_net_4_1806", + "network-type": "CONTRAIL30_BASIC", + "network-role": "NetworkPktinternalInt2.pktinternal_int", + "network-technology": "", + "is-bound-to-vpn": false, + "service-id": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "network-role-instance": 0, + "resource-version": "1527285069624", + "orchestration-status": "Assigned", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/eb68dedb-840d-4bd4-a745-d9fcd8fc8468/service-data/networks/network/467e3349-bec1-4922-bcb1-d0bb041bce30/network-data/network-topology/", + "subnets": { + "subnet": [ + { + "subnet-id": "46aee427-3aa0-4c1f-beb6-edf6caae2dc1", + "subnet-name": "vprobes_pktinternal_net_4_1806_subnet_1", + "gateway-address": "192.168.224.1", + "network-start-address": "192.168.224.0", + "cidr-mask": "21", + "ip-version": "4", + "orchestration-status": "PendingCreate", + "dhcp-enabled": false, + "dhcp-start": "192.168.224.3", + "dhcp-end": "192.168.224.5", + "subnet-role": "DHCP", + "ip-assignment-direction": "true", + "resource-version": "1527285068387", + "host-routes": { + "host-route": [ + { + "host-route-id": "1de02743-580a-4f99-8285-3ba6eadb0892", + "route-prefix": "", + "next-hop": "", + "resource-version": "1527285059650" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v12/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Mobility/service-instances/service-instance/eb68dedb-840d-4bd4-a745-d9fcd8fc8468", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "Mobility" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "eb68dedb-840d-4bd4-a745-d9fcd8fc8468" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "lcp" + } + ] + }, + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/2871503957144f72b3cf481b379828ec", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "2871503957144f72b3cf481b379828ec" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "APP-C-24595-T-IST-04A" + } + ] + }, + { + "related-to": "vpn-binding", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "vMDNS" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json new file mode 100644 index 0000000000..b22f389c40 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponse.json @@ -0,0 +1,166 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json new file mode 100644 index 0000000000..c581e54ef0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json @@ -0,0 +1,53 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json new file mode 100644 index 0000000000..5d9231d4c6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json @@ -0,0 +1,891 @@ +{ + "vpn-id": "13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "vpn-name": "vMDNS", + "resource-version": "1510956324462", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/b3376949-5487-4a74-9029-332c07720c07", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b3376949-5487-4a74-9029-332c07720c07" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_hsl_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d0b8ecd3-aee4-48ba-8bc5-222d3fb08162", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d0b8ecd3-aee4-48ba-8bc5-222d3fb08162" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/34305bd0-ad54-4349-8567-6f65ea09e750", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "34305bd0-ad54-4349-8567-6f65ea09e750" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dfa4972a-ed82-43cd-98be-ed73bb3406a9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dfa4972a-ed82-43cd-98be-ed73bb3406a9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_EXN_INTERNET_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/93556256-aa23-449d-a2fd-3a9c034f232a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "93556256-aa23-449d-a2fd-3a9c034f232a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7ce01c3a-5998-4908-85f6-ab29bc507a92", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7ce01c3a-5998-4908-85f6-ab29bc507a92" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/016d3722-999b-4133-b4e6-8a1088bab664", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "016d3722-999b-4133-b4e6-8a1088bab664" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND-vepdg-FN-Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/80038196-9eae-452c-ad06-1f3fef1bef9f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "80038196-9eae-452c-ad06-1f3fef1bef9f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net420" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f5f38447-dc62-4969-90a3-c60474f9c0ac", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f5f38447-dc62-4969-90a3-c60474f9c0ac" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/58b374aa-01ca-4a39-99b9-889c2f7ae908", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "58b374aa-01ca-4a39-99b9-889c2f7ae908" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAM_MGMT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/efe0dfca-18e7-4992-a63a-041b9f8271e0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "efe0dfca-18e7-4992-a63a-041b9f8271e0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_APN-dns_int_apn_dns_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/dab7e704-6a6e-4c53-9a80-fb5857a43b6f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "dab7e704-6a6e-4c53-9a80-fb5857a43b6f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/634653b3-9084-41d9-ad6a-40863a3d666f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "634653b3-9084-41d9-ad6a-40863a3d666f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01A_int_fw_dns_trusted_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6117b35e-c029-4308-85e6-007c24014484", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6117b35e-c029-4308-85e6-007c24014484" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_int_mgmt_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/eb1ce51b-d10f-4b08-9166-345335b9f73b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "eb1ce51b-d10f-4b08-9166-345335b9f73b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_OAMP_NSD_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/468f83be-4abb-4901-950b-e399b77a09a0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "468f83be-4abb-4901-950b-e399b77a09a0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_IRPR-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/103d17dc-6575-427c-a2c1-301493e08ec0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "103d17dc-6575-427c-a2c1-301493e08ec0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/305214f8-64be-4209-8a0d-10b6dfb77dd1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "305214f8-64be-4209-8a0d-10b6dfb77dd1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vMDS_FN_int_fw_dns_trusted_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7989a6d2-ba10-4a5d-8f15-4520bc833090", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7989a6d2-ba10-4a5d-8f15-4520bc833090" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cor_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f040ebf4-76ad-4b05-a766-1deec26549ae", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f040ebf4-76ad-4b05-a766-1deec26549ae" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/26d6038b-4b9e-4fe5-bcff-9af7586651cc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "26d6038b-4b9e-4fe5-bcff-9af7586651cc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-D-T001_vprobes_pktinternal_net_10" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9e78d3f4-85b5-40b8-803e-c3a0ab6d6165", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9e78d3f4-85b5-40b8-803e-c3a0ab6d6165" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_MNS_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a2de22f9-eb91-452e-aff5-e81a1a679ef6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a2de22f9-eb91-452e-aff5-e81a1a679ef6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6d6b7254-72d2-4731-80d6-8e8375d959e9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6d6b7254-72d2-4731-80d6-8e8375d959e9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/21819ac4-95c4-490f-ba7c-0ad92920f805", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "21819ac4-95c4-490f-ba7c-0ad92920f805" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/98ff6827-320a-4b71-bd2b-df2bd20b6855", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "98ff6827-320a-4b71-bd2b-df2bd20b6855" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/e229ab86-279c-4505-a08a-91e373293e20", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e229ab86-279c-4505-a08a-91e373293e20" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_OAM_DIRECT_NET_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/bb722f93-2d1a-42a5-bd11-57ad30ff1085", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "bb722f93-2d1a-42a5-bd11-57ad30ff1085" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_segw_hsl_direct_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0399443d-1fc6-42a6-934c-77030d751916", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0399443d-1fc6-42a6-934c-77030d751916" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-PED-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/d259ec74-304d-4bd2-bbd6-93c201acba42", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d259ec74-304d-4bd2-bbd6-93c201acba42" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A__vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f69fb458-e2bd-4d0f-9a47-430d18cbebfd", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f69fb458-e2bd-4d0f-9a47-430d18cbebfd" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN-26071-T-BE-01_cdr_direct_net4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f18b91f-ee79-403b-a081-8c0a89650641", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f18b91f-ee79-403b-a081-8c0a89650641" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VPMS-FN_int_pktinternal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/90fdbbbb-42bb-41ff-9356-db245466a4fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "90fdbbbb-42bb-41ff-9356-db245466a4fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0e66adce-d5dd-4968-bcb2-83f0281424db", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0e66adce-d5dd-4968-bcb2-83f0281424db" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKEN_VDBF-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/db572383-dbd7-4d5e-93cb-8c7c1d209a90", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "db572383-dbd7-4d5e-93cb-8c7c1d209a90" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/478b7f86-8544-48e5-95f1-568dfd18730d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "478b7f86-8544-48e5-95f1-568dfd18730d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_GN_DIRECT_NET_01" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0f725895-5224-4016-b49a-d9d016eaafff", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0f725895-5224-4016-b49a-d9d016eaafff" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/9cd47b0c-ee58-46f0-9ec5-b4db504dd59b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9cd47b0c-ee58-46f0-9ec5-b4db504dd59b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-FN-25180-T-01Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/f95259c9-f5c6-4861-a9f4-b6eec199b33f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f95259c9-f5c6-4861-a9f4-b6eec199b33f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_oam_protected_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/caf98ee4-2496-4c92-a41c-b6a50efcc29f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "caf98ee4-2496-4c92-a41c-b6a50efcc29f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_MGM-CORE-NSD-TOAM0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/754739cb-5371-4d5b-a02a-489587d17443", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "754739cb-5371-4d5b-a02a-489587d17443" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_Shared_OAM_DIRECT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8cd7add8-0cfc-4f65-bbf8-d0f25a0dbc70" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/7093921f-bed8-4866-bb3c-a2b8c376ca69", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7093921f-bed8-4866-bb3c-a2b8c376ca69" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VIRPR-TDAT0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/691da8b2-805e-4dd1-aaf5-b0e37414c662", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "691da8b2-805e-4dd1-aaf5-b0e37414c662" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_int_pktmirror_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/00eaa0b3-90df-4b43-a850-9d30abb7fded", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "00eaa0b3-90df-4b43-a850-9d30abb7fded" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_oam_protected_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6ba57200-c61a-46be-821b-88b3fa169b66", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ba57200-c61a-46be-821b-88b3fa169b66" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_3" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8e32ec2c-47a1-4514-b21a-2806e23f0437", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8e32ec2c-47a1-4514-b21a-2806e23f0437" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/a755ddd0-512a-444d-9f38-97b3eff70f85", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "a755ddd0-512a-444d-9f38-97b3eff70f85" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_UNTR_VSE_ISBC0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c7bde85d-1c12-467c-ae6f-57bdf5c1d380", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7bde85d-1c12-467c-ae6f-57bdf5c1d380" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B-VSHAKENb_VDBF-PSD-DMZ0_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/0933fcec-9e78-4045-a21a-8258e18cb78e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0933fcec-9e78-4045-a21a-8258e18cb78e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vdbe_oam_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/6a26a729-d9ce-4619-a20e-38597205ba7d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6a26a729-d9ce-4619-a20e-38597205ba7d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c1a06665-518b-408b-bfe0-8f393204baf6", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1a06665-518b-408b-bfe0-8f393204baf6" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/fb51398b-7622-4570-9bd6-e29c82621d44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb51398b-7622-4570-9bd6-e29c82621d44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02B_OAM_MGMT_NET_4" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/92072731-1c40-45c2-a218-5e75b713b312", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92072731-1c40-45c2-a218-5e75b713b312" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_TRST_VIF_ISBC0_net_0001" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c6d94632-fd6b-4bfe-993e-377b0368476b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c6d94632-fd6b-4bfe-993e-377b0368476b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-01AShared_int_ha_net_5" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/84516ef3-e371-4039-908e-83cd2b55a4a1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "84516ef3-e371-4039-908e-83cd2b55a4a1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "VPMS-FN-26071-T-BE-01_vprobes_int_mgmt_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/2c4f3adc-1a45-4484-8fb6-9eeac99eb922", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "2c4f3adc-1a45-4484-8fb6-9eeac99eb922" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_VDBE-MIS-UDAT0_net_0" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1fea0624-dac2-4997-904d-34ca1bc12fa9", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1fea0624-dac2-4997-904d-34ca1bc12fa9" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02AShared_cps_internal_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8ab98982-05b7-45b2-828d-648da3d6cc0f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8ab98982-05b7-45b2-828d-648da3d6cc0f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vEPDG-FN-26642-T-01_swu_direct_fn_net_2" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c8934d59-24a8-41cc-af9d-2026ef261843", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c8934d59-24a8-41cc-af9d-2026ef261843" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APPC-24595-T-IST-02A_Shared_oam_protected_net_vrar_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c741fe5b-bf27-4ad9-b30d-20518e115495", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c741fe5b-bf27-4ad9-b30d-20518e115495" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_int_apn_dns_fn_net_PB_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/8285fbae-ec25-44f7-ac52-89a968d45a2b", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8285fbae-ec25-44f7-ac52-89a968d45a2b" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-T2B_vEPDG-FN_swu_direct_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/65e6d4b0-0c96-4bfa-bdd6-2baa16df322a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65e6d4b0-0c96-4bfa-bdd6-2baa16df322a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-DND_vEPDG-FN_gn_untrusted_fn_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/38e51c7b-adc2-491a-a036-3189645b007c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "38e51c7b-adc2-491a-a036-3189645b007c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_2_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/4d210b09-b6ce-41b3-95a6-5e4dffea9ca2", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4d210b09-b6ce-41b3-95a6-5e4dffea9ca2" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_3_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/c5df1c57-3c85-4abc-973f-a1ffb13e391a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c5df1c57-3c85-4abc-973f-a1ffb13e391a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_1" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/467e3349-bec1-4922-bcb1-d0bb041bce30", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "467e3349-bec1-4922-bcb1-d0bb041bce30" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "vprobes_pktinternal_net_4_1806" + }] + }, + { + "related-to": "l3-network", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v12/network/l3-networks/l3-network/1596f4d2-66b5-4627-96f2-c26794154530", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1596f4d2-66b5-4627-96f2-c26794154530" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_2" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml new file mode 100644 index 0000000000..6dd91c64c9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/queryIdAAIResponse.xml @@ -0,0 +1,145 @@ +<l3-network xmlns="http://org.onap.aai.inventory/v11"> + <network-id>8d35a433-c1db-4d54-a611-6de10aeb76f9</network-id> + <network-name>Dev_Bindings_1802_1311</network-name> + <network-type>CONTRAIL30_BASIC</network-type> + <network-role>GN_EVPN_direct</network-role> + <network-technology>contrail</network-technology> + <is-bound-to-vpn>true</is-bound-to-vpn> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <network-role-instance>0</network-role-instance> + <resource-version>1517430804756</resource-version> + <orchestration-status>pending-create</orchestration-status> + <physical-network-name>tbd</physical-network-name> + <is-provider-network>true</is-provider-network> + <is-shared-network>true</is-shared-network> + <is-external-network>false</is-external-network> + <subnets> + <subnet> + <subnet-id>9dbb9e7e-fe18-421f-bad6-2305bd282471</subnet-id> + <subnet-name /> + <gateway-address>107.118.41.1</gateway-address> + <network-start-address>107.118.41.0</network-start-address> + <cidr-mask>24</cidr-mask> + <ip-version>4</ip-version> + <orchestration-status>pending-create</orchestration-status> + <dhcp-enabled>true</dhcp-enabled> + <dhcp-start>107.118.41.3</dhcp-start> + <dhcp-end>107.118.41.45</dhcp-end> + <subnet-role /> + <ip-assignment-direction>true</ip-assignment-direction> + <resource-version>1517430804770</resource-version> + </subnet> + <subnet> + <subnet-id>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</subnet-id> + <subnet-name /> + <gateway-address>107.118.42.1</gateway-address> + <network-start-address>107.118.42.0</network-start-address> + <cidr-mask>24</cidr-mask> + <ip-version>4</ip-version> + <orchestration-status>pending-create</orchestration-status> + <dhcp-enabled>true</dhcp-enabled> + <dhcp-start>107.118.42.3</dhcp-start> + <dhcp-end>107.118.42.45</dhcp-end> + <subnet-role /> + <ip-assignment-direction>true</ip-assignment-direction> + <resource-version>1517430804782</resource-version> + </subnet> + </subnets> + <relationship-list> + <relationship> + <related-to>service-instance</related-to> + <related-link>/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723</related-link> + <relationship-data> + <relationship-key>customer.global-customer-id</relationship-key> + <relationship-value>MSO_1610_dev</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>service-subscription.service-type</relationship-key> + <relationship-value>MSO-dev-service-type</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>service-instance.service-instance-id</relationship-key> + <relationship-value>f1d1c7da-fc42-4c31-866e-cfe963e55723</relationship-value> + </relationship-data> + <related-to-property> + <property-key>service-instance.service-instance-name</property-key> + <property-value>MSO-DEV-SI-1802-v6-1-31-nwk1</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>cloud-region</related-to> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>mtn6</relationship-value> + </relationship-data> + <related-to-property> + <property-key>cloud-region.owner-defined-type</property-key> + <property-value>LCP</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>tenant</related-to> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>mtn6</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>0422ffb57ba042c0800a29dc85ca70f8</relationship-value> + </relationship-data> + <related-to-property> + <property-key>tenant.tenant-name</property-key> + <property-value>ECOMP_MSO_DND</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>network-policy</related-to> + <related-link>/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc</related-link> + <relationship-data> + <relationship-key>network-policy.network-policy-id</relationship-key> + <relationship-value>0219d83f-7c4a-48e2-b8fc-9b20459356bc</relationship-value> + </relationship-data> + <related-to-property> + <property-key>network-policy.network-policy-fqdn</property-key> + <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyD</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>network-policy</related-to> + <related-link>/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64</related-link> + <relationship-data> + <relationship-key>network-policy.network-policy-id</relationship-key> + <relationship-value>e7a3560c-8b29-4611-a404-83af0b31ce64</relationship-value> + </relationship-data> + <related-to-property> + <property-key>network-policy.network-policy-fqdn</property-key> + <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyC</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>vpn-binding</related-to> + <related-link>/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001</related-link> + <relationship-data> + <relationship-key>vpn-binding.vpn-id</relationship-key> + <relationship-value>9a7b327d9-287aa00-82c4b0-100001</relationship-value> + </relationship-data> + <related-to-property> + <property-key>vpn-binding.vpn-name</property-key> + <property-value>MSO_VPN_TEST</property-value> + </related-to-property> + <related-to-property> + <property-key>vpn-binding.vpn-type</property-key> + </related-to-property> + </relationship> + </relationship-list> +</l3-network>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json new file mode 100644 index 0000000000..f076c9044c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/unassignNetworkBB_queryAAIResponse_.json @@ -0,0 +1,162 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "vf-module", + "related-link": "aai/v11/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "105df7e5-0b3b-49f7-a837-4864b62827c4" + }, + { + "relationship-key": "vf-module.vf-module-id", + "relationship-value": "d9217058-95a0-49ee-b9a9-949259e89349" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml new file mode 100644 index 0000000000..92fec2dc64 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/Network/updateContrailAAIPayloadRequest.xml @@ -0,0 +1,149 @@ +<l3-network xmlns="http://org.onap.aai.inventory/v11"> + <network-id>8d35a433-c1db-4d54-a611-6de10aeb76f9</network-id> + <network-name>Dev_Bindings_1802_1311</network-name> + <network-type>CONTRAIL30_BASIC</network-type> + <network-role>GN_EVPN_direct</network-role> + <network-technology>contrail</network-technology> + <neutron-network-id>b6a7820c-4734-4ef2-8a73-a22c824423fa</neutron-network-id> + <is-bound-to-vpn>true</is-bound-to-vpn> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + <network-role-instance>0</network-role-instance> + <resource-version>1517430804756</resource-version> + <orchestration-status>Created</orchestration-status> + <heat-stack-id>Dev_Bindings_1802_1311/ecf7e197-72db-452e-9eda-253cb642c9b7</heat-stack-id> + <contrail-network-fqdn>default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_1311</contrail-network-fqdn> + <physical-network-name>tbd</physical-network-name> + <is-provider-network>true</is-provider-network> + <is-shared-network>true</is-shared-network> + <is-external-network>false</is-external-network> + <subnets> + <subnet> + <subnet-id>9dbb9e7e-fe18-421f-bad6-2305bd282471</subnet-id> + <neutron-subnet-id>27d414c7-1076-4595-aa45-4717ee992cef</neutron-subnet-id> + <gateway-address>107.118.41.1</gateway-address> + <network-start-address>107.118.41.0</network-start-address> + <cidr-mask>24</cidr-mask> + <ip-version>4</ip-version> + <orchestration-status>Created</orchestration-status> + <dhcp-enabled>true</dhcp-enabled> + <dhcp-start>107.118.41.3</dhcp-start> + <dhcp-end>107.118.41.45</dhcp-end> + <resource-version>1517430804770</resource-version> + <subnet-name/> + <ip-assignment-direction>true</ip-assignment-direction> + </subnet> + <subnet> + <subnet-id>1bb4e1d2-d225-47f3-b6fc-2d0b290de1ab</subnet-id> + <neutron-subnet-id>db64710c-fbbc-4dc9-8109-3925b87268fa</neutron-subnet-id> + <gateway-address>107.118.42.1</gateway-address> + <network-start-address>107.118.42.0</network-start-address> + <cidr-mask>24</cidr-mask> + <ip-version>4</ip-version> + <orchestration-status>Created</orchestration-status> + <dhcp-enabled>true</dhcp-enabled> + <dhcp-start>107.118.42.3</dhcp-start> + <dhcp-end>107.118.42.45</dhcp-end> + <resource-version>1517430804782</resource-version> + <subnet-name/> + <ip-assignment-direction>true</ip-assignment-direction> + </subnet> + </subnets> + <relationship-list> + <relationship> + <related-to>service-instance</related-to> + <related-link>/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/f1d1c7da-fc42-4c31-866e-cfe963e55723</related-link> + <relationship-data> + <relationship-key>customer.global-customer-id</relationship-key> + <relationship-value>MSO_1610_dev</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>service-subscription.service-type</relationship-key> + <relationship-value>MSO-dev-service-type</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>service-instance.service-instance-id</relationship-key> + <relationship-value>f1d1c7da-fc42-4c31-866e-cfe963e55723</relationship-value> + </relationship-data> + <related-to-property> + <property-key>service-instance.service-instance-name</property-key> + <property-value>MSO-DEV-SI-1802-v6-1-31-nwk1</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>cloud-region</related-to> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6</related-link> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>mtn6</relationship-value> + </relationship-data> + <related-to-property> + <property-key>cloud-region.owner-defined-type</property-key> + <property-value>LCP</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>tenant</related-to> + <related-link>/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8</related-link> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>mtn6</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>0422ffb57ba042c0800a29dc85ca70f8</relationship-value> + </relationship-data> + <related-to-property> + <property-key>tenant.tenant-name</property-key> + <property-value>ECOMP_MSO_DND</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>network-policy</related-to> + <related-link>/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc</related-link> + <relationship-data> + <relationship-key>network-policy.network-policy-id</relationship-key> + <relationship-value>0219d83f-7c4a-48e2-b8fc-9b20459356bc</relationship-value> + </relationship-data> + <related-to-property> + <property-key>network-policy.network-policy-fqdn</property-key> + <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyD</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>network-policy</related-to> + <related-link>/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64</related-link> + <relationship-data> + <relationship-key>network-policy.network-policy-id</relationship-key> + <relationship-value>e7a3560c-8b29-4611-a404-83af0b31ce64</relationship-value> + </relationship-data> + <related-to-property> + <property-key>network-policy.network-policy-fqdn</property-key> + <property-value>default-domain:ECOMP_MSO_DND:MSOPolicyC</property-value> + </related-to-property> + </relationship> + <relationship> + <related-to>vpn-binding</related-to> + <related-link>/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001</related-link> + <relationship-data> + <relationship-key>vpn-binding.vpn-id</relationship-key> + <relationship-value>9a7b327d9-287aa00-82c4b0-100001</relationship-value> + </relationship-data> + <related-to-property> + <property-key>vpn-binding.vpn-name</property-key> + <property-value>MSO_VPN_TEST</property-value> + </related-to-property> + <related-to-property> + <property-key>vpn-binding.vpn-type</property-key> + <property-value/> + </related-to-property> + </relationship> + </relationship-list> +</l3-network>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json new file mode 100644 index 0000000000..75ecffb85f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/bbNetwork.json @@ -0,0 +1,87 @@ +{ + "externalNetwork": false, + "sharedNetwork": false, + "providerNetwork": false, + "boundToVpn": false, + "network-id": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "cascaded": false, + "cloud-params": { + + }, + "network-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "neutron-network-id": null, + "network-type": "CONTRAIL30_BASIC", + "network-technology": "contrail", + "network-role": "DataEvaletNetwork.data", + "is-bound-to-vpn": false, + "service-id": "94508dbd-fe6e-496b-95ef-dd5612b56767", + "network-role-instance": 0, + "orchestration-status": "ASSIGNED", + "heat-stack-id": null, + "contrail-network-fqdn": null, + "network-policies": [], + "contrail-network-route-table-references": [], + "widget-model-id": null, + "widget-model-version": null, + "physical-network-name": "FALSE", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "self-link": "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/", + "operational-status": null, + "subnets": [ + { + "subnet-id": "95069612-23af-4181-bf99-8b2bd6096712", + "subnet-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "neutron-subnet-id": null, + "gateway-address": "107.244.64.1", + "network-start-address": "107.244.64.2", + "cidr-mask": "20", + "ip-version": "4", + "orchestration-status": null, + "dhcp-enabled": false, + "dhcp-start": "", + "dhcp-end": "", + "subnet-role": "", + "ip-assignment-direction": "true", + "subnet-sequence": null, + "host-routes": [] + } + ], + "ctag-assignments": [], + "segmentation-assignments": [], + "model-info-network": { + "created": 1509357220000, + "modelInstanceName": "CONTRAIL30_BASIC", + "networkType": "BASIC", + "modelCustomizationUUID": "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "modelUUID": "2920cd06-f585-436b-a002-c3081f6a91b3", + "modelName": "CONTRAIL30_BASIC", + "modelVersion": "3.0", + "modelInvariantUUID": "56f4e746-c58e-4b76-93d4-6717b8f59205", + "networkRole": "DataEvaletNetwork.data", + "neutronNetworkType": "BASIC", + "toscaNodeType": "org.openecomp.resource.vl.CONTRAIL30_BASIC1", + "description": "Basic contrail 3.0.x L3 network for AIC 3.x sites. Keeping for existing mobility networks. ", + "orchestrationMode": "HEAT", + "aicVersionMin": "3.0", + "aicVersionMax": null, + "networkScope": "Service", + "networkTechnology": "contrail", + "model-customization-uuid": "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "model-instance-name": "CONTRAIL30_BASIC", + "network-technology": "contrail", + "network-type": "BASIC", + "network-scope": "Service", + "network-role": "DataEvaletNetwork.data", + "model-version": "3.0", + "model-invariant-uuid": "56f4e746-c58e-4b76-93d4-6717b8f59205", + "model-name": "CONTRAIL30_BASIC", + "model-uuid": "2920cd06-f585-436b-a002-c3081f6a91b3", + "neutron-network-type": "BASIC", + "aic-version-min": "3.0", + "aic-version-max": null, + "orchestration-mode": "HEAT", + "tosca-node-type": "org.openecomp.resource.vl.CONTRAIL30_BASIC1" + } +}
\ No newline at end of file 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 new file mode 100644 index 0000000000..087f8a3971 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json @@ -0,0 +1,42 @@ +{ + "cloudSiteId": "cloudRegionPo", + "tenantId": "testTenantId", + "networkId": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "networkName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "networkType": "CONTRAIL30_BASIC", + "modelCustomizationUuid": "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "networkTechnology": "NEUTRON", + "subnets": [ + { + "subnetName": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "subnetId": "95069612-23af-4181-bf99-8b2bd6096712", + "cidr": "107.244.64.2/20", + "gatewayIp": "107.244.64.1", + "ipVersion": "4", + "enableDHCP": false, + "addrFromStart": true, + "hostRoutes": [] + } + ], + "providerVlanNetwork": { + "physicalNetworkName": "FALSE", + "vlans": [] + }, + "contrailNetwork": { + "shared": "false", + "external": "false", + "routeTargets": [], + "policyFqdns": [], + "routeTableFqdns": [] + }, + "failIfExists": true, + "backout": false, + "msoRequest": { + "requestId": "6cfde724-76c7-4747-bcb3-67a59a46ca95", + "serviceInstanceId": "testServiceInstanceId1" + }, + "contrailRequest": false, + "skipAAI": true, + "messageId": "175264dc-fb6b-4aae-ba42-8c77a63fec12", + "synchronous": true +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json new file mode 100644 index 0000000000..4817dfb74d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/generalBB.json @@ -0,0 +1,153 @@ +{ + "requestContext" : { + "product-family-id" : "e433710f-9217-458d-a79d-1c7aff376d89", + "source" : "VID", + "requestor-id" : "rk627c", + "subscription-service-type" : null, + "user-params" : null, + "action" : "createInstance", + "callback-url" : null, + "service-uri" : null, + "mso-request-id" : "91135621-cadd-4195-a11b-c9db9eb1629e", + "requestParameters" : { } + }, + "orchContext" : { + "is-rollback-enabled" : false + }, + "userInput" : null, + "serviceInstance" : { + "service-instance-id" : "94508dbd-fe6e-496b-95ef-dd5612b56767", + "service-instance-name" : "data_eValet_network_rk_01", + "orchestration-status" : "ACTIVE", + "owning-entity" : { + "owning-entity-id" : "e4257a94-21cc-40c5-adc9-e6f4ff868e31", + "owning-entity-name" : "MOBILITY-CORE" + }, + "project" : { + "project-name" : "USP" + }, + "collection" : null, + "vnfs" : [ ], + "pnfs" : [ ], + "allotted-resources" : [ ], + "networks" : [ { + "network-id" : "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "cascaded" : false, + "cloud-params" : { }, + "network-name" : "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "neutron-network-id" : null, + "network-type" : "CONTRAIL30_BASIC", + "network-technology" : "contrail", + "network-role" : "DataEvaletNetwork.data", + "is-bound-to-vpn" : false, + "service-id" : "94508dbd-fe6e-496b-95ef-dd5612b56767", + "network-role-instance" : 0, + "orchestration-status" : "ASSIGNED", + "heat-stack-id" : null, + "contrail-network-fqdn" : null, + "network-policies" : [ ], + "contrail-network-route-table-references" : [ ], + "widget-model-id" : null, + "widget-model-version" : null, + "physical-network-name" : "FALSE", + "is-provider-network" : false, + "is-shared-network" : false, + "is-external-network" : false, + "self-link" : "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/", + "operational-status" : null, + "subnets" : [ { + "subnet-id" : "95069612-23af-4181-bf99-8b2bd6096712", + "subnet-name" : "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "neutron-subnet-id" : null, + "gateway-address" : "107.244.64.1", + "network-start-address" : "107.244.64.2", + "cidr-mask" : "20", + "ip-version" : "4", + "orchestration-status" : null, + "dhcp-enabled" : false, + "dhcp-start" : "", + "dhcp-end" : "", + "subnet-role" : "", + "ip-assignment-direction" : "true", + "subnet-sequence" : null, + "host-routes" : [ ] + } ], + "ctag-assignments" : [ ], + "segmentation-assignments" : [ ], + "model-info-network" : { + "created" : 1509357220000, + "modelInstanceName" : "CONTRAIL30_BASIC", + "networkType" : "BASIC", + "modelCustomizationUUID" : "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "modelUUID" : "2920cd06-f585-436b-a002-c3081f6a91b3", + "modelName" : "CONTRAIL30_BASIC", + "modelVersion" : "3.0", + "modelInvariantUUID" : "56f4e746-c58e-4b76-93d4-6717b8f59205", + "networkRole" : "DataEvaletNetwork.data", + "neutronNetworkType" : "BASIC", + "toscaNodeType" : "org.openecomp.resource.vl.CONTRAIL30_BASIC1", + "description" : "Basic contrail 3.0.x L3 network for AIC 3.x sites. Keeping for existing mobility networks. ", + "orchestrationMode" : "HEAT", + "aicVersionMin" : "3.0", + "aicVersionMax" : null, + "networkScope" : "Service", + "networkTechnology" : "contrail", + "model-customization-uuid" : "8edf06ef-fd40-42cf-a054-0fc09108d3f0", + "model-instance-name" : "CONTRAIL30_BASIC", + "network-technology" : "contrail", + "network-type" : "BASIC", + "network-scope" : "Service", + "network-role" : "DataEvaletNetwork.data", + "model-version" : "3.0", + "model-invariant-uuid" : "56f4e746-c58e-4b76-93d4-6717b8f59205", + "model-name" : "CONTRAIL30_BASIC", + "model-uuid" : "2920cd06-f585-436b-a002-c3081f6a91b3", + "neutron-network-type" : "BASIC", + "aic-version-min" : "3.0", + "aic-version-max" : null, + "orchestration-mode" : "HEAT", + "tosca-node-type" : "org.openecomp.resource.vl.CONTRAIL30_BASIC1" + } + } ], + "vpn-bonding-links" : [ ], + "vhn-portal-url" : null, + "service-instance-location-id" : null, + "selflink" : "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/service-topology/", + "metadata" : null, + "configurations" : null, + "solution-info" : null, + "model-info-service-instance" : { + "model-customization-uuid" : null, + "model-invariant-uuid" : "97386301-3685-46b5-8a5a-bf113eb9a006", + "model-uuid" : "4d6f5876-7f3d-458e-9722-33af804ee717", + "model-version" : "1.0", + "model-instance-name" : null, + "model-name" : "data_eValet_network", + "description" : "data model", + "created" : "Thu Jul 05 19:48:51 GMT 2018", + "service-type" : "vUSP", + "service-role" : "data", + "environment-context" : "General_Revenue-Bearing", + "workload-context" : "Production" + } + }, + "cloudRegion" : { + "lcp-cloud-region-id" : "DYH1A", + "cloud-owner" : "att-aic", + "tenant-id" : "7f3db563322146a688601ade1294a749", + "complex" : "c1", + "cloud-region-version" : "aic3.0" + }, + "customer" : { + "global-customer-id" : "e433710f-9217-458d-a79d-1c7aff376d89", + "subscriber-name" : "USP VOICE", + "subscriber-type" : "INFRA", + "subscriber-common-site-id" : null, + "service-subscription" : { + "service-type" : "VIRTUAL USP", + "temp-ub-sub-account-id" : null, + "service-instances" : [ ] + }, + "vpn-bindings" : [ ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json new file mode 100644 index 0000000000..36bc04b6c6 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/queryAAINetwork.json @@ -0,0 +1,141 @@ +{ + "network-id": "e87e6df5-6f9b-4aa1-a832-68a42c4277eb", + "network-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1", + "network-type": "CONTRAIL30_BASIC", + "network-role": "DataEvaletNetwork.data", + "network-technology": "contrail", + "is-bound-to-vpn": false, + "service-id": "94508dbd-fe6e-496b-95ef-dd5612b56767", + "network-role-instance": 0, + "resource-version": "1531421309278", + "orchestration-status": "Assigned", + "physical-network-name": "FALSE", + "is-provider-network": false, + "is-shared-network": false, + "is-external-network": false, + "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/94508dbd-fe6e-496b-95ef-dd5612b56767/service-data/networks/network/e87e6df5-6f9b-4aa1-a832-68a42c4277eb/network-data/network-topology/", + "subnets": { + "subnet": [ + { + "subnet-id": "95069612-23af-4181-bf99-8b2bd6096712", + "subnet-name": "APP-C-24595-T-IST-04AShared_data_vDB_net_1_subnet_1", + "gateway-address": "107.244.64.1", + "network-start-address": "107.244.64.2", + "cidr-mask": "20", + "ip-version": "4", + "orchestration-status": "PendingCreate", + "dhcp-enabled": false, + "dhcp-start": "", + "dhcp-end": "", + "subnet-role": "", + "ip-assignment-direction": "true", + "resource-version": "1531421308312", + "host-routes": { + "host-route": [ + { + "host-route-id": "1047bf36-ca6c-49de-8b7a-8aa7b766a96d", + "route-prefix": "", + "next-hop": "", + "resource-version": "1531421301537" + } + ] + } + } + ] + }, + "relationship-list": { + "relationship": [ + { + "related-to": "service-instance", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v13/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/VIRTUAL%20USP/service-instances/service-instance/94508dbd-fe6e-496b-95ef-dd5612b56767", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "VIRTUAL USP" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "94508dbd-fe6e-496b-95ef-dd5612b56767" + } + ], + "related-to-property": [ + { + "property-key": "service-instance.service-instance-name", + "property-value": "data_eValet_network_rk_01" + } + ] + }, + { + "related-to": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + } + ], + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type", + "property-value": "lcp" + } + ] + }, + { + "related-to": "tenant", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/att-aic/DYH1A/tenants/tenant/7f3db563322146a688601ade1294a749", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "DYH1A" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "7f3db563322146a688601ade1294a749" + } + ], + "related-to-property": [ + { + "property-key": "tenant.tenant-name", + "property-value": "APP-C-24595-T-IST-04B" + } + ] + }, + { + "related-to": "vpn-binding", + "relationship-label": "org.onap.relationships.inventory.Uses", + "related-link": "/aai/v13/network/vpn-bindings/vpn-binding/13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "relationship-data": [ + { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "13e94b71-3ce1-4988-ab0e-61208fc91f1c" + } + ], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "vMDNS" + }, + { + "property-key": "vpn-binding.vpn-type" + } + ] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json new file mode 100644 index 0000000000..ba7ab9e3b8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest1Vpn.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : [] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json new file mode 100644 index 0000000000..c5d0ffe38d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/SniroHoming/SniroManagerRequest3Vpn.json @@ -0,0 +1,6 @@ +{ + "requestInfo" : {"sourceId":"mso","requestType":"create","requestId":"testRequestId","callbackUrl":"http://localhost:28080/mso/WorkflowMesssage/SNIROResponse/testRequestId","transactionId":"testRequestId","timeout":1800}, + "serviceInfo" : {"modelInfo":{"modelName":"testModelName1","modelVersionId":"testModelUUID1","modelVersion":"testModelVersion1","modelInvariantId":"testModelInvariantUUID1"},"serviceInstanceId":"testServiceInstanceId1","serviceName":"testServiceType1"}, + "placementInfo" : {"subscriberInfo":{"subscriberName":"testCustomerName","globalSubscriberId":"testCustomerId"},"placementDemands":[{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"},{"resourceModelInfo":{"modelName":"testProxyModelName1","modelVersionId":"testProxyModelUuid1","modelVersion":"testProxyModelVersion1","modelInvariantId":"testProxyModelInvariantUuid1"},"resourceModuleName":"testProxyInstanceName1","serviceResourceId":"testProxyId1"},{"resourceModelInfo":{"modelName":"testProxyModelName2","modelVersionId":"testProxyModelUuid2","modelVersion":"testProxyModelVersion2","modelInvariantId":"testProxyModelInvariantUuid2"},"requiredCandidates":[{"candidateType":{"name":"vnfId"},"candidates":["testVnfId"]}],"resourceModuleName":"testProxyInstanceName2","serviceResourceId":"testProxyId2"}],"requestParameters":{"aLaCarte":false,"subscriptionServiceType":"iptollfree"}}, + "licenseInfo" : [] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json new file mode 100644 index 0000000000..7d26ab975b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiCtagAssingmentsMapped_to_aai.json @@ -0,0 +1,7 @@ +{ + "ctagAssignment" : [ { + "vlanIdInner" : 1, + "resourceVersion" : null, + "relationshipList" : null + } ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json new file mode 100644 index 0000000000..81362e3dca --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json @@ -0,0 +1,20 @@ +{ + "networkId": "networkId", + "networkName": "networkName", + "neutronNetworkId": "neutronNetworkId", + "isBoundToVpn": false, + "serviceId": "serviceId", + "networkRoleInstance": 0, + "orchestrationStatus": "Assigned", + "heatStackId": "heatStackId", + "contrailNetworkFqdn": "contrailNetworkFqdn", + "modelInvariantId": "modelInvariantUUID", + "modelVersionId": "modelUUID", + "modelCustomizationId": "modelCustomizationUUID", + "physicalNetworkName": "physicalNetworkName", + "isProviderNetwork": false, + "isSharedNetwork": false, + "isExternalNetwork": false, + "selflink": "selflink", + "operationalStatus": "operationalStatus" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json new file mode 100644 index 0000000000..7a30ade095 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json @@ -0,0 +1,118 @@ +{ + "networkId" : "TESTING_ID", + "networkName" : "TESTING_NAME", + "networkType" : "CONTRAIL_EXTERNAL", + "networkRole" : "dmz_direct", + "networkTechnology" : "contrail", + "neutronNetworkId" : null, + "isBoundToVpn" : false, + "serviceId" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "networkRoleInstance" : 1, + "resourceVersion" : null, + "orchestrationStatus" : "Created", + "heatStackId" : "heatStack_id", + "msoCatalogKey" : null, + "contrailNetworkFqdn" : "contrailNetwork_fqdn", + "modelInvariantId" : "modelInvariant_id", + "modelVersionId" : "modelCustomization_id", + "personaModelVersion" : null, + "modelCustomizationId" : "modelCustomization_id", + "widgetModelId" : "widgetModel_id", + "widgetModelVersion" : "widgetModel_version", + "physicalNetworkName" : "physicalNetwork_name", + "isProviderNetwork" : false, + "isSharedNetwork" : false, + "isExternalNetwork" : false, + "selflink" : "self_link", + "operationalStatus" : "operationalStatus", + "subnets" : { + "subnet" : [ { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + }, { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + } ] + }, + "ctagAssignments" : { + "ctagAssignment" : [ { + "vlanIdInner" : 1, + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "segmentationAssignments" : { + "segmentationAssignment" : [ { + "segmentationId" : "segmentationId1", + "resourceVersion" : null, + "relationshipList" : null + }, { + "segmentationId" : "segmentationId2", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json new file mode 100644 index 0000000000..b22f389c40 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiQueryAAIResponse-Wrapper.json @@ -0,0 +1,166 @@ +{ + "network-id": "0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "network-name": "Dev_Bindings_1802_020118", + "network-type": "CONTRAIL30_BASIC", + "network-role": "GN_EVPN_direct", + "network-technology": "contrail", + "neutron-network-id": "1112b912-0e00-4d6d-9392-014e106399ee", + "is-bound-to-vpn": true, + "service-id": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "network-role-instance": 0, + "resource-version": "1517496965485", + "orchestration-status": "Active", + "heat-stack-id": "Dev_Bindings_1802_020118/06c2445f-1ca1-4ad8-be08-454c4de443bb", + "contrail-network-fqdn": "default-domain:ECOMP_MSO_DND:Dev_Bindings_1802_020118", + "physical-network-name": "tbd", + "is-provider-network": false, + "is-shared-network": true, + "is-external-network": false, + "subnets": {"subnet": [ + { + "subnet-id": "209f62cf-cf0c-42f8-b13c-f038b92ef108", + "subnet-name": "", + "neutron-subnet-id": "3942ca32-5f5b-4d62-a2e4-b528b7a4318c", + "gateway-address": "192.168.41.1", + "network-start-address": "192.168.41.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.41.3", + "dhcp-end": "192.168.41.45", + "ip-assignment-direction": "", + "resource-version": "1517496965497" + }, + { + "subnet-id": "971bc608-1aff-47c0-923d-92e43b699f01", + "subnet-name": "", + "neutron-subnet-id": "81a5ff92-7ca4-4756-a493-496479f0d10f", + "gateway-address": "192.168.42.1", + "network-start-address": "192.168.42.0", + "cidr-mask": "24", + "ip-version": "4", + "orchestration-status": "Active", + "dhcp-enabled": true, + "dhcp-start": "192.168.42.3", + "dhcp-end": "192.168.42.45", + "ip-assignment-direction": "", + "resource-version": "1517496965508" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "service-instance", + "related-link": "/aai/v11/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/cc88915e-fb95-4b16-9c1e-a0abf40d1e40", + "relationship-data": [ + { + "relationship-key": "customer.global-customer-id", + "relationship-value": "MSO_1610_dev" + }, + { + "relationship-key": "service-subscription.service-type", + "relationship-value": "MSO-dev-service-type" + }, + { + "relationship-key": "service-instance.service-instance-id", + "relationship-value": "cc88915e-fb95-4b16-9c1e-a0abf40d1e40" + } + ], + "related-to-property": [ { + "property-key": "service-instance.service-instance-name", + "property-value": "MSO-DEV-SI-1802-v6-2-01-nwk1" + }] + }, + { + "related-to": "cloud-region", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + } + ], + "related-to-property": [ { + "property-key": "cloud-region.owner-defined-type", + "property-value": "LCP" + }] + }, + { + "related-to": "tenant", + "related-link": "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn6/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8", + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "att-aic" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "mtn6" + }, + { + "relationship-key": "tenant.tenant-id", + "relationship-value": "0422ffb57ba042c0800a29dc85ca70f8" + } + ], + "related-to-property": [ { + "property-key": "tenant.tenant-name", + "property-value": "ECOMP_MSO_DND" + }] + }, + { + "related-to": "route-table-reference", + "related-link": "/aai/v11/network/route-table-references/route-table-reference/c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "relationship-data": [ { + "relationship-key": "route-table-reference.route-table-reference-id", + "relationship-value": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00" + }], + "related-to-property": [ { + "property-key": "route-table-reference.route-table-reference-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:RTA" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/0219d83f-7c4a-48e2-b8fc-9b20459356bc", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "0219d83f-7c4a-48e2-b8fc-9b20459356bc" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyD" + }] + }, + { + "related-to": "network-policy", + "related-link": "/aai/v11/network/network-policies/network-policy/e7a3560c-8b29-4611-a404-83af0b31ce64", + "relationship-data": [ { + "relationship-key": "network-policy.network-policy-id", + "relationship-value": "e7a3560c-8b29-4611-a404-83af0b31ce64" + }], + "related-to-property": [ { + "property-key": "network-policy.network-policy-fqdn", + "property-value": "default-domain:ECOMP_MSO_DND:MSOPolicyC" + }] + }, + { + "related-to": "vpn-binding", + "related-link": "/aai/v11/network/vpn-bindings/vpn-binding/9a7b327d9-287aa00-82c4b0-100001", + "relationship-data": [ { + "relationship-key": "vpn-binding.vpn-id", + "relationship-value": "9a7b327d9-287aa00-82c4b0-100001" + }], + "related-to-property": [ + { + "property-key": "vpn-binding.vpn-name", + "property-value": "MSO_VPN_TEST" + }, + {"property-key": "vpn-binding.vpn-type"} + ] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json new file mode 100644 index 0000000000..9da44edd74 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSegmentationAssignmentsMapped_to_aai.json @@ -0,0 +1,11 @@ +{ + "segmentationAssignment" : [ { + "segmentationId" : "segmentationId1", + "resourceVersion" : null, + "relationshipList" : null + }, { + "segmentationId" : "segmentationId2", + "resourceVersion" : null, + "relationshipList" : null + } ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json new file mode 100644 index 0000000000..4046348673 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiSubnetsMapped_to_aai.json @@ -0,0 +1,71 @@ +{ + "subnet" : [ { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + }, { + "subnetId" : "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + "subnetName" : "subnetName", + "neutronSubnetId" : null, + "gatewayAddress" : "192.168.52.1", + "networkStartAddress" : null, + "cidrMask" : "24", + "ipVersion" : "4", + "orchestrationStatus" : "Created", + "dhcpEnabled" : true, + "dhcpStart" : "dhcpStart", + "dhcpEnd" : "dhcpEnd", + "subnetRole" : "subnetRole", + "ipAssignmentDirection" : "true", + "resourceVersion" : null, + "subnetSequence" : 3, + "hostRoutes" : { + "hostRoute" : [ { + "hostRouteId" : "string", + "routePrefix" : "192.10.16.0/24", + "nextHop" : "192.10.16.100/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + }, { + "hostRouteId" : "string", + "routePrefix" : "192.110.17.0/24", + "nextHop" : "192.110.17.110/24", + "nextHopType" : "ip-address", + "resourceVersion" : null, + "relationshipList" : null + } ] + }, + "relationshipList" : null + } ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json new file mode 100644 index 0000000000..09ec71f0aa --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleMap.json @@ -0,0 +1,12 @@ +{ + + "modelCustomizationId" : "f", + "vfModuleId" : "a", + "vfModuleName" : "b", + "modelInvariantId" : "g", + "modelVersionId" : "h", + "orchestrationStatus" : "Assigned", + "personaModelVersion" : "g", + "isBaseVfModule" : false + +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json new file mode 100644 index 0000000000..09026d1d8c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/catalogResp.json @@ -0,0 +1,47 @@ +{ + "serviceResources": { + "serviceType": null, + "serviceAllottedResources": [], + "modelInfo": { + "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" + }, + "serviceRole": null, + "serviceVnfs": [ + { + "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", + "vfModules": [ + { + "initialCount": null, + "vfModuleLabel": null, + "modelInfo": { + "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", + "modelName": "AdiodVce..base_vCE..module-0", + "modelVersion": "2", + "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", + "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" + }, + "hasVolumeGroup": true, + "isBase": true + } + ], + "modelInfo": { + "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInstanceName": "ADIoD vCE 0", + "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" + }, + "nfRole": "", + "nfType": "", + "nfFunction": "", + "nfNamingCode": "", + "multiStageDesign": "N" + } + ], + "serviceNetworks": [] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json new file mode 100644 index 0000000000..9c50c2f11b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json @@ -0,0 +1,7 @@ +{ + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json new file mode 100644 index 0000000000..cc32040f38 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json @@ -0,0 +1,53 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : null, + "global-customer-id" : "globalCustomerId", + "service-instance-id" : null + }, + "network-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "network-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + } ] + }, + "network-name" : "TEST_NETWORK_NAME", + "network-instance-group-id" : "networkInstanceGroupId" + }, + "request-information" : { + "notification-url" : null, + "order-version" : null, + "request-action" : "CreateNetworkInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "assign" + }, + "network-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : "modelCustomizationUUID", + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "network-id" : "TEST_NETWORK_ID", + "network-type" : null + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json new file mode 100644 index 0000000000..40946725d9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json @@ -0,0 +1,52 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : null, + "global-customer-id" : "globalCustomerId", + "service-instance-id" : null + }, + "network-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "network-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + } ] + }, + "network-instance-group-id" : "networkInstanceGroupId" + }, + "request-information" : { + "notification-url" : null, + "order-version" : null, + "request-action" : "CreateNetworkInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "assign" + }, + "network-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : "modelCustomizationUUID", + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "network-id" : "TEST_NETWORK_ID", + "network-type" : null + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json new file mode 100644 index 0000000000..7ca8153def --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json @@ -0,0 +1,53 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : null, + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : null, + "global-customer-id" : "globalCustomerId", + "service-instance-id" : null + }, + "network-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "network-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + } ] + }, + "network-name" : "TEST_NETWORK_NAME", + "network-instance-group-id" : "networkInstanceGroupId" + }, + "request-information" : { + "notification-url" : null, + "order-version" : null, + "request-action" : "DeleteNetworkInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "unassign" + }, + "network-information" : { + "onap-model-information" : { + "model-name" : "modelName", + "model-version" : "modelVersion", + "model-customization-uuid" : "modelCustomizationUUID", + "model-uuid" : "modelUuid", + "model-invariant-uuid" : "modelInvariantUuid" + }, + "network-id" : "TEST_NETWORK_ID", + "network-type" : null + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json new file mode 100644 index 0000000000..4231152d86 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json @@ -0,0 +1,69 @@ +{ + "service-information" : { + "onap-model-information" : { + "model-name" : "serviceModelName", + "model-version" : "serviceModelVersion", + "model-customization-uuid" : null, + "model-uuid" : "serviceModelUuid", + "model-invariant-uuid" : "serviceModelInvariantUuid" + }, + "subscriber-name" : null, + "subscription-service-type" : "productFamilyId", + "service-id" : "serviceInstanceId", + "global-customer-id" : "globalCustomerId", + "service-instance-id" : "serviceInstanceId" + }, + "vf-module-request-input" : { + "aic-clli" : null, + "aic-cloud-region" : null, + "tenant" : null, + "vf-module-input-parameters" : { + "param" : [ { + "name" : "key1", + "value" : "value1" + }, + { + "name" : "volume-group-id", + "value" : "volumeGroupId" + } ] + }, + "vf-module-name" : "testVfModuleName" + }, + "request-information" : { + "request-action" : "CreateVfModuleInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null, + "order-version" : null, + "notification-url" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "assign" + }, + "vf-module-information" : { + "onap-model-information" : { + "model-name" : "vfModuleModelName", + "model-version" : "vfModuleModelVersion", + "model-customization-uuid" : "vfModuleModelCustomizationUuid", + "model-uuid" : "vfModuleModelUuid", + "model-invariant-uuid" : "vfModuleModelInvariantUuid" + }, + "vf-module-id" : "testVfModuleId", + "vf-module-type": "vfModuleModelName" + + }, + "vnf-information" : { + "onap-model-information" : { + "model-name" : "vnfModelName", + "model-version" : "vnfModelVersion", + "model-customization-uuid" : "vnfModelCustomizationUuid", + "model-uuid" : "vnfModelUuid", + "model-invariant-uuid" : "vnfModelInvariantUuid" + }, + "vnf-id" : "testVnfId", + "vnf-type" : "testVnfType", + "vnf-name" : "testVnfName" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json new file mode 100644 index 0000000000..64192ff8d0 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json @@ -0,0 +1,30 @@ +{ + "service-information" : { + "service-instance-id" : "serviceInstanceId", + "service-id" : "serviceInstanceId" + }, + "vf-module-request-input" : { + "vf-module-name" : "testVfModuleName", + "vf-module-input-parameters" : {} + }, + "request-information" : { + "request-action" : "DeleteVfModuleInstance", + "source" : "MSO", + "request-id" : "sdncReqId", + "order-number" : null, + "order-version" : null, + "notification-url" : null + }, + "sdnc-request-header" : { + "svc-request-id" : "svcRequestId", + "svc-notification-url" : null, + "svc-action" : "unassign" + }, + "vf-module-information" : { + "vf-module-id" : "testVfModuleId" + }, + "vnf-information" : { + "vnf-id" : "testVnfId", + "vnf-type" : "testVnfType" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json new file mode 100644 index 0000000000..1497286a1b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopology.json @@ -0,0 +1,241 @@ +{ + "vf-module-assignments": + { + "vms": + { + "vm": + [ + { + "vm-type": "vmType0", + "vm-names": + { + "vm-name": + [ + "vmName0", + "vmName1" + ], + + "vnfc-names": + [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": + { + "vnfc-network-data": + [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": + { + "vnfc-port": + [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": + { + "sub-interface-network-data": + [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": + { + "network-information-item": + [ + { + "ip-version": "ipv4", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + }, + + { + "ip-version": "ipv6", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + } + ] + }, + + "floating-ips": + { + "floating-ip-v4": + [ + "floatingIpV40", + "floatingIpV41" + ], + + "floating-ip-v6": + [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + + "vm-networks": + { + "vm-network": + [ + { + "network-role": "vmNetworkRole0", + "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" + } + ] + } + } + ] + } + } + ] + } + }, + + "vf-module-parameters": + { + "param": + [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json new file mode 100644 index 0000000000..2a8acb927e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json @@ -0,0 +1,243 @@ +{ + "vf-module-assignments": + { + "vms": + { + "vm": + [ + { + "vm-type": "vmType0", + "vm-names": + { + "vm-name": + [ + "vmName0", + "vmName1" + ], + + "vnfc-names": + [ + { + "vnfc-name": "vnfcName0", + "vnfc-networks": + { + "vnfc-network-data": + [ + { + "vnfc-network-role": "vnfcNetworkRole0", + "vnfc-type": "fw", + "vnfc-ports": + { + "vnfc-port": + [ + { + "vnfc-port-id": "01", + "common-sub-interface-role": "ctrl", + "vnic-sub-interfaces": + { + "sub-interface-network-data": + [ + { + "network-id": "networkId0", + "network-name": 1, + "vlan-tag-id": 1, + "network-information-items": + { + "network-information-item": + [ + { + "ip-version": "ipv4", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + }, + + { + "ip-version": "ipv6", + "network-ips": + { + "network-ip": + [ + "ip0", + "ip1" + ] + } + } + ] + }, + + "floating-ips": + { + "floating-ip-v4": + [ + "floatingIpV40", + "floatingIpV41" + ], + + "floating-ip-v6": + [ + "floatingIpV60", + "floatingIpV61" + ] + } + } + ] + } + } + ] + } + } + ] + } + } + ] + }, + + "vm-networks": + { + "vm-network": + [ + { + "network-role": "vmNetworkRole0", + "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" + } + ] + } + } + ] + } + } + ] + } + }, + + "vf-module-parameters": + { + "param": + [ + { + "name": "paramOne", + "value": "paramOneValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramTwo", + "value": "paramTwoValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + }, + + { + "name": "paramThree", + "value": "paramThreeValue", + "resource-resolution-data": + { + "resource-key": + [ + { + "name": "resourceKeyName", + "value": "resourceKeyValue" + } + ], + + "status": "status", + "capability-name": "capabilityName" + } + } + ] + }, + + "sdnc-generated-cloud-resources": "true" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json new file mode 100644 index 0000000000..2c7728397f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopology.json @@ -0,0 +1,68 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled" : "Y" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json new file mode 100644 index 0000000000..a302777810 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json @@ -0,0 +1,68 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled" : "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId1", + "dhcp-enabled" : "N" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json new file mode 100644 index 0000000000..67c095a217 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json @@ -0,0 +1,88 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId1", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv4", + "subnet-id": "subnetId2", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId3", + "dhcp-enabled" : "N" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId4", + "dhcp-enabled" : "Y" + }, + { + "ip-version": "ipv6", + "subnet-id": "subnetId5", + "dhcp-enabled" : "Y" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json new file mode 100644 index 0000000000..0047764713 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json @@ -0,0 +1,69 @@ +{ + "vnf-resource-assignments": + { + "availability-zones": + { + "availability-zone": + [ + "zone0", + "zone1", + "zone2" + ] + }, + + "vnf-networks": + { + "vnf-network": + [ + { + "network-role": "vnfNetworkRole0", + "neutron-id": "neutronId0", + "network-name": "netName0", + "contrail-network-fqdn": "netFqdnValue0", + "subnets-data": + { + "subnet-data": + [ + { + "ip-version": "ipv4", + "subnet-id": "subnetId0" + }, + + { + "ip-version": "ipv6", + "subnet-id": "subnetId1" + } + ] + } + } + ] + } + }, + + "vnf-parameters-data": + { + "param": + [ + { + "name": "key1", + "value": "value1" + } + ] + }, + + "aic-clli": "", + "tenant": "", + "vnf-topology-identifier-structure": + { + + }, + + "onap-model-information": + { + + }, + + "aic-cloud-region": "", + + "sdnc-generated-cloud-resources": "true" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json new file mode 100644 index 0000000000..53cd70c514 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf.json @@ -0,0 +1,113 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "success", + "solutions": { + "licenseSolutions": [ + { + "entitlementPoolUUID": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupUUID": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolUUID": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupUUID": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementSolutions": [ + [ + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID1"] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "vnfHostName", + "value": "MDTNJ01" + }, + { + "key": "isRehome", + "value": "False" + }, + { + "key": "locationId", + "value": "dfwtx" + } + ] + }, + { "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR2", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID2"] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "vnfHostName", + "value": "testVnfHostname2" + }, + { + "key": "isRehome", + "value": "False" + }, + { + "key": "locationId", + "value": "testCloudRegionId2" + } + ] + }, + { + "resourceModuleName": "VNF", + "serviceResourceId": "testResourceIdVNF", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": [ + "testCloudRegionId3" + ] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "locationId", + "value": "testCloudRegionId3" + }, + { "key":"flavors", + "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json new file mode 100644 index 0000000000..609d8924f7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json @@ -0,0 +1,119 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "completed", + "statusMessage": "success", + "solutions": { + "licenseSolutions": [ + { + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR", + "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e"], + "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + }, + { + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2", + "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n"], + "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + }, + { + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF", + "entitlementPoolUUID": ["91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e"], + "licenseKeyGroupUUID": [ "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + } + ], + "placementSolutions": [ + [ + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID1"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "MDTNJ01" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "dfwtx" } + ] + }, + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR2", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID2"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "testVnfHostname2" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "testCloudRegionId2" } + ] + }, + { + "resourceModuleName": "NETWORK", + "serviceResourceId": "testResourceIdNet", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testServiceInstanceIdNet"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "testVnfHostNameNet" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "testCloudRegionIdNet" } + ] + }, + { + "resourceModuleName": "NETWORK", + "serviceResourceId": "testResourceIdNet2", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": ["testCloudRegionIdNet2"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "locationId", "value": "testCloudRegionIdNet2" } + ] + }, + { + "resourceModuleName": "VNF", + "serviceResourceId": "testResourceIdVNF", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": ["testCloudRegionId3"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "locationId", "value": "testCloudRegionId3" }, + { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json new file mode 100644 index 0000000000..15e601bae8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf.json @@ -0,0 +1,50 @@ +{ + "transactionId": "xxx-xxx-xxxx", + "requestId": "yyy-yyy-yyyy", + "requestStatus": "completed", + "statusMessage": "success", + "solutions": { + "placementSolutions": [ + [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "vnfHostName", "value": "ahr344gh" }, + { "key": "isRehome", "value": "False" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } + ] + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "amazon", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, + { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} + ] + } + ] + ], + "licenseSolutions": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json new file mode 100644 index 0000000000..2024df401b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound.json @@ -0,0 +1,18 @@ +{ + "plans":[ + { + "name":"356fdb73-cef2-4dda-8865-31fd6733d6e4", + "message":"Unable to find any candidate for demand vGW", + "links":[ + [ + { + "rel":"self", + "href":"http://172.17.0.6:8091/v1/plans/1c15e194-6df5-43fe-a5ff-42e6093b8ddd" + } + ] + ], + "id":"1c15e194-6df5-43fe-a5ff-42e6093b8ddd", + "status":"error" + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException.json @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json new file mode 100644 index 0000000000..338b689d2e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException.json @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "OOF PlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json new file mode 100644 index 0000000000..889431663d --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json @@ -0,0 +1,47 @@ +{ + "serviceResources": { + "serviceType": null, + "serviceAllottedResources": [], + "modelInfo": { + "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" + }, + "serviceRole": null, + "serviceVnfs": [ + { + "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", + "vfModules": [ + { + "initialCount": null, + "vfModuleLabel": null, + "modelInfo": { + "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", + "modelName": "AdiodVce..base_vCE..module-0", + "modelVersion": "2", + "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", + "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" + }, + "hasVolumeGroup": true, + "isBase": true + } + ], + "modelInfo": { + "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInstanceName": "ADIoD vCE 0", + "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" + }, + "nfRole": "", + "nfType": "", + "nfFunction": "ADIoDvCE", + "nfNamingCode": "", + "multiStageDesign": "N" + } + ], + "serviceNetworks": [] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest new file mode 100644 index 0000000000..42b2a0f24a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest @@ -0,0 +1,99 @@ +{ + "requestInfo": { + "transactionId": "testRequestId-xxx-xxx", + "requestId": "testRequestId-yyy-yyy", + "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", + "sourceId": "so", + "requestType": "create", + "numSolutions": 1, + "optimizers": ["placement"], + "timeout": 600 + }, + "placementInfo": { + "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" }, + "placementDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "tenantId": "vGMuxInfra-tenant", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vGMuxInfra-customeModelName" + } + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e", + "tenantId": "vG-tenant", + "resourceModelInfo": { + "modelInvariantId": "vG-modelInvariantId", + "modelVersionId": "vG-versionId", + "modelName": "vG-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vG-customeModelName" + }, + "existingCandidates": [ + { + "identifierType": "service_instance_id", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + } + ], + "excludedCandidates": [ + { + "identifierType": "service_instance_id", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + }, + { + "identifierType": "vimId", + "cloudOwner": "vmware", + "identifiers": ["NYMDT67"] + } + ], + "requiredCandidates": [ + { + "identifierType": "vimId", + "cloudOwner": "amazon", + "identifiers": ["TXAUS219"] + } + ] + } + ] + }, + "serviceInfo": { + "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec", + "serviceName": "vCPE", + "modelInfo": { + "modelInvariantId": "vCPE-invariantId", + "modelVersionId": "vCPE-versionId", + "modelName": "vCPE-model", + "modelType": "service", + "modelVersion": "1.0", + "modelCustomizationName": "" + } + }, + "licenseDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "" + }, + "existingLicenses": { + "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"], + "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"] + } + } + ] +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf new file mode 100644 index 0000000000..67c9fbedc9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf @@ -0,0 +1,56 @@ +{ + "requestInfo": { + "transactionId": "testRequestId", + "requestId": "testRequestId", + "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", + "sourceId": "so", + "requestType": "create", + "numSolutions": 1, + "optimizers": ["placement"], + "timeout": 600 }, + "placementInfo": { + "requestParameters": { + "customerLatitude": "32.89748", + "customerLongitude": "-97.040443", + "customerName": "xyz" }, + "subscriberInfo": { "globalSubscriberId": "SUB12_0322_DS_1201", + "subscriberName": "SUB_12_0322_DS_1201", + "subscriberCommonSiteId": "" }, + "placementDemands": [ + {"resourceModuleName": "VNF","serviceResourceId": "test-resource-id-000","tenantId": "null","resourceModelInfo": { + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelName": "ADIoD vCE", + "modelType": "", + "modelVersion": "2.0", + "modelCustomizationName": "" }} + ] + }, + "serviceInfo": { + "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "serviceName": "null", + "modelInfo": { + "modelType": "", + "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelCustomizationName": "" + } + }, + "licenseInfo": { + "licenseDemands": [ + { +"resourceModuleName": "VNF", +"serviceResourceId": "test-resource-id-000", +"resourceInstanceType": "VNF", +"resourceModelInfo": { + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelName": "ADIoD vCE", + "modelType": "", + "modelVersion": "2.0", + "modelCustomizationName": "" + } + }] + }}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json new file mode 100644 index 0000000000..5addff2d70 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAAICloudRegion.json @@ -0,0 +1,596 @@ +{ + "cloud-owner": "att-aic", + "cloud-region-id": "mtn6", + "cloud-type": "openstack", + "owner-defined-type": "LCP", + "cloud-region-version": "3.0", + "cloud-zone": "AUS1", + "complex-name": "mtn6", + "resource-version": "1485202577", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/316fd41a-5943-4028-b537-9eace4a94387", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "316fd41a-5943-4028-b537-9eace4a94387" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-125" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c7910b86-8830-4b43-8d93-895f4e71ee8a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c7910b86-8830-4b43-8d93-895f4e71ee8a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_33" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/491508c7-1246-4ebc-a080-98fbe272291a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "491508c7-1246-4ebc-a080-98fbe272291a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/acaccfdb-2bf9-4ccb-b123-c54e28e8e310", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "acaccfdb-2bf9-4ccb-b123-c54e28e8e310" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2002" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "8594c6a8-f8ff-43aa-a0b5-952fd60c9f6a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_45" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/cf82a73f-de7f-4f84-8dfc-16a487c63a36", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "cf82a73f-de7f-4f84-8dfc-16a487c63a36" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/259062a4-dc9a-43f2-b46d-46f8b31bb661", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "259062a4-dc9a-43f2-b46d-46f8b31bb661" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/5102bbfc-44f3-4cd3-ae1e-0c9942653aed", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "5102bbfc-44f3-4cd3-ae1e-0c9942653aed" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_30" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/9b6d2ec3-1e58-4927-91a4-0dabe260436e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "9b6d2ec3-1e58-4927-91a4-0dabe260436e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_31" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/268c0582-a5b3-4f9f-8f4f-ea0f93620212", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "268c0582-a5b3-4f9f-8f4f-ea0f93620212" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_23" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/48627fd2-b3f2-4867-9fa3-f6425a7d22f5", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "48627fd2-b3f2-4867-9fa3-f6425a7d22f5" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_10" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb630eb9-44a3-4a90-a0c9-e52002f9f555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb630eb9-44a3-4a90-a0c9-e52002f9f555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_28" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "65cc74dd-bffb-4f71-8db8-0fb6e6ac36ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/29ee3893-b7d0-4420-a035-c990fc32eb1c", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "29ee3893-b7d0-4420-a035-c990fc32eb1c" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_48" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f8fb2eaa-68f7-4a1a-8adb-37ba7b3d891e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1702-126" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c1fc2c47-4986-4d42-80c3-379d5252bdb1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c1fc2c47-4986-4d42-80c3-379d5252bdb1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_40" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e47d1154-03b4-44a1-8196-6fb947f4d4b3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e47d1154-03b4-44a1-8196-6fb947f4d4b3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_26" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/09e0d15b-e36c-4bf5-8c2b-f4ce9256854f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "09e0d15b-e36c-4bf5-8c2b-f4ce9256854f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7b86609c-1c79-4329-bf21-15df6db1ffe0", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7b86609c-1c79-4329-bf21-15df6db1ffe0" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c547848e-2617-4161-9154-1aa6cca60994", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c547848e-2617-4161-9154-1aa6cca60994" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d348293a-2f7b-4925-bf21-fd59c2e52bfa", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d348293a-2f7b-4925-bf21-fd59c2e52bfa" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_TEST_1702_A_int_HngwProtectedOam.OAM_net_32" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/92e7461d-358a-47a3-be5e-669dcf6400ef", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "92e7461d-358a-47a3-be5e-669dcf6400ef" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "oam-net" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/01c857bf-c75e-4f1c-886c-f651a8479037", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "01c857bf-c75e-4f1c-886c-f651a8479037" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0509A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4cadeb8b-f258-436d-a998-de887f10d180", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4cadeb8b-f258-436d-a998-de887f10d180" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0511C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/d9b00452-16c5-441f-9455-2954b93b7be7", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "d9b00452-16c5-441f-9455-2954b93b7be7" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512C" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f170b669-031a-47ff-a545-61a5fbfaf884", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f170b669-031a-47ff-a545-61a5fbfaf884" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_1Bindings_324_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fb7ed40a-4c29-464c-a9d7-edc314802cc4", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fb7ed40a-4c29-464c-a9d7-edc314802cc4" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f901b9d6-3779-4f0d-a925-cb7e5e84650a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f901b9d6-3779-4f0d-a925-cb7e5e84650a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-155" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e901cbc9-b964-4e8f-a363-12fe30585526", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e901cbc9-b964-4e8f-a363-12fe30585526" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4a5b95a6-4659-406e-bd39-d7909fed055f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4a5b95a6-4659-406e-bd39-d7909fed055f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-1707-ipv6-6001-badMask" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/7883684f-4ee0-460e-a277-0276e79fb8b8", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "7883684f-4ee0-460e-a277-0276e79fb8b8" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_HnportalProviderNetwork.HNPortalPROVIDERNETWORK.SR_IOV_Provider2_1_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da4d0845-1e2f-4d94-a66f-bca45242c12f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da4d0845-1e2f-4d94-a66f-bca45242c12f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_29" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/c06bf62e-7c26-4c12-818f-927c3c25a38a", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "c06bf62e-7c26-4c12-818f-927c3c25a38a" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Mobility_ATM_1707_int_HngwOamNetVto.HNGWOAMNETVTO.OAM_net_2" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b09885f5-afce-400c-84dc-0a2779fc3e21", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b09885f5-afce-400c-84dc-0a2779fc3e21" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "ST-MTN6-NoBinding-1707-18-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/e746082a-41dc-40ec-a06e-d1138004902e", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "e746082a-41dc-40ec-a06e-d1138004902e" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1710-4001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/f1c5642c-c7d8-4409-997f-b5b186d8892f", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "f1c5642c-c7d8-4409-997f-b5b186d8892f" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-119" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "6ee51b6e-2b54-45cf-83f7-8bfa2c4ecaf3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-2001" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/aaaa-bbbb-cccc-dddd-eeee", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "aaaa-bbbb-cccc-dddd-eeee" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "direct_dhcp_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/800bdc98-4326-4358-980d-e552e2105eaf", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "800bdc98-4326-4358-980d-e552e2105eaf" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_NoBinding-1707-0512B" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/4636eea4-86a3-4cd3-806d-a63f29542ba3", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "4636eea4-86a3-4cd3-806d-a63f29542ba3" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-MTN6-NoBinding-1707-20-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1111-2222-3333-4444-5555", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1111-2222-3333-4444-5555" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-L-06Shared_OAM_PROTECTED_NET_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/67743f38-c2ac-4309-b81c-8b05381e5522", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "67743f38-c2ac-4309-b81c-8b05381e5522" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "dev_Bindings_full_1710_0907A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/wwww-xxxx-yyyy-zzzz", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "wwww-xxxx-yyyy-zzzz" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MNS-25180-P-ALPSGA01_oam_direct_net_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/ed885e04-ffe5-47fb-bb20-103e5e22ef89", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "ed885e04-ffe5-47fb-bb20-103e5e22ef89" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "MSO_Dev_HostRoutes-1802-bns-1002" + }] + }, + { + "related-to": "complex", + "related-link": "/aai/v11/cloud-infrastructure/complexes/complex/AUSTTXGR", + "relationship-data": [ { + "relationship-key": "complex.physical-location-id", + "relationship-value": "AUSTTXGR" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json new file mode 100644 index 0000000000..b0fcb786c2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkPolicy.json @@ -0,0 +1,67 @@ +{ + "network-policy-id": "e7a3560c-8b29-4611-a404-83af0b31ce64", + "network-policy-fqdn": "default-domain:ECOMP_MSO_DND:MSOPolicyC", + "resource-version": "1517429966296", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_2" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json new file mode 100644 index 0000000000..8034614626 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiNetworkTableRefs.json @@ -0,0 +1,55 @@ +{ + "route-table-reference-id": "c87fa27e-ac15-4b3e-b7ef-866682d8ca00", + "route-table-reference-fqdn": "default-domain:ECOMP_MSO_DND:RTA", + "resource-version": "1517437770161", + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_2" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json new file mode 100644 index 0000000000..86c5d8ea98 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/queryAaiVpnBinding.json @@ -0,0 +1,106 @@ +{ + "vpn-id": "9a7b327d9-287aa00-82c4b0-100001", + "vpn-name": "MSO_VPN_TEST", + "resource-version": "1515683690339", + "route-targets": {"route-target": [ + { + "global-route-target": "2001:051111", + "route-target-role": "EXPORT", + "resource-version": "1515683690360" + }, + { + "global-route-target": "1000:051113", + "route-target-role": "IMPORT", + "resource-version": "1515683690372" + }, + { + "global-route-target": "1000:051112", + "route-target-role": "BOTH", + "resource-version": "1515683690384" + }, + { + "global-route-target": "1000:051115", + "route-target-role": "EXPORT", + "resource-version": "1515683690408" + }, + { + "global-route-target": "1000:051114", + "route-target-role": "IMPORT", + "resource-version": "1515683690396" + } + ]}, + "relationship-list": {"relationship": [ + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/51e3b192-31e3-4c3e-89a9-e1f2592e15fc", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "51e3b192-31e3-4c3e-89a9-e1f2592e15fc" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_1311" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/fc0ae18f-0a1f-4773-b387-5aed5b58fffb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "fc0ae18f-0a1f-4773-b387-5aed5b58fffb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_021618" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/0384d743-f69b-4cc8-9aa8-c3ae66662c44", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "0384d743-f69b-4cc8-9aa8-c3ae66662c44" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1802_020118" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/b11eb5fc-082d-424a-a14c-f356d1ce611d", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "b11eb5fc-082d-424a-a14c-f356d1ce611d" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "DEV-1Binding-1710-0814-1000A" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/da89d739-be28-4061-bf62-4a1a9171cbfb", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "da89d739-be28-4061-bf62-4a1a9171cbfb" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_1" + }] + }, + { + "related-to": "l3-network", + "related-link": "/aai/v11/network/l3-networks/l3-network/1635f3ea-5821-4e1c-acad-a87a36b160b1", + "relationship-data": [ { + "relationship-key": "l3-network.network-id", + "relationship-value": "1635f3ea-5821-4e1c-acad-a87a36b160b1" + }], + "related-to-property": [ { + "property-key": "l3-network.network-name", + "property-value": "Dev_Bindings_1806_BB_it2_2" + }] + } + ]} +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf new file mode 100644 index 0000000000..09634c199b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf @@ -0,0 +1,107 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net new file mode 100644 index 0000000000..ac9b466ab7 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallback2AR1Vnf2Net @@ -0,0 +1,165 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "licenseInfo": [ + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n" + ], + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2" + }, + { + "entitlementPoolList": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementInfo": [ + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "dfwtx", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostname2" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId2", + "inventoryType": "service", + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID2", + "serviceResourceId": "testResourceIdAR2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "testVnfHostNameNet" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet", + "inventoryType": "service", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "testServiceInstanceIdNet", + "serviceResourceId": "testResourceIdNet" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClliNet2" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionIdNet2", + "inventoryType": "cloud", + "resourceModuleName": "NETWORK", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdNet2" + }, + { + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "aic" + }, + { + "variableName": "aicClli", + "variableValue": "testAicClli3" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ], + "cloudRegionId": "testCloudRegionId3", + "inventoryType": "cloud", + "resourceModuleName": "VNF", + "serviceInstanceId": "", + "serviceResourceId": "testResourceIdVNF" + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf new file mode 100644 index 0000000000..9159d80c43 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackInfraVnf @@ -0,0 +1,50 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "", + "solutionInfo": { + "placementInfo": [ + { + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIOD vRouter vCE", + "inventoryType": "service", + "serviceInstanceId": "service-instance-01234", + "cloudRegionId": "mtmnj1a", + "isRehome": "False", + "assignmentInfo": [ + { + "variableName": "cloudOwner", + "variableValue": "att-aic" + }, + { + "variableName": "vnfHostName", + "variableValue": "MDTNJ01" + }, + { + "variableName": "aicClli", + "variableValue": "KDTNJ01" + }, + { + "variableName": "aicVersion", + "variableValue": "3.0" + } + ] + } + ], + "licenseInfo": [ + { + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIOD vRouter vCE", + "entitlementPoolList": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupList": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound new file mode 100644 index 0000000000..2150a053fb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackNoSolutionFound @@ -0,0 +1,15 @@ +{ + "requestState": "", + "responseTime": "", + "solutionInfo": { + "placementInfo": [], + "licenseInfo": { + "featureGroupId": "" + } + }, + "percentProgress": "", + "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", + "startTime": "", + "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8", + "requestType": "" +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackPolicyException @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException new file mode 100644 index 0000000000..6cc78a7cdb --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroCallbackServiceException @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf new file mode 100644 index 0000000000..2af6bf3423 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/sniroRequest_infravnf @@ -0,0 +1,65 @@ +{ + "requestInfo": { + "transactionId": "testRequestId", + "requestId": "testRequestId", + "callbackUrl": "http://localhost:8090/workflows/messages/message/SNIROResponse/testRequestId", + "sourceId": "mso", + "optimizer": [ + "placement", + "license" + ], + "numSolutions": 1, + "timeout": 600 + }, + "placementInfo": { + "serviceModelInfo": { + "modelType": "", + "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0" + }, + "subscriberInfo": { + "globalSubscriberId": "SUB12_0322_DS_1201", + "subscriberName": "SUB_12_0322_DS_1201", + "subscriberCommonSiteId": "" + }, + "demandInfo": { + "placementDemand": [ + { + "resourceInstanceType": "VNF", + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIoD vCE 0", + "resourceModelInfo": { + "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelType": "" + }, + "tenantId": "", + "tenantName": "" + } + ], + "licenseDemand": [ + { + "resourceInstanceType": "VNF", + "serviceResourceId": "test-resource-id-000", + "resourceModuleName": "ADIoD vCE 0", + "resourceModelInfo": { + "modelCustomizationId": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelType": "" + } + } + ] + }, + "policyId": [], + "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "orderInfo": "{\"requestParameters\": null}" + } + }
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json new file mode 100644 index 0000000000..a30ee59d5c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequest.json @@ -0,0 +1,66 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "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": "value1", + "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" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json new file mode 100644 index 0000000000..49a68b909a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestDhcpDisabled.json @@ -0,0 +1,64 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "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": "value1", + "availability_zone_0": "zone0", + "availability_zone_1": "zone1", + "availability_zone_2": "zone2", + "vnfNetworkRole0_net_fqdn": "netFqdnValue0", + "vnfNetworkRole0_net_id": "neutronId0", + "vnfNetworkRole0_net_name": "netName0", + "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" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json new file mode 100644 index 0000000000..a862051582 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestMultipleDhcp.json @@ -0,0 +1,66 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "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": "value1", + "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": "subnetId4", + "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" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json new file mode 100644 index 0000000000..9c77f14f4b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterCreateVfModuleRequestWithCloudResources.json @@ -0,0 +1,33 @@ +{ + "cloudSiteId": "cloudRegionId", + "tenantId": "tenantId", + "vnfType": "vnfType", + "vfModuleId": "vfModuleId", + "vfModuleName": "vfModuleName", + "vfModuleType": "vfModuleModelName", + "vnfVersion": "serviceModelVersion", + "modelCustomizationUuid": "vfModuleModelCustomizationUuid", + "skipAAI": true, + "backout": false, + "failIfExists": true, + "msoRequest": + { + "requestId": "requestId", + "serviceInstanceId": "serviceInstanceId" + }, + + "vfModuleParams": + { + "environment_context": "environmentContext", + "key1": "value1", + "paramOne": "paramOneValue", + "paramThree": "paramThreeValue", + "paramTwo": "paramTwoValue", + "vf_module_id": "vfModuleId", + "vf_module_index": "1", + "vf_module_name": "vfModuleName", + "vnf_id": "vnfId", + "vnf_name": "vnfName", + "workload_context": "workloadContext" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json new file mode 100644 index 0000000000..21e5bde3ec --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/vnfAdapterDeleteVfModuleRequest.json @@ -0,0 +1,11 @@ +{ + "cloudSiteId" : "cloudRegionId", + "tenantId" : "tenantId", + "vnfId" : "vnfId", + "vfModuleId" : "vfModuleId", + "skipAAI" : true, + "msoRequest" : { + "requestId" : "requestId", + "serviceInstanceId" : "serviceInstanceId" + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json new file mode 100644 index 0000000000..7b369ab97e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/CreateNetworkCollection.json @@ -0,0 +1,70 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "networks": [ + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + }, + { + "modelInfo": { + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf970" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + } + } + ] + } + } + } + ] + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json new file mode 100644 index 0000000000..771283c603 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json @@ -0,0 +1,38 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "az2016" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "name": "someUserParam", + "value": "someValue" + } + ] + + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json new file mode 100644 index 0000000000..51caddd48a --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/Macro/ServiceMacroAssign.json @@ -0,0 +1,125 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "5d48acb5-097d-4982-aeb2-f4a3bd87d31b", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersion": "10.0" + }, + "owningEntity": { + "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489", + "owningEntityName": "PACKET CORE" + }, + "project": { + "projectName": "{some project name}" + }, + "subscriberInfo": { + "globalSubscriberId": "{some subscriber id}" + }, + "requestInfo": { + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "source": "VID", + "suppressRollback": true, + "requestorId": "xxxxxx" + }, + "requestParameters": { + "subscriptionServiceType": "VMX", + "aLaCarte": false, + "userParams": [ + { + "service": { + "modelInfo": { + "modelType": "service", + "modelName": "MOW AVPN vMX BV vPE 1 Service", + "modelVersionId": "3c40d244-808e-42ca-b09a-256d83d19d0a" + }, + "instanceParams": [], + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelType": "vnf", + "modelName": "2016-73_MOW-AVPN-vPE-BV-L", + "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8", + "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0", + "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "mdt1", + "tenantId": "88a6ca3ee0394ade9403f075db23167e" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "someValue" + }, + "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "instanceParams": [], + "vfModules": [ + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0", + "modelVersionId": "4c75f813-fa91-45a4-89d0-790ff5f1ae79", + "modelCustomizationId": "a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f" + }, + "instanceParams": [ + { + "vmx_int_net_len": "24" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "100" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", + "modelVersionId": "56e2b103-637c-4d1a-adc8-3a7f4a6c3240", + "modelCustomizationId": "72d9d1cd-f46d-447a-abdb-451d6fb05fa8" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vre_a_volume_size_0": "50" + } + ] + }, + { + "modelInfo": { + "modelType": "vfModule", + "modelName": "201673MowAvpnVpeBvL..AVPN_vPFE_BV..module-2", + "modelVersionId": "f555558f-d538-4876-8ffa-b102650fad64", + "modelCustomizationId": "da4d4327-fb7d-4311-ac7a-be7ba60cf969" + }, + "instanceParams": [ + { + "availability_zone_0": "mtpocdv-kvm-az01", + "vmx_vpfe_int_ip_0": "192.168.0.16" + } + ] + } + ] + } + ] + } + } + } + ] + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json new file mode 100644 index 0000000000..a18b6aa54e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/SDNCClientGetResponse.json @@ -0,0 +1,27 @@ +{ + "vnf-topology": { + "tenant": "0422ffb57ba042c0800a29dc85ca70f8", + "vnf-topology-identifier-structure": { + "vnf-id": "66dac89b-2a5b-4cb9-b22e-a7e4488fb3db", + "vnf-type": "InfraMSO_vSAMP10a_Service/InfraMSO_vSAMP10a-2 0", + "vnf-name": "MSO-DEV-VNF-1806HF1-InfraMSO_vSAMP10a-1XXX-GR_21" + }, + "aic-clli": "AUSTTXGR", + "vnf-resource-assignments": { + "availability-zones": { + "availability-zone": [ + "AZ-MN02" + ], + "max-count": 1 + } + }, + "aic-cloud-region": "mtn6", + "onap-model-information": { + "model-customization-uuid": "034226ae-879a-46b5-855c-d02babcb6cb6", + "model-uuid": "cb79c25f-b30d-4d95-afb5-97be4021f3db", + "model-invariant-uuid": "e93d3a7a-446d-486b-ae48-d474a9156064", + "model-name": "InfraMSO_vSAMP10a-2", + "model-version": "1.0" + } + } +}
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..15e2ffce1c --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/AddNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ +<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + statusCode="200"> + <rest:headers> + <rest:header name="Transfer-Encoding" value="chunked"/> + <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> + <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> + <rest:header name="X-AAI-TXID" + value="localhost-20160314-20:53:33:487-134392"/> + <rest:header name="Content-Type" value="application/xml"/> + <rest:header name="Server" value="Apache-Coyote/1.1"/> + <rest:header name="Cache-Control" value="private"/> + </rest:headers> + <rest:payload contentType="text/xml"> + <network-policy xmlns="http://com.aai.inventory/v8"> + <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id> + <network-policy-fqdn>fqdn123</network-policy-fqdn> + <heat-stack-id>slowburn</heat-stack-id> + <resource-version>145878989</resource-version> + </network-policy>F + </rest:payload> +</rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml new file mode 100644 index 0000000000..2126ae7464 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml @@ -0,0 +1,6 @@ +<CreateAAIVfModuleVolumeGroupRequest> + <vnf-id>skask</vnf-id> + <vf-module-id>lukewarm</vf-module-id> + <aic-cloud-region>pdk1</aic-cloud-region> + <volume-group-id>78987</volume-group-id> +</CreateAAIVfModuleVolumeGroupRequest>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml new file mode 100644 index 0000000000..5232e530e9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DoUpdateVfModuleRequest.xml @@ -0,0 +1,29 @@ +<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-info> + <request-id>DEV-VF-0011</request-id> + <action>UPDATE_VF_MODULE</action> + <source>PORTAL</source> + </request-info> + <vnf-inputs> + <vnf-id>skask</vnf-id> <!-- Required --> + <vf-module-id>supercool</vf-module-id> <!-- Required --> + <vnf-type>pcrf-capacity</vnf-type> <!-- Optional --> + <vf-module-model-name>PCRF::module-0</vf-module-model-name> <!-- Required --> + <asdc-service-model-version></asdc-service-model-version> <!-- Optional --> + <service-id>serviceIdUUID</service-id> <!-- Required --> + <aic-cloud-region>MDTWNJ21</aic-cloud-region> <!-- Required --> + <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id> <!-- Required --> + <volume-group-id>78987</volume-group-id> <!-- Optional --> + <persona-model-id>introvert</persona-model-id> <!-- Optional --> + <persona-model-version>3.14</persona-model-version> <!-- Optional --> + <contrail-service-instance-fqdn>myhost.appl.edu</contrail-service-instance-fqdn> <!-- Optional --> + <vnf-persona-model-id>introvert</vnf-persona-model-id> <!-- Optional --> + <vnf-persona-model-version>3.14</vnf-persona-model-version> <!-- Optional --> + </vnf-inputs> + <vnf-params> + <param name="oam_network_name">VLAN-OAM-1323</param> + <param name="vm_name">slcp34246vbc246ceb</param> + <param name="ipag_network">970cd2b9-7f09-4a12-af47-182ea38ba1f0</param> + <param name="vpe_network">545cc2c3-1930-4100-b534-5d82d0e12bb6</param> + </vnf-params> +</vnf-request> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml new file mode 100644 index 0000000000..c86a4aaa73 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/GenericVnf.xml @@ -0,0 +1,38 @@ +<generic-vnf xmlns="http://com.aai.inventory/v7"> + <vnf-id>skask</vnf-id> + <vnf-name>STMTN5MMSC20</vnf-name> + <vnf-type>pcrf-capacity</vnf-type> + <service-id>SDN-MOBILITY</service-id> + <equipment-role>vPCRF</equipment-role> + <orchestration-status>pending-create</orchestration-status> + <in-maint>false</in-maint> + <is-closed-loop-disabled>false</is-closed-loop-disabled> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>2.0</persona-model-version> + <resource-version>0000020</resource-version> + <vf-modules> + <vf-module> + <vf-module-id>lukewarm</vf-module-id> + <vf-module-name>PCRF::module-0-0</vf-module-name> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>2.0</persona-model-version> + <is-base-vf-module>true</is-base-vf-module> + <heat-stack-id>fastburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <resource-version>0000074</resource-version> + </vf-module> + <vf-module> + <vf-module-id>supercool</vf-module-id> + <vf-module-name>PCRF::module-1-0</vf-module-name> + <persona-model-id>extrovert</persona-model-id> + <persona-model-version>2.0</persona-model-version> + <is-base-vf-module>false</is-base-vf-module> + <heat-stack-id>slowburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <resource-version>0000075</resource-version> + </vf-module> + </vf-modules> + <relationship-list/> + <l-interfaces/> + <lag-interfaces/> +</generic-vnf> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000000..65f235cf4b --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml @@ -0,0 +1,5 @@ +<PrepareUpdateAAIVfModuleRequest> + <vnf-id>skask</vnf-id> + <vf-module-id>supercool</vf-module-id> + <orchestration-status>pending-delete</orchestration-status> +</PrepareUpdateAAIVfModuleRequest>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml new file mode 100644 index 0000000000..f40b6bc991 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml @@ -0,0 +1,21 @@ +<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + statusCode="200"> + <rest:headers> + <rest:header name="Transfer-Encoding" value="chunked"/> + <rest:header name="Date" value="Mon,14 Mar 2016 20:53:33 GMT"/> + <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> + <rest:header name="X-AAI-TXID" + value="localhost-20160314-20:53:33:487-134392"/> + <rest:header name="Content-Type" value="application/xml"/> + <rest:header name="Server" value="Apache-Coyote/1.1"/> + <rest:header name="Cache-Control" value="private"/> + </rest:headers> + <rest:payload contentType="text/xml"> + <network-policy xmlns="http://com.aai.inventory/v8"> + <network-policy-id>9a7b327d9-287aa00-82c4b0-105757</network-policy-id> + <network-policy-fqdn>GN_EVPN_Test</network-policy-fqdn> + <heat-stack-id>195159195</heat-stack-id> + <resource-version>14567890</resource-version> + </network-policy> + </rest:payload> +</rest:RESTResponse>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml new file mode 100644 index 0000000000..4cab6c6615 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyActivateCallback.xml @@ -0,0 +1,13 @@ +<output xmlns="com:att:sdnctl:vnf"> + <vnf-information> + <vnf-id>skask</vnf-id> + </vnf-information> + <response-code>200</response-code> + <svc-request-id>{{REQUEST-ID}}</svc-request-id> + <ack-final-indicator>Y</ack-final-indicator> + <service-information> + <subscriber-name>dontcare</subscriber-name> + <service-instance-id>0</service-instance-id> + <service-type>SDN-MOBILITY</service-type> + </service-information> +</output>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyAssignCallback.xml @@ -0,0 +1,13 @@ + <output xmlns="com:att:sdnctl:vnf"> + <vnf-information> + <vnf-id>skask</vnf-id> + </vnf-information> + <response-code>200</response-code> + <svc-request-id>{{REQUEST-ID}}</svc-request-id> + <ack-final-indicator>Y</ack-final-indicator> + <service-information> + <subscriber-name>dontcare</subscriber-name> + <service-instance-id>0</service-instance-id> + <service-type>SDN-MOBILITY</service-type> + </service-information> + </output>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml new file mode 100644 index 0000000000..7d3d0e54d1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyChangeAssignCallback.xml @@ -0,0 +1,13 @@ + <output xmlns="com:att:sdnctl:vnf"> + <vnf-information> + <vnf-id>skask</vnf-id> + </vnf-information> + <response-code>200</response-code> + <svc-request-id>{{REQUEST-ID}}</svc-request-id> + <ack-final-indicator>Y</ack-final-indicator> + <service-information> + <subscriber-name>dontcare</subscriber-name> + <service-instance-id>0</service-instance-id> + <service-type>SDN-MOBILITY</service-type> + </service-information> + </output>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml new file mode 100644 index 0000000000..dbd55b0cf4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallback.xml @@ -0,0 +1,315 @@ +<output xmlns="com:att:sdnctl:vnf"> +<vnf-list xmlns="com:att:sdnctl:vnf"> + <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> + <service-data> + <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> + <sdnc-request-header> + <svc-request-id>9ddf628a-9eca-430e-8974-22d520a31be1</svc-request-id> + <svc-action>assign</svc-action> + <svc-notification-url>https://localhost:8443/adapters/rest/SDNCNotify</svc-notification-url> + </sdnc-request-header> + <service-information> + <subscriber-name>notsurewecare</subscriber-name> + <service-instance-id>bd1b3789-6474-4935-94b2-90b656e035d0</service-instance-id> + <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + </service-information> + <oper-status> + <order-status>PendingCreate</order-status> + </oper-status> + <vnf-request-information> + <aic-cloud-region>VNN1CA52LCP</aic-cloud-region> + <vnf-name>ZVNNMOGX01_base</vnf-name> + <generic-vnf-id>afd0f02a-1ddb-43bb-aded-5113e46e82ae</generic-vnf-id> + <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type> + <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name> + <tenant>33d209df14ac4c08ad60747185d2f3e0</tenant> + <vnf-id>bd1b3789-6474-4935-94b2-90b656e035d0</vnf-id> + <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type> + </vnf-request-information> + <vnf-topology-information> + <vnf-assignments> + <vnf-networks> + <network-role>mog_exn</network-role> + <network-id>03dbd833-785c-40c0-bf32-37594b5334bc</network-id> + <network-name>MNS-25180-P-VNNYCA01_exn_protected_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>6f82d234-41a4-48e9-a9e8-415667a72929</neutron-id> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter1</sriov-vlan-filter> + </sriov-vlan-filter-list> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter2</sriov-vlan-filter> + </sriov-vlan-filter-list> + </vnf-networks> + <vnf-networks> + <network-role>mog_oam</network-role> + <network-id>3f181cde-9380-4c20-9d3a-e1a4ee74f994</network-id> + <network-name>MNS-25180-P-VNNYCA01_oam_protected_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>713b6770-13fa-4949-8dbb-a1288c5e5932</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_cor_B</network-role> + <network-id>821a550a-3f50-4725-995b-f212d5caec7c</network-id> + <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>18926e56-12b6-4a4d-98b6-37e0c05626ee</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_cor_A</network-role> + <network-id>3dabf5c0-cffb-420c-8960-8499c74eb25f</network-id> + <network-name>MNS-25180-P-VNNYCA01_cor_direct_net_2</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>35530b29-a4de-48ff-a014-111110ccc652</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_gn</network-role> + <network-id>3ce97321-6e7f-49af-bd12-f833e377c310</network-id> + <network-name>MNS-25180-P-VNNYCA01_gn_direct_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>32bfdd2c-28e1-4895-87a6-373bf12c3129</neutron-id> + </vnf-networks> + <vnf-networks> + <network-role>mog_dmz</network-role> + <network-id>d43ca910-02a5-47dc-8510-100a68a3c9e0</network-id> + <network-name>MNS-25180-P-VNNYCA01_dmz_protected_net_1</network-name> + <contrail-network-fqdn/> + <subnet-id/> + <neutron-id>cb9500fb-943f-412e-aea6-458711564a75</neutron-id> + </vnf-networks> + <availability-zones> + <availability-zone>nova</availability-zone> + </availability-zones> + <vnf-vms> + <vm-type>ps</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MPS001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPS002</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPS003</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPS004</vm-name> + </vm-names> + <vm-count>4</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.251</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.252</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>cm</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MCM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01OAM002</vm-name> + </vm-names> + <vm-count>1</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.249</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.250</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.250</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.251</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>oam</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01OAM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01OAM002</vm-name> + </vm-names> + <vm-count>2</vm-count> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.252</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.251</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.249</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.250</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>pd</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MPD001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MPD002</vm-name> + </vm-names> + <vm-count>2</vm-count> + <vm-networks> + <network-role>mog_dmz</network-role> + <network-ips> + <ip-address>107.225.25.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.225.25.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.225.254.253</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.254</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.253</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.239.167.249</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_exn</network-role> + <network-ips> + <ip-address>107.224.46.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.46.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.46.252</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.247</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.248</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.41.252</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_gn</network-role> + <network-ips> + <ip-address>107.224.41.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.41.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.41.252</floating-ip> + </vm-networks> + <vm-networks> + <network-role>mog_cor_A</network-role> + <network-ips> + <ip-address>107.224.38.253</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.38.254</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + <vnf-vms> + <vm-type>sm</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MSM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MSM002</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MSM003</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01MSM004</vm-name> + </vm-names> + <vm-count>4</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.243</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.244</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.245</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.246</ip-address> + </network-ips> + <use-dhcp>N</use-dhcp> + </vm-networks> + </vnf-vms> + </vnf-assignments> + <vnf-topology-identifier> + <vnf-name>ZVNNMOGX01_base</vnf-name> + <service-type>SDN-MOBILITY</service-type> + <vnf-type>ZVNN1MOGX01 - VF AUG 1::module-0</vnf-type> + <generic-vnf-type>ZVNN1MOGX01-SVC/ZVNN1MOGX01 - VF AUG 1 1</generic-vnf-type> + <generic-vnf-name>ZVNN1MOGX01</generic-vnf-name> + </vnf-topology-identifier> + </vnf-topology-information> + <request-information> + <request-id>9ddf628a-9eca-430e-8974-22d520a31be1</request-id> + <notification-url/> + <source>PORTAL</source> + <request-action>VNFActivateRequest</request-action> + </request-information> + </service-data> + <service-status> + <response-code>200</response-code> + <final-indicator>Y</final-indicator> + <request-status>synccomplete</request-status> + <response-timestamp>2016-08-05T16:15:19.398Z</response-timestamp> + <rpc-name>vnf-topology-operation</rpc-name> + <vnfsdn-action>VNFActivateRequest</vnfsdn-action> + <rpc-action>assign</rpc-action> + </service-status> +</vnf-list> + +</output> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml new file mode 100644 index 0000000000..e8a69da0f8 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml @@ -0,0 +1,141 @@ +<output xmlns="com:att:sdnctl:vnf"> + <vnf-list xmlns="com:att:sdnctl:vnf"> + <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id> + <service-status> + <response-code>200</response-code> + <final-indicator>Y</final-indicator> + <request-status>synccomplete</request-status> + <response-timestamp>2016-06-08T19:44:59.138Z</response-timestamp> + <rpc-name>vnf-topology-operation</rpc-name> + <vnfsdn-action>VNFActivateRequest</vnfsdn-action> + <rpc-action>assign</rpc-action> + </service-status> + <service-data> + <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743</vnf-id> + <service-information> + <subscriber-name>notsurewecare</subscriber-name> + <service-instance-id>28455973-1ee5-4ad1-8d35-c4732679743a</service-instance-id> + <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> + <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> + </service-information> + <sdnc-request-header> + <svc-request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</svc-request-id> + <svc-notification-url>http://localhost:28080/adapters/rest/SDNCNotify</svc-notification-url> + <svc-action>assign</svc-action> + </sdnc-request-header> + <vnf-request-information> + <aic-cloud-region>AAIAIC25</aic-cloud-region> + <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name> + <generic-vnf-id>91ad7ab0-9ffd-471d-971c-3eb913a2cc75</generic-vnf-id> + <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type> + <generic-vnf-name>MSOTEST06</generic-vnf-name> + <tenant>4ae1d3446a4c48b2bec44b6cfba06d68</tenant> + <vnf-id>28455973-1ee5-4ad1-8d35-c4732679743a</vnf-id> + <vnf-type>vSAMP3::base::module-0</vnf-type> + </vnf-request-information> + <oper-status> + <order-status>PendingCreate</order-status> + </oper-status> + <vnf-topology-information> + <vnf-parameters> + <vnf-parameter-name>image</vnf-parameter-name> + <vnf-parameter-value>Ubuntu_Perf</vnf-parameter-value> + </vnf-parameters> + <vnf-parameters> + <vnf-parameter-name>flavor</vnf-parameter-name> + <vnf-parameter-value>m1.small</vnf-parameter-value> + </vnf-parameters> + <vnf-assignments> + <vnf-networks> + <network-role>int_imbl</network-role> + <network-id>680b7453-0ec4-4d96-b355-280d981d418f</network-id> + <network-name>Nimbus-25193-T-Willows2_int_imbl_net_1</network-name> + <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_int_imbl_net_1</contrail-network-fqdn> + <subnet-id></subnet-id> + <ipv6-subnet-id>775607fb-e16a-45ef-94a7-82fba0d16eec</ipv6-subnet-id> + <neutron-id>640d07fb-e16a-45ef-94a7-82fba0d169bf</neutron-id> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter1</sriov-vlan-filter> + </sriov-vlan-filter-list> + <sriov-vlan-filter-list> + <sriov-vlan-filter>filter2</sriov-vlan-filter> + </sriov-vlan-filter-list> + </vnf-networks> + <vnf-networks> + <network-role>sgi_protected</network-role> + <network-id>f9039ce9-e3cf-4716-b2d1-ec7912178ea4</network-id> + <network-name>Nimbus-25193-T-Willows2_sgi_protected_net_1</network-name> + <contrail-network-fqdn>default-domain:Nimbus-25193-T-Willows2:Nimbus-25193-T-Willows2_sgi_protected_net_1</contrail-network-fqdn> + <subnet-id>b9999ce9-e3cf-4716-b2d1-ec791217678c</subnet-id> + <ipv6-subnet-id></ipv6-subnet-id> + <neutron-id>bf11bba8-b971-4ab5-8281-215b3fedcd3c</neutron-id> + </vnf-networks> + <vnf-vms> + <vm-type>cm</vm-type> + <vm-names> + <vm-name>ZVNN1MOGX01MCM001</vm-name> + </vm-names> + <vm-names> + <vm-name>ZVNN1MOGX01OAM002</vm-name> + </vm-names> + <vm-count>1</vm-count> + <vm-networks> + <network-role>mog_cor_B</network-role> + <network-ips> + <ip-address>107.224.36.249</ip-address> + </network-ips> + <network-ips> + <ip-address>107.224.36.250</ip-address> + </network-ips> + <network-ips-v6> + <ip-address-ipv6>2606:ae00:2e01:800::67</ip-address-ipv6> + </network-ips-v6> + <use-dhcp>N</use-dhcp> + <floating-ip>107.224.41.252</floating-ip> + <floating-ip-v6>2001:1890:1001:2B32::29:C</floating-ip-v6> + </vm-networks> + <vm-networks> + <network-role>mog_oam</network-role> + <network-ips> + <ip-address>107.239.167.250</ip-address> + </network-ips> + <network-ips> + <ip-address>107.239.167.251</ip-address> + </network-ips> + <network-ips-v6> + <ip-address-ipv6>aa::aa::aa::aa::aa::aa</ip-address-ipv6> + </network-ips-v6> + <network-ips-v6> + <ip-address-ipv6>bb::bb::bb::bb::bb::bb</ip-address-ipv6> + </network-ips-v6> + <interface-route-prefixes> + <interface-route-prefix-cidr>1.2.3.4/26</interface-route-prefix-cidr> + </interface-route-prefixes> + <interface-route-prefixes> + <interface-route-prefix-cidr>2002::/64</interface-route-prefix-cidr> + </interface-route-prefixes> + <use-dhcp>N</use-dhcp> + <floating-ip-v6>1111:1890:1001:2B32::29:D</floating-ip-v6> + </vm-networks> + </vnf-vms> + <availability-zones> + <availability-zone>nova</availability-zone> + </availability-zones> + </vnf-assignments> + <vnf-topology-identifier> + <vnf-name>MSOTEST06-vSAMP3::base::module-0</vnf-name> + <service-type>SDN-MOBILITY</service-type> + <vnf-type>vSAMP3::base::module-0</vnf-type> + <generic-vnf-type>Test/vSAMP3 1</generic-vnf-type> + <generic-vnf-name>MSOTEST06</generic-vnf-name> + </vnf-topology-identifier> + </vnf-topology-information> + <request-information> + <request-id>5e168556-a5c6-4813-bff3-cc03007afbbc</request-id> + <notification-url></notification-url> + <source>SoapUI-bns-vf-base-vSAMP3-9001</source> + <request-action>VNFActivateRequest</request-action> + </request-information> + </service-data> +</vnf-list> +</output> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml new file mode 100644 index 0000000000..77528ccf61 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/StandardSDNCSynchResponse.xml @@ -0,0 +1,5 @@ +<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> + <soap:Body> + <SDNCAdapterResponse xmlns="http://org.onap/workflow/sdnc/adapter/schema/v1"/> + </soap:Body> +</soap:Envelope>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml new file mode 100644 index 0000000000..3e7c6503f4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIGenericVnfRequest.xml @@ -0,0 +1,5 @@ +<UpdateAAIGenericVnfRequest> + <vnf-id>skask</vnf-id> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>3.14</persona-model-version> +</UpdateAAIGenericVnfRequest>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml new file mode 100644 index 0000000000..8a690403c4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateAAIVfModuleRequest.xml @@ -0,0 +1,10 @@ +<UpdateAAIVfModuleRequest> + <vnf-id>skask</vnf-id> + <vf-module-id>supercool</vf-module-id> + <heat-stack-id>slowburn</heat-stack-id> + <orchestration-status>complete</orchestration-status> + <volume-group-id>78987</volume-group-id> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>3.14</persona-model-version> + <contrail-service-instance-fqdn>myhost.appl.com</contrail-service-instance-fqdn> +</UpdateAAIVfModuleRequest>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml new file mode 100644 index 0000000000..0dc1b1d410 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/UpdateVfModuleRequest.xml @@ -0,0 +1,35 @@ +<vnf-request xmlns="http://org.onap/so/infra/vnf-request/v1"> + <request-info> + <request-id>DEV-VF-0011</request-id> + <action>UPDATE_VF_MODULE</action> + <source>PORTAL</source> + </request-info> + <vnf-inputs> + <vnf-id>skask</vnf-id> <!-- Required --> <!-- with vf-module-id, identifies the vf-module to update --> + <vf-module-id>supercool</vf-module-id> <!-- Required --> <!-- with vnf-id, identifies the vf-module to update --> + <vnf-type>pcrf-capacity</vnf-type> <!-- Required --> <!-- not in vf-module; used for recipe selection/filtering; + thus, not used by UpdateVfModule flow --> + <vf-module-model-name>PCRF::module-0</vf-module-model-name> <!-- Required --> <!-- not in vf-module; used for recipe selection/filtering; + thus, not used by UpdateVfModule flow --> + <asdc-service-model-version></asdc-service-model-version> <!-- Optional --> <!-- not in vf-module; used for recipe selection; + thus, not used by UpdateVfModule flow --> + <service-id>serviceIdUUID</service-id> <!-- Required --> <!-- not in vf-module; used for query filtering; + thus, not used by UpdateVfModule flow --> + <aic-cloud-region>MDTWNJ21</aic-cloud-region> <!-- Required --> <!-- in vf-module as part of volume-group relationship; + however, used for query filtering only; not updatable in AAI --> + <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id> <!-- Required --> <!-- not in vf-module; used to confirm volume group tenant --> + <volume-group-id>78987</volume-group-id> <!-- Optional --> <!-- in vf-module as part of volume-group relationship; used + to update VNF adapter; not updatable in AAI --> + <persona-model-id>introvert</persona-model-id> <!-- Optional --> <!-- Not in AID, in vf-module --> + <persona-model-version>3.14</persona-model-version> <!-- Optional --> <!-- Not in AID, in vf-module --> + <contrail-service-instance-fqdn>myhost.appl.edu</contrail-service-instance-fqdn> <!-- Optional --> <!-- Not in AID, in vf-module --> + <vnf-persona-model-id>introvert</vnf-persona-model-id> <!-- Optional --> <!-- Not in AID, in generic-vnf (as persona-model-id) --> + <vnf-persona-model-version>3.14</vnf-persona-model-version> <!-- Optional --> <!-- Not in AID, in generic-vnf (as persona-model-version) --> + </vnf-inputs> + <vnf-params> + <param name="oam_network_name">VLAN-OAM-1323</param> + <param name="vm_name">slcp34246vbc246ceb</param> + <param name="ipag_network">970cd2b9-7f09-4a12-af47-182ea38ba1f0</param> + <param name="vpe_network">545cc2c3-1930-4100-b534-5d82d0e12bb6</param> + </vnf-params> +</vnf-request> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml new file mode 100644 index 0000000000..49ecd0bf3f --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestCreateCallback.xml @@ -0,0 +1,55 @@ +<createVfModuleResponse> + <vnfId>skask</vnfId> + <vfModuleId>supercool</vfModuleId> + <vfModuleStackId>slowburn</vfModuleStackId> + <vfModuleCreated>true</vfModuleCreated> + <vfModuleOutputs> + <entry> + <key>key1</key> + <value>value1</value> + </entry> + <entry> + <key>key2</key> + <value>value2</value> + </entry> + <entry> +<key>server1_private_ip</key> +<value>192.168.28.3</value> +</entry> +<entry> +<key>contrail-service-instance-fqdn</key> +<value>default-domain:MSOTest:MsoNW-RA</value> +</entry> +<entry> +<key>policyKey1_contrail_network_policy_fqdn</key> +<value>MSOTest:DefaultPolicyFQDN1</value> +</entry> +<entry> +<key>policyKey2_contrail_network_policy_fqdn</key> +<value>MSOTest:DefaultPolicyFQDN2</value> +</entry> +<entry> +<key>oam_management_v6_address</key> +<value>2000:abc:bce:1111</value> +</entry> +<entry> +<key>oam_management_v4_address</key> +<value>127.0.0.1</value> +</entry> + </vfModuleOutputs> + <rollback> <!-- JC's doc has "vfModuleRollback" --> + <vnfId>skask</vnfId> + <vfModuleId>supercool</vfModuleId> + <vfModuleStackId>slowburn</vfModuleStackId> + <vfModuleCreated>true</vfModuleCreated> + <tenantId>tenantId</tenantId> + <cloudSiteId>cloudSiteId</cloudSiteId> + <msoRequest> + <requestId>requestId</requestId> + <serviceInstanceId>serviceInstanceId</serviceInstanceId> + </msoRequest> + <messageId>{{MESSAGE-ID}}</messageId> <!-- JC's doc does not have this --> + </rollback> + <messageId>{{MESSAGE-ID}}</messageId> +</createVfModuleResponse> + diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml new file mode 100644 index 0000000000..c602dd9667 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestUpdateCallback.xml @@ -0,0 +1,16 @@ +<updateVfModuleResponse> + <vnfId>skask</vnfId> + <vfModuleId>supercool</vfModuleId> + <vfModuleStackId>slowburn</vfModuleStackId> + <vfModuleOutputs> + <entry> + <key>key1</key> + <value>value1</value> + </entry> + <entry> + <key>key2</key> + <value>value2</value> + </entry> + </vfModuleOutputs> + <messageId>{{MESSAGE-ID}}</messageId> +</updateVfModuleResponse> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml new file mode 100644 index 0000000000..830d2e2237 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestVolumeGroupCallback.xml @@ -0,0 +1,15 @@ +<updateVolumeGroupResponse> + <volumeGroupId>78987</volumeGroupId> + <volumeGroupStackId>slowburn</volumeGroupStackId> + <vfModuleOutputs> + <entry> + <key>key1</key> + <value>value1</value> + </entry> + <entry> + <key>key2</key> + <value>value2</value> + </entry> + </vfModuleOutputs> + <messageId>{{MESSAGE-ID}}</messageId> +</updateVolumeGroupResponse> diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml new file mode 100644 index 0000000000..b882c4c6f4 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-lukewarm.xml @@ -0,0 +1,10 @@ +<vf-module xmlns="http://com.aai.inventory/v7"> + <vf-module-id>lukewarm</vf-module-id> + <vf-module-name>PCRF::module-1</vf-module-name> + <heat-stack-id>slowburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <is-base-vf-module>true</is-base-vf-module> + <resource-version>330-90</resource-version> + <persona-model-id>introvert</persona-model-id> + <persona-model-version>2.0</persona-model-version> +</vf-module>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml new file mode 100644 index 0000000000..3b8bea4e4e --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-new.xml @@ -0,0 +1,9 @@ +<vf-module xmlns="http://com.aai.inventory/v7"> + <vf-module-id>b37d96db-7d2c-47ce-bf61-a6c7b82fe161</vf-module-id> + <vf-module-name>PCRF::module-0-2</vf-module-name> + <persona-model-id>00000000-0000-0000-0000-000000000000</persona-model-id> + <persona-model-version>1.0</persona-model-version> + <is-base-vf-module>false</is-base-vf-module> + <orchestration-status>pending-create</orchestration-status> + <resource-version>330-90</resource-version> +</vf-module>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml new file mode 100644 index 0000000000..5a2b7300b1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VfModule-supercool.xml @@ -0,0 +1,27 @@ +<vf-module xmlns="http://com.aai.inventory/v7"> + <vf-module-id>supercool</vf-module-id> + <vf-module-name>PCRF::module-2</vf-module-name> + <heat-stack-id>fastburn</heat-stack-id> + <orchestration-status>pending-create</orchestration-status> + <is-base-vf-module>false</is-base-vf-module> + <resource-version>330-89</resource-version> + <model-invariant-id>introvert</model-invariant-id> + <model-version-id>2.0</model-version-id> + <relationship-list> + <relationship> + <related-to>volume-group</related-to> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>pdk1</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>volume-group.volume-group-id</relationship-key> + <relationship-value>78987</relationship-value> + </relationship-data> + </relationship> + </relationship-list> +</vf-module>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml new file mode 100644 index 0000000000..7e913dd418 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VolumeGroup.xml @@ -0,0 +1,25 @@ + <volume-group xmlns="http://com.aai.inventory/v7"> + <volume-group-id>78987</volume-group-id> + <volume-group-name>Volume_2</volume-group-name> + <heat-stack-id>slowburn</heat-stack-id> + <vnf-type>pcrf-capacity</vnf-type> + <orchestration-status>Active</orchestration-status> + <resource-version>0000020</resource-version> + <relationship-list> + <relationship> + <related-to>tenant</related-to> + <relationship-data> + <relationship-key>cloud-region.cloud-owner</relationship-key> + <relationship-value>att-aic</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>cloud-region.cloud-region-id</relationship-key> + <relationship-value>MDTWNJ21</relationship-value> + </relationship-data> + <relationship-data> + <relationship-key>tenant.tenant-id</relationship-key> + <relationship-value>fba1bd1e195a404cacb9ce17a9b2b421</relationship-value> + </relationship-data> + </relationship> + </relationship-list> + </volume-group>
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml new file mode 100644 index 0000000000..ac8446cbb9 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml @@ -0,0 +1,214 @@ +aai: + auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + endpoint: http://localhost:${wiremock.server.port} +appc: + client: + key: iaEMAfjsVsZnraBP + response: + timeout: '120000' + secret: wcivUjsjXzmGFBfxMmyJu9dz + poolMembers: localhost:3904 + service: ueb + topic: + read: + name: APPC-TEST-AMDOCS2 + timeout: '120000' + write: APPC-TEST-AMDOCS1-DEV3 + sdnc: + read: SDNC-LCM-READ + write: SDNC-LCM-WRITE +log: + debug: + CompleteMsoProcess: 'true' + CreateNetworkInstanceInfra: 'true' + CreateServiceInstanceInfra: 'true' + DeleteNetworkInstanceInfra: 'true' + FalloutHandler: 'true' + UpdateNetworkInstanceInfra: 'true' + VnfAdapterRestV1: 'true' + sdncAdapter: 'true' + vnfAdapterCreateV1: 'true' + vnfAdapterRestV1: 'true' +mso: + adapters: + completemsoprocess: + endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess + db: + auth: 757A94191D685FD2092AC1490730A4FC + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + spring: + endpoint: http://localhost:${wiremock.server.port} + network: + endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks + openecomp: + db: + endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter + po: + auth: 757A94191D685FD2092AC1490730A4FC + password: 3141634BF7E070AA289CF2892C986C0B + sdnc: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc + timeout: PT60S + tenant: + endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock + vnf: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups + vnf-async: + endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync + workflow: + message: + endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message + + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + + bpmn: + optimisticlockingexception: + retrycount: '3' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://localhost:${wiremock.server.port}/ + spring: + endpoint: http://localhost:${wiremock.server.port} + correlation: + timeout: 60 + db: + auth: Basic YnBlbDptc28tZGItMTUwNyE= + default: + adapter: + namespace: http://org.onap.so + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + logPath: logs + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + po: + timeout: PT60S + request: + db: + endpoint: http://localhost:${wiremock.server.port}/ + rollback: 'true' + site-name: localDevEnv + workflow: + default: + aai: + cloud-region: + 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: + namespace: http://org.openecomp.aai.inventory/ + version: '8' + message: + endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage + notification: + name: GenericNotificationService + sdncadapter: + callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + delete: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + query: + callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1 + rollback: + callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify + global: + dmaap: + username: dmaapUsername + password: dmaapPassword + host: http://localhost:28090 + publisher: + topic: com.att.mso.asyncStatusUpdate +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46YWRtaW4= + host: http://localhost:8446 + path: /restconf/operations/GENERIC-RESOURCE-API +sniro: + conductor: + enabled: true + host: http://localhost:${wiremock.server.port} + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + timeout: PT30M + host: http://localhost:${wiremock.server.port} + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +spring: + datasource: + url: jdbc:mariadb://localhost:3307/camundabpmn + username: root + password: password + driver-class-name: org.mariadb.jdbc.Driver + initialize: true + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: none + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + +mariaDB4j: + dataDir: + port: 3307 + databaseName: camundabpmn +camunda: + bpm: + metrics: + enabled: false + db-reporter-activate: false
\ No newline at end of file diff --git a/bpmn/so-bpmn-tasks/src/test/resources/schema.sql b/bpmn/so-bpmn-tasks/src/test/resources/schema.sql new file mode 100644 index 0000000000..7a15e84662 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/resources/schema.sql @@ -0,0 +1,1188 @@ + +USE `camundabpmn`; + + +create table ACT_GE_PROPERTY ( + NAME_ varchar(64), + VALUE_ varchar(300), + REV_ integer, + primary key (NAME_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create table ACT_GE_BYTEARRAY ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + BYTES_ LONGBLOB, + GENERATED_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_DEPLOYMENT ( + ID_ varchar(64), + NAME_ varchar(255), + DEPLOY_TIME_ timestamp(3), + SOURCE_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXECUTION ( + ID_ varchar(64), + REV_ integer, + PROC_INST_ID_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + SUPER_EXEC_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + IS_ACTIVE_ TINYINT, + IS_CONCURRENT_ TINYINT, + IS_SCOPE_ TINYINT, + IS_EVENT_SCOPE_ TINYINT, + SUSPENSION_STATE_ integer, + CACHED_ENT_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOB ( + ID_ varchar(64) NOT NULL, + REV_ integer, + TYPE_ varchar(255) NOT NULL, + LOCK_EXP_TIME_ timestamp(3) NULL, + LOCK_OWNER_ varchar(255), + EXCLUSIVE_ boolean, + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + RETRIES_ integer, + EXCEPTION_STACK_ID_ varchar(64), + EXCEPTION_MSG_ varchar(4000), + DUEDATE_ timestamp(3) NULL, + REPEAT_ varchar(255), + HANDLER_TYPE_ varchar(255), + HANDLER_CFG_ varchar(4000), + DEPLOYMENT_ID_ varchar(64), + SUSPENSION_STATE_ integer NOT NULL DEFAULT 1, + JOB_DEF_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_JOBDEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + JOB_TYPE_ varchar(255) NOT NULL, + JOB_CONFIGURATION_ varchar(255), + SUSPENSION_STATE_ integer, + JOB_PRIORITY_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RE_PROCDEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + HAS_START_FORM_KEY_ TINYINT, + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + VERSION_TAG_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_TASK ( + ID_ varchar(64), + REV_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + TASK_DEF_KEY_ varchar(255), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + DELEGATION_ varchar(64), + PRIORITY_ integer, + CREATE_TIME_ timestamp(3), + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + SUSPENSION_STATE_ integer, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_IDENTITYLINK ( + ID_ varchar(64), + REV_ integer, + GROUP_ID_ varchar(255), + TYPE_ varchar(255), + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_VARIABLE ( + ID_ varchar(64) not null, + REV_ integer, + TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + TASK_ID_ varchar(64), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + VAR_SCOPE_ varchar(64) not null, + SEQUENCE_COUNTER_ bigint, + IS_CONCURRENT_LOCAL_ TINYINT, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EVENT_SUBSCR ( + ID_ varchar(64) not null, + REV_ integer, + EVENT_TYPE_ varchar(255) not null, + EVENT_NAME_ varchar(255), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + CONFIGURATION_ varchar(255), + CREATED_ timestamp(3) not null, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_INCIDENT ( + ID_ varchar(64) not null, + REV_ integer not null, + INCIDENT_TIMESTAMP_ timestamp(3) not null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + EXECUTION_ID_ varchar(64), + ACTIVITY_ID_ varchar(255), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_AUTHORIZATION ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ integer not null, + GROUP_ID_ varchar(255), + USER_ID_ varchar(255), + RESOURCE_TYPE_ integer not null, + RESOURCE_ID_ varchar(255), + PERMS_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_FILTER ( + ID_ varchar(64) not null, + REV_ integer not null, + RESOURCE_TYPE_ varchar(255) not null, + NAME_ varchar(255) not null, + OWNER_ varchar(255), + QUERY_ LONGTEXT not null, + PROPERTIES_ LONGTEXT, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_METER_LOG ( + ID_ varchar(64) not null, + NAME_ varchar(64) not null, + REPORTER_ varchar(255), + VALUE_ bigint, + TIMESTAMP_ timestamp(3), + MILLISECONDS_ bigint DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_EXT_TASK ( + ID_ varchar(64) not null, + REV_ integer not null, + WORKER_ID_ varchar(255), + TOPIC_NAME_ varchar(255), + RETRIES_ integer, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + LOCK_EXP_TIME_ timestamp(3) NULL, + SUSPENSION_STATE_ integer, + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + TENANT_ID_ varchar(64), + PRIORITY_ bigint NOT NULL DEFAULT 0, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_RU_BATCH ( + ID_ varchar(64) not null, + REV_ integer not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_CREATED_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + SUSPENSION_STATE_ integer, + CONFIGURATION_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_); +create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_); +create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_); +create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_); +create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_); +create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_); +create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_); +create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_); +create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_); +create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_); +create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_); +create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_); +create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_); +-- CAM-5914 +create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_); +-- this index needs to be limited in mariadb see CAM-6938 +create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155)); +create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_); +create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_); +create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_); + +-- new metric milliseconds column +CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_); +CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_); + +-- old metric timestamp column +CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_); +CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_); + +create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_); +create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_); +create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_); +create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_); +create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_); +create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_); + +alter table ACT_GE_BYTEARRAY + add constraint ACT_FK_BYTEARR_DEPL + foreign key (DEPLOYMENT_ID_) + references ACT_RE_DEPLOYMENT (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_SUPER + foreign key (SUPER_EXEC_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_EXECUTION + add constraint ACT_FK_EXE_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_TSKASS_TASK + foreign key (TASK_ID_) + references ACT_RU_TASK (ID_); + +alter table ACT_RU_IDENTITYLINK + add constraint ACT_FK_ATHRZ_PROCEDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_BYTEARRAY + foreign key (BYTEARRAY_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_JOB + add constraint ACT_FK_JOB_EXCEPTION + foreign key (EXCEPTION_STACK_ID_) + references ACT_GE_BYTEARRAY (ID_); + +alter table ACT_RU_EVENT_SUBSCR + add constraint ACT_FK_EVENT_EXEC + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION(ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCINST + foreign key (PROC_INST_ID_) + references ACT_RU_EXECUTION (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_PROCDEF + foreign key (PROC_DEF_ID_) + references ACT_RE_PROCDEF (ID_); + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_CAUSE + foreign key (CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_RCAUSE + foreign key (ROOT_CAUSE_INCIDENT_ID_) + references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade; + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_ERROR_DETAILS + foreign key (ERROR_DETAILS_ID_) + references ACT_GE_BYTEARRAY (ID_); + +create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_); +alter table ACT_RU_INCIDENT + add constraint ACT_FK_INC_JOB_DEF + foreign key (JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_USER + unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_AUTHORIZATION + add constraint ACT_UNIQ_AUTH_GROUP + unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_UNIQ_VARIABLE + unique (VAR_SCOPE_, NAME_); + +alter table ACT_RU_EXT_TASK + add constraint ACT_FK_EXT_TASK_EXE + foreign key (EXECUTION_ID_) + references ACT_RU_EXECUTION (ID_); + +create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_SEED_JOB_DEF + foreign key (SEED_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_MONITOR_JOB_DEF + foreign key (MONITOR_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_); +alter table ACT_RU_BATCH + add constraint ACT_FK_BATCH_JOB_DEF + foreign key (BATCH_JOB_DEF_ID_) + references ACT_RU_JOBDEF (ID_); + +-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 -- +create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_); +create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_); +create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_); +create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_); +create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_); +-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 -- +create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_); +-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 -- +create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_); + +-- indexes to improve deployment +create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_); +create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_); +create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_); +create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_); +create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_); +create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_); +create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_); +create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_); +create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_); +-- create case definition table -- +create table ACT_RE_CASE_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case execution table -- +create table ACT_RU_CASE_EXECUTION ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + SUPER_CASE_EXEC_ varchar(64), + SUPER_EXEC_ varchar(64), + BUSINESS_KEY_ varchar(255), + PARENT_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + ACT_ID_ varchar(255), + PREV_STATE_ integer, + CURRENT_STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create case sentry part table -- + +create table ACT_RU_CASE_SENTRY_PART ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CASE_INST_ID_ varchar(64), + CASE_EXEC_ID_ varchar(64), + SENTRY_ID_ varchar(255), + TYPE_ varchar(255), + SOURCE_CASE_EXEC_ID_ varchar(64), + STANDARD_EVENT_ varchar(255), + SOURCE_ varchar(255), + VARIABLE_EVENT_ varchar(255), + VARIABLE_NAME_ varchar(255), + SATISFIED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create index on business key -- +create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_); + +-- create foreign key constraints on ACT_RU_CASE_EXECUTION -- +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade; + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_PARENT + foreign key (PARENT_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_EXECUTION + add constraint ACT_FK_CASE_EXE_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_VARIABLE -- +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_VARIABLE + add constraint ACT_FK_VAR_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +-- create foreign key constraints on ACT_RU_TASK -- +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_EXE + foreign key (CASE_EXECUTION_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_TASK + add constraint ACT_FK_TASK_CASE_DEF + foreign key (CASE_DEF_ID_) + references ACT_RE_CASE_DEF(ID_); + +-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART -- +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_INST + foreign key (CASE_INST_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +alter table ACT_RU_CASE_SENTRY_PART + add constraint ACT_FK_CASE_SENTRY_CASE_EXEC + foreign key (CASE_EXEC_ID_) + references ACT_RU_CASE_EXECUTION(ID_); + +create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_); +create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_); +-- create decision definition table -- +create table ACT_RE_DECISION_DEF ( + ID_ varchar(64) not null, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) not null, + VERSION_ integer not null, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + HISTORY_TTL_ integer, + VERSION_TAG_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create decision requirements definition table -- +create table ACT_RE_DECISION_REQ_DEF ( + ID_ varchar(64) NOT NULL, + REV_ integer, + CATEGORY_ varchar(255), + NAME_ varchar(255), + KEY_ varchar(255) NOT NULL, + VERSION_ integer NOT NULL, + DEPLOYMENT_ID_ varchar(64), + RESOURCE_NAME_ varchar(4000), + DGRM_RESOURCE_NAME_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_RE_DECISION_DEF + add constraint ACT_FK_DEC_REQ + foreign key (DEC_REQ_ID_) + references ACT_RE_DECISION_REQ_DEF(ID_); + +create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_); +create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_); +create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_); +create table ACT_HI_PROCINST ( + ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + START_USER_ID_ varchar(255), + START_ACT_ID_ varchar(255), + END_ACT_ID_ varchar(255), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + SUPER_CASE_INSTANCE_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + DELETE_REASON_ varchar(4000), + TENANT_ID_ varchar(64), + STATE_ varchar(255), + primary key (ID_), + unique (PROC_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64) not null, + PROC_INST_ID_ varchar(64) not null, + EXECUTION_ID_ varchar(64) not null, + ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + ACT_NAME_ varchar(255), + ACT_TYPE_ varchar(255) not null, + ASSIGNEE_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + ACT_INST_STATE_ integer, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_TASKINST ( + ID_ varchar(64) not null, + TASK_DEF_KEY_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + NAME_ varchar(255), + PARENT_TASK_ID_ varchar(64), + DESCRIPTION_ varchar(4000), + OWNER_ varchar(255), + ASSIGNEE_ varchar(255), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + DELETE_REASON_ varchar(4000), + PRIORITY_ integer, + DUE_DATE_ datetime(3), + FOLLOW_UP_DATE_ datetime(3), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_VARINST ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(100), + REV_ integer, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + STATE_ varchar(20), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_DETAIL ( + ID_ varchar(64) not null, + TYPE_ varchar(255) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + VAR_INST_ID_ varchar(64), + NAME_ varchar(255) not null, + VAR_TYPE_ varchar(255), + REV_ integer, + TIME_ datetime(3) not null, + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + OPERATION_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_IDENTITYLINK ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + TYPE_ varchar(255), + USER_ID_ varchar(255), + GROUP_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + OPERATION_TYPE_ varchar(64), + ASSIGNER_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_COMMENT ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TIME_ datetime(3) not null, + USER_ID_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + ACTION_ varchar(255), + MESSAGE_ varchar(4000), + FULL_MSG_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_ATTACHMENT ( + ID_ varchar(64) not null, + REV_ integer, + USER_ID_ varchar(255), + NAME_ varchar(255), + DESCRIPTION_ varchar(4000), + TYPE_ varchar(255), + TASK_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + URL_ varchar(4000), + CONTENT_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_OP_LOG ( + ID_ varchar(64) not null, + DEPLOYMENT_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + CASE_EXECUTION_ID_ varchar(64), + TASK_ID_ varchar(64), + JOB_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + BATCH_ID_ varchar(64), + USER_ID_ varchar(255), + TIMESTAMP_ timestamp(3) not null, + OPERATION_TYPE_ varchar(64), + OPERATION_ID_ varchar(64), + ENTITY_TYPE_ varchar(30), + PROPERTY_ varchar(64), + ORG_VALUE_ varchar(4000), + NEW_VALUE_ varchar(4000), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_INCIDENT ( + ID_ varchar(64) not null, + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + CREATE_TIME_ timestamp(3) not null, + END_TIME_ timestamp(3) null, + INCIDENT_MSG_ varchar(4000), + INCIDENT_TYPE_ varchar(255) not null, + ACTIVITY_ID_ varchar(255), + CAUSE_INCIDENT_ID_ varchar(64), + ROOT_CAUSE_INCIDENT_ID_ varchar(64), + CONFIGURATION_ varchar(255), + INCIDENT_STATE_ integer, + TENANT_ID_ varchar(64), + JOB_DEF_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_JOB_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + JOB_ID_ varchar(64) not null, + JOB_DUEDATE_ timestamp(3) NULL, + JOB_RETRIES_ integer, + JOB_PRIORITY_ bigint NOT NULL DEFAULT 0, + JOB_EXCEPTION_MSG_ varchar(4000), + JOB_EXCEPTION_STACK_ID_ varchar(64), + JOB_STATE_ integer, + JOB_DEF_ID_ varchar(64), + JOB_DEF_TYPE_ varchar(255), + JOB_DEF_CONFIGURATION_ varchar(255), + ACT_ID_ varchar(255), + EXECUTION_ID_ varchar(64), + PROCESS_INSTANCE_ID_ varchar(64), + PROCESS_DEF_ID_ varchar(64), + PROCESS_DEF_KEY_ varchar(255), + DEPLOYMENT_ID_ varchar(64), + SEQUENCE_COUNTER_ bigint, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_BATCH ( + ID_ varchar(64) not null, + TYPE_ varchar(255), + TOTAL_JOBS_ integer, + JOBS_PER_SEED_ integer, + INVOCATIONS_PER_JOB_ integer, + SEED_JOB_DEF_ID_ varchar(64), + MONITOR_JOB_DEF_ID_ varchar(64), + BATCH_JOB_DEF_ID_ varchar(64), + TENANT_ID_ varchar(64), + START_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_EXT_TASK_LOG ( + ID_ varchar(64) not null, + TIMESTAMP_ timestamp(3) not null, + EXT_TASK_ID_ varchar(64) not null, + RETRIES_ integer, + TOPIC_NAME_ varchar(255), + WORKER_ID_ varchar(255), + PRIORITY_ bigint NOT NULL DEFAULT 0, + ERROR_MSG_ varchar(4000), + ERROR_DETAILS_ID_ varchar(64), + ACT_ID_ varchar(255), + ACT_INST_ID_ varchar(64), + EXECUTION_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + PROC_DEF_ID_ varchar(64), + PROC_DEF_KEY_ varchar(255), + TENANT_ID_ varchar(64), + STATE_ integer, + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_); +create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_); +create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_); +create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_); +create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_); +create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_); +create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_); +create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_); +create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_); + +create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_); +create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_); +create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_); + +create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_); +create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_); +create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_); +create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_); +create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_); +create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_); +create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_); +create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_); +create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_); + +create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_); +create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_); +create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_); +create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_); +create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_); + +create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_); +create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_); +create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_); +create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_); +create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_); +create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_); + +create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_); +create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_); +create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_); + +create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_); +create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_); +create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_); +create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_); +create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_); + +create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_); +create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_); +create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_); +create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_); +create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_); + +create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_); +create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_); + +create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_); +create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_); + +create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_); +create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_); +create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_); +create table ACT_HI_CASEINST ( + ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + BUSINESS_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64) not null, + CREATE_TIME_ datetime(3) not null, + CLOSE_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + CREATE_USER_ID_ varchar(255), + SUPER_CASE_INSTANCE_ID_ varchar(64), + SUPER_PROCESS_INSTANCE_ID_ varchar(64), + TENANT_ID_ varchar(64), + primary key (ID_), + unique (CASE_INST_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_HI_CASEACTINST ( + ID_ varchar(64) not null, + PARENT_ACT_INST_ID_ varchar(64), + CASE_DEF_ID_ varchar(64) not null, + CASE_INST_ID_ varchar(64) not null, + CASE_ACT_ID_ varchar(255) not null, + TASK_ID_ varchar(64), + CALL_PROC_INST_ID_ varchar(64), + CALL_CASE_INST_ID_ varchar(64), + CASE_ACT_NAME_ varchar(255), + CASE_ACT_TYPE_ varchar(255), + CREATE_TIME_ datetime(3) not null, + END_TIME_ datetime(3), + DURATION_ bigint, + STATE_ integer, + REQUIRED_ boolean, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_); +create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_); +create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_); +create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_); +create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_); +create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_); +create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_); +create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_); +-- create history decision instance table -- +create table ACT_HI_DECINST ( + ID_ varchar(64) NOT NULL, + DEC_DEF_ID_ varchar(64) NOT NULL, + DEC_DEF_KEY_ varchar(255) NOT NULL, + DEC_DEF_NAME_ varchar(255), + PROC_DEF_KEY_ varchar(255), + PROC_DEF_ID_ varchar(64), + PROC_INST_ID_ varchar(64), + CASE_DEF_KEY_ varchar(255), + CASE_DEF_ID_ varchar(64), + CASE_INST_ID_ varchar(64), + ACT_INST_ID_ varchar(64), + ACT_ID_ varchar(255), + EVAL_TIME_ datetime(3) not null, + COLLECT_VALUE_ double, + USER_ID_ varchar(255), + ROOT_DEC_INST_ID_ varchar(64), + DEC_REQ_ID_ varchar(64), + DEC_REQ_KEY_ varchar(255), + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision input table -- +create table ACT_HI_DEC_IN ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +-- create history decision output table -- +create table ACT_HI_DEC_OUT ( + ID_ varchar(64) NOT NULL, + DEC_INST_ID_ varchar(64) NOT NULL, + CLAUSE_ID_ varchar(64), + CLAUSE_NAME_ varchar(255), + RULE_ID_ varchar(64), + RULE_ORDER_ integer, + VAR_NAME_ varchar(255), + VAR_TYPE_ varchar(100), + BYTEARRAY_ID_ varchar(64), + DOUBLE_ double, + LONG_ bigint, + TEXT_ LONGBLOB, + TEXT2_ LONGBLOB, + TENANT_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + + +create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_); +create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_); +create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_); +create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_); +create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_); +create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_); +create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_); +create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_); +create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_); + + +create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_); + +create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_); +create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_); + +-- mariadb_identity_7.8.0-ee + +create table ACT_ID_GROUP ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + TYPE_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_MEMBERSHIP ( + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (USER_ID_, GROUP_ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_USER ( + ID_ varchar(64), + REV_ integer, + FIRST_ varchar(255), + LAST_ varchar(255), + EMAIL_ varchar(255), + PWD_ varchar(255), + SALT_ varchar(255), + PICTURE_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_INFO ( + ID_ varchar(64), + REV_ integer, + USER_ID_ varchar(64), + TYPE_ varchar(64), + KEY_ varchar(255), + VALUE_ varchar(255), + PASSWORD_ LONGBLOB, + PARENT_ID_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT ( + ID_ varchar(64), + REV_ integer, + NAME_ varchar(255), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +create table ACT_ID_TENANT_MEMBER ( + ID_ varchar(64) not null, + TENANT_ID_ varchar(64) not null, + USER_ID_ varchar(64), + GROUP_ID_ varchar(64), + primary key (ID_) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin; + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + +alter table ACT_ID_MEMBERSHIP + add constraint ACT_FK_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_USER + unique (TENANT_ID_, USER_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_UNIQ_TENANT_MEMB_GROUP + unique (TENANT_ID_, GROUP_ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB + foreign key (TENANT_ID_) + references ACT_ID_TENANT (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_USER + foreign key (USER_ID_) + references ACT_ID_USER (ID_); + +alter table ACT_ID_TENANT_MEMBER + add constraint ACT_FK_TENANT_MEMB_GROUP + foreign key (GROUP_ID_) + references ACT_ID_GROUP (ID_); + + |