diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/test')
56 files changed, 3147 insertions, 2417 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy index ae40e9d7c6..101db4f021 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCustomE2EServiceInstanceTest.groovy @@ -41,9 +41,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class CreateCustomE2EServiceInstanceTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Before public void init() throws IOException { MockitoAnnotations.initMocks(this); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy index 77220da94f..c5fd377a72 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVfModuleInfraTest.groovy @@ -44,9 +44,6 @@ class CreateVfModuleInfraTest { def prefix = "CVFMI_" def requestInfo = "<requestInfo><request-id>12345</request-id></requestInfo>" - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy new file mode 100644 index 0000000000..afbace76d6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy @@ -0,0 +1,301 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.domain.Resource +import org.onap.so.bpmn.core.domain.ServiceDecomposition + +import static com.shazam.shazamcrest.MatcherAssert.assertThat +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when +/** + * Copyright 2018 ZTE Corporation. + * + * 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. + */ +class DoCompareServiceInstanceDataTest extends MsoGroovyTest { + + + public static final String uuiSoString = "{\n" + + " \"service\":{\n" + + " \"name\":\"SiteService\",\n" + + " \"description\":\"SiteService\",\n" + + " \"serviceInvariantUuid\":\"5c13f3fb-2744-4635-9f1f-c59c92dc8f70\",\n" + + " \"serviceUuid\":\"3a76b1f5-fb0d-4b6b-82d5-0e8a4ebc3838\",\n" + + " \"globalSubscriberId\":\"test_custormer\",\n" + + " \"serviceType\":\"example-service-type\",\n" + + " \"parameters\":{\n" + + " \"locationConstraints\":[\n" + + "\n" + + " ],\n" + + " \"resources\":[\n" + + " {\n" + + " \"resourceIndex\":\"1\",\n" + + " \"resourceName\":\"sdwanvpnresource\",\n" + + " \"resourceInvariantUuid\":\"0c0e1cbe-6e01-4f9e-8c45-a9700ebc14df\",\n" + + " \"resourceUuid\":\"4ad2d390-5c51-45f5-9710-b467a4ec7a73\",\n" + + " \"resourceCustomizationUuid\":\"66590e07-0777-415c-af44-36347cf3ddd3\",\n" + + " \"parameters\":{\n" + + " \"locationConstraints\":[\n" + + "\n" + + " ],\n" + + " \"resources\":[\n" + + "\n" + + " ],\n" + + " \"requestInputs\":{\n" + + "\n" + + " }\n" + + " }\n" + + " },\n" + + " {\n" + + " \"resourceIndex\":\"1\",\n" + + " \"resourceName\":\"sdwansiteresource\",\n" + + " \"resourceInvariantUuid\":\"97a3e552-08c4-4697-aeeb-d8d3e09ce58e\",\n" + + " \"resourceUuid\":\"63d8e1af-32dc-4c71-891d-e3f7b6a976d2\",\n" + + " \"resourceCustomizationUuid\":\"205456e7-3dc0-40c4-8cb0-28e6c1877042\",\n" + + " \"parameters\":{\n" + + " \"locationConstraints\":[\n" + + "\n" + + " ],\n" + + " \"resources\":[\n" + + "\n" + + " ],\n" + + " \"requestInputs\":{\n" + + "\n" + + " }\n" + + " }\n" + + " },\n" + + " {\n" + + " \"resourceIndex\":\"2\",\n" + + " \"resourceName\":\"sdwansiteresource\",\n" + + " \"resourceInvariantUuid\":\"97a3e552-08c4-4697-aeeb-d8d3e09ce58e\",\n" + + " \"resourceUuid\":\"63d8e1af-32dc-4c71-891d-e3f7b6a976d2\",\n" + + " \"resourceCustomizationUuid\":\"205456e7-3dc0-40c4-8cb0-28e6c1877042\",\n" + + " \"parameters\":{\n" + + " \"locationConstraints\":[\n" + + "\n" + + " ],\n" + + " \"resources\":[\n" + + "\n" + + " ],\n" + + " \"requestInputs\":{\n" + + "\n" + + " }\n" + + " }\n" + + " }\n" + + " ],\n" + + " \"requestInputs\":{\n" + + " \"sdwanvpnresource_list\":[\n" + + " {\n" + + " \"sdwanvpn_topology\":\"hub_spoke\",\n" + + " \"sdwanvpn_name\":\"defaultvpn\",\n" + + " \"sdwansitelan_list\":[\n" + + " {\n" + + " \"role\":\"Hub\",\n" + + " \"portType\":\"GE\",\n" + + " \"portSwitch\":\"layer3-port\",\n" + + " \"vlanId\":\"\",\n" + + " \"ipAddress\":\"192.168.10.1\",\n" + + " \"deviceName\":\"vCPE\",\n" + + " \"portNumer\":\"0/0/1\"\n" + + " },\n" + + " {\n" + + " \"role\":\"Hub\",\n" + + " \"portType\":\"GE\",\n" + + " \"portSwitch\":\"layer2-port\",\n" + + " \"vlanId\":\"55\",\n" + + " \"ipAddress\":\"192.168.11.1\",\n" + + " \"deviceName\":\"CPE_Beijing\",\n" + + " \"portNumer\":\"0/0/1\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ],\n" + + " \"sdwansiteresource_list\":[\n" + + " {\n" + + " \"sdwansite_emails\":\"chenchuanyu@huawei.com\",\n" + + " \"sdwansite_address\":\"Huawei Public Cloud\",\n" + + " \"sdwansite_description\":\"DC Site\",\n" + + " \"sdwansite_role\":\"dsvpn_hub\",\n" + + " \"sdwansite_postcode\":\"20000\",\n" + + " \"sdwansite_type\":\"single_gateway\",\n" + + " \"sdwansite_latitude\":\"\",\n" + + " \"sdwansite_controlPoint\":\"\",\n" + + " \"sdwansite_longitude\":\"\",\n" + + " \"sdwansitewan_list\":[\n" + + " {\n" + + " \"providerIpAddress\":\"\",\n" + + " \"portType\":\"GE\",\n" + + " \"inputBandwidth\":\"1000\",\n" + + " \"ipAddress\":\"\",\n" + + " \"name\":\"10000\",\n" + + " \"transportNetworkName\":\"internet\",\n" + + " \"outputBandwidth\":\"10000\",\n" + + " \"deviceName\":\"vCPE\",\n" + + " \"portNumber\":\"0/0/0\",\n" + + " \"ipMode\":\"DHCP\",\n" + + " \"publicIP\":\"119.3.7.113\"\n" + + " }\n" + + " ],\n" + + " \"sdwandevice_list\":[\n" + + " {\n" + + " \"esn\":\"XXXXXXX\",\n" + + " \"vendor\":\"Huawei\",\n" + + " \"name\":\"vCPE\",\n" + + " \"type\":\"AR1000V\",\n" + + " \"version\":\"1.0\",\n" + + " \"class\":\"VNF\",\n" + + " \"systemIp\":\"20.20.20.1\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " {\n" + + " \"sdwansite_emails\":\"chenchuanyu@huawei.com\",\n" + + " \"sdwansite_address\":\"Huawei Public Cloud\",\n" + + " \"sdwansite_description\":\"DC Site\",\n" + + " \"sdwansite_role\":\"dsvpn_hub\",\n" + + " \"sdwansite_postcode\":\"20000\",\n" + + " \"sdwansite_type\":\"single_gateway\",\n" + + " \"sdwansite_latitude\":\"\",\n" + + " \"sdwansite_controlPoint\":\"\",\n" + + " \"sdwansite_longitude\":\"\",\n" + + " \"sdwansitewan_list\":[\n" + + " {\n" + + " \"providerIpAddress\":\"\",\n" + + " \"portType\":\"GE\",\n" + + " \"inputBandwidth\":\"1000\",\n" + + " \"ipAddress\":\"172.18.1.2/24\",\n" + + " \"name\":\"10000\",\n" + + " \"transportNetworkName\":\"internet\",\n" + + " \"outputBandwidth\":\"10000\",\n" + + " \"deviceName\":\"CPE_Beijing\",\n" + + " \"portNumber\":\"0/0/0\",\n" + + " \"ipMode\":\"Static\",\n" + + " \"publicIP\":\"\"\n" + + " }\n" + + " ],\n" + + " \"sdwandevice_list\":[\n" + + " {\n" + + " \"esn\":\"XXXXXXX\",\n" + + " \"vendor\":\"Huawei\",\n" + + " \"name\":\"CPE_Beijing\",\n" + + " \"type\":\"AR161\",\n" + + " \"version\":\"1.0\",\n" + + " \"class\":\"PNF\",\n" + + " \"systemIp\":\"20.20.20.2\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + " }\n" + + "}" + + @Before + void setUp() { + super.init("DoCompareServiceInstanceData") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest() { + mockData() + DoCompareServiceInstanceData csi = new DoCompareServiceInstanceData() + csi.preProcessRequest(mockExecution) + } + + @Test(expected = BpmnError.class) + void testPreProcessRequestException() { + DoCompareServiceInstanceData csi = new DoCompareServiceInstanceData() + csi.preProcessRequest(mockExecution) + } + + @Test + void testPrepareDecomposeService_Original() { + mockData() + DoCompareServiceInstanceData csi = new DoCompareServiceInstanceData() + csi.prepareDecomposeService_Original(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + String serviceModelInfo = getServiceModelInfo() + assertThat(captor.getValue(), sameBeanAs(serviceModelInfo)) + } + + @Test + void testProcessDecomposition_Original() { + mockData() + DoCompareServiceInstanceData csi = new DoCompareServiceInstanceData() + csi.processDecomposition_Original(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + ServiceDecomposition serviceDecomposition = getServiceDecomposition() + assertThat(captor.getValue(), sameBeanAs(serviceDecomposition)) + } + + @Test + void testDoCompareUuiRquestInput() { + mockData() + DoCompareServiceInstanceData csi = new DoCompareServiceInstanceData() + csi.doCompareUuiRquestInput(mockExecution) + Mockito.verify(mockExecution, times(4)).setVariable(captor.capture(), captor.capture()) + } + + private String getServiceModelInfo() { + String modelInvariantUuid = mockExecution.getVariable("model-invariant-id-original") + String modelUuid = mockExecution.getVariable("model-version-id-original") + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + serviceModelInfo + } + + private void mockData() { + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("12345") + when(mockExecution.getVariable("model-version-id-original")).thenReturn("12345") + when(mockExecution.getVariable("model-invariant-id-original")).thenReturn("12345") + when(mockExecution.getVariable("uuiRequest")).thenReturn(uuiSoString) + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("1234") + when(mockExecution.getVariable("serviceInstanceData-original")).thenReturn(getExpectedServiceInstance()) + when(mockExecution.getVariable("serviceDecomposition")).thenReturn(getServiceDecomposition()) + when(mockExecution.getVariable("serviceDecomposition_Original")).thenReturn(getServiceDecomposition()) + } + + private ServiceDecomposition getServiceDecomposition() { + ServiceDecomposition decomposition = new ServiceDecomposition() + List<Resource> allSR_original = new ArrayList<>() + decomposition.setAllottedResources(allSR_original) + return decomposition + } + + private ServiceInstance getExpectedServiceInstance() { + ServiceInstance expectedServiceInstanceData = new ServiceInstance() + expectedServiceInstanceData.setServiceInstanceId("1234") + expectedServiceInstanceData.setServiceInstanceName("volte-service") + expectedServiceInstanceData.setServiceType("E2E Service") + expectedServiceInstanceData.setServiceRole("E2E Service") + expectedServiceInstanceData.setInputParameters(uuiSoString) + return expectedServiceInstanceData + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy index 5ee10bc931..9214b386eb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollbackTest.groovy @@ -55,10 +55,7 @@ import org.apache.commons.lang3.* @RunWith(MockitoJUnitRunner.class) class DoCreateNetworkInstanceRollbackTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - - def utils = new MsoUtils() + def utils = new MsoUtils() String Prefix="CRENWKIR_" diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy index b246caf40e..90c7b71a07 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateServiceInstanceTest.groovy @@ -41,9 +41,6 @@ class DoCreateServiceInstanceTest extends MsoGroovyTest{ def prefix = "DCRESI_" @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - - @Rule public ExpectedException thrown = ExpectedException.none() @Before diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy index e7ebe23e75..dd18049b5f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleRollbackTest.groovy @@ -62,9 +62,6 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ @Spy DoCreateVfModuleRollback doCreateVfModuleRollback - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) @@ -165,6 +162,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) List fqdnList = new ArrayList() fqdnList.add("test") @@ -194,6 +192,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) List fqdnList = new ArrayList() fqdnList.add("test") @@ -223,6 +222,7 @@ class DoCreateVfModuleRollbackTest extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("DCVFM_cloudSiteId")).thenReturn("12345") + when(mockExecution.getVariable("DCVFM_cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable("rollbackData")).thenReturn(new RollbackData()) List fqdnList = new ArrayList() fqdnList.add("test") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy index 30e3779b53..faa6a0e395 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy @@ -47,9 +47,6 @@ import static org.mockito.Mockito.* class DoCreateVfModuleTest { def prefix = "DCVFM_" - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy index 47db6b3b7b..a8c818e69c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfAndModulesTest.groovy @@ -54,9 +54,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class DoCreateVnfAndModulesTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy index 9b421d8b63..d7ba10ad93 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnfTest.groovy @@ -44,9 +44,6 @@ import static org.mockito.Mockito.* class DoCreateVnfTest { def prefix = "DoCVNF_" - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy index a8bdfb0633..ea79e0eadd 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstanceTest.groovy @@ -46,9 +46,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class DoDeleteServiceInstanceTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy index cfdeee2c32..f356845a1e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleFromVnfTest.groovy @@ -54,9 +54,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) class DoDeleteVfModuleFromVnfTest extends MsoGroovyTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy index 7776ab3fe6..b56e108faf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleTest.groovy @@ -61,9 +61,6 @@ class DoDeleteVfModuleTest extends MsoGroovyTest{ @Spy DoDeleteVfModule doDeleteVfModule - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy index 94aec7a73f..2885d6919e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -26,21 +28,25 @@ import org.camunda.bpm.engine.RepositoryService import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.engine.repository.ProcessDefinition +import org.junit.After +import org.junit.AfterClass import org.junit.Assert import org.junit.Before -import org.junit.Ignore +import org.junit.BeforeClass import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor +import org.mockito.Mock import org.mockito.Mockito import org.mockito.MockitoAnnotations import org.mockito.Spy -import org.mockito.runners.MockitoJUnitRunner +import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.VolumeGroup import org.onap.so.bpmn.common.scripts.MsoGroovyTest import org.onap.so.bpmn.common.scripts.utils.XmlComparator +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.mock.FileUtil import org.onap.so.client.aai.AAIObjectType @@ -48,75 +54,111 @@ import org.onap.so.client.aai.entities.AAIResultWrapper import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException +import org.springframework.core.env.Environment +import org.springframework.mock.env.MockEnvironment import javax.ws.rs.NotFoundException import static com.github.tomakehurst.wiremock.client.WireMock.* import static org.mockito.Mockito.* -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.Silent.class) class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ + @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); + public WireMockRule wireMockRule = new WireMockRule(8090) @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) @Spy - DoDeleteVfModuleVolumeV2 deleteVfModuleVolumeV2; + DoDeleteVfModuleVolumeV2 deleteVfModuleVolumeV2 + + @Mock + Environment mockEnvironment + + private String Prefix = "DDVMV_" + private RepositoryService mockRepositoryService + + + @After + void cleanupEnv() { + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(null) + } @Before public void init() throws IOException { super.init("DoDeleteVfModuleVolumeV2") MockitoAnnotations.initMocks(this); when(deleteVfModuleVolumeV2.getAAIClient()).thenReturn(client) - + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.version")).thenReturn("14") + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.namespace")).thenReturn("defaultTestNamespace") + when(mockEnvironment.getProperty("aai.endpoint")).thenReturn("http://localhost:8090") + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(mockEnvironment) } @Test public void testCallRESTQueryAAICloudRegion() { ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") - when(mockExecution.getVariable("mso.workflow.DoDeleteVfModuleVolumeV2.aai.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:28090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + mockSuccessfulCloudData() - mockData() DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() obj.callRESTQueryAAICloudRegion(mockExecution, "true") Mockito.verify(mockExecution).setVariable("DDVMV_queryCloudRegionReturnCode", "200") Mockito.verify(mockExecution).setVariable("DDVMV_aicCloudRegion", "RDM2WAGPLCP") } - @Test + @Test(expected = GroovyRuntimeException.class) public void testCallRESTQueryAAICloudRegionAAiEndpointNull() { ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") - when(mockExecution.getVariable("mso.workflow.DoDeleteVfModuleVolumeV2.aai.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region") - when(mockExecution.getVariable("aai.endpoint")).thenReturn(null) - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn("http://org.openecomp.aai.inventory/") + when(mockEnvironment.getProperty("aai.endpoint")).thenReturn(null) - mockData() + mockSuccessfulCloudData() try { DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() obj.callRESTQueryAAICloudRegion(mockExecution, "true") } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " + println " Test End - Handle catch-throw Exception! " + Mockito.verify(mockExecution).getVariable(eq("lcpCloudRegionId")) + Assert.assertEquals(GroovyRuntimeException.class, ex.class) + throw ex } - Mockito.verify(mockExecution,atLeastOnce()).setVariable(captor.capture(),captor.capture()) - WorkflowException workflowException = captor.getValue() - Assert.assertEquals(9999, workflowException.getErrorCode()) + } + + @Test + public void testCallRESTQueryAAICloudRegionNotFound() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("12345") + when(mockExecution.getVariable(Prefix + "queryCloudRegionReturnCode")).thenReturn("404") + + wireMockRule.stubFor( + get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/12345")) + .willReturn(aResponse() + .withStatus(404))) + + DoDeleteVfModuleVolumeV2 obj = new DoDeleteVfModuleVolumeV2() + obj.callRESTQueryAAICloudRegion(mockExecution, "true") + + Mockito.verify(mockExecution).getVariable(eq("lcpCloudRegionId")) + Mockito.verify(mockExecution).setVariable(eq(Prefix + "queryCloudRegionReturnCode"), eq("404")) + Mockito.verify(mockExecution).setVariable(eq(Prefix + "aicCloudRegion"), eq("AAIAIC25")) } @Test public void testPrepareVnfAdapterDeleteRequest() { ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn("DDVMV_") + when(mockExecution.getVariable("prefix")).thenReturn(Prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable("aicCloudRegion")).thenReturn("RegionOne") when(mockExecution.getVariable("tenantId")).thenReturn("12345") @@ -141,8 +183,10 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") - Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithTenant.json"); + Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) + when(client.get(resourceUri)).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/AAI/VolumeGroupWithTenant.json"))) deleteVfModuleVolumeV2.callRESTQueryAAIForVolumeGroup(mockExecution,"true") Mockito.verify(mockExecution).setVariable("DDVMV_queryAAIVolGrpResponse", volumeGroup.get()) Mockito.verify(mockExecution).setVariable("DDVMV_volumeGroupHeatStackId", volumeGroup.get().getHeatStackId()) @@ -169,7 +213,7 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ when(mockExecution.getVariable("volumeGroupId")).thenReturn("VolumeGroup123") when(mockExecution.getVariable("DDVMV_aicCloudRegion")).thenReturn("Region1") AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP,CLOUD_OWNER, "Region1","VolumeGroup123") - Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/aai/VolumeGroupWithTenant.json"); + Optional<VolumeGroup> volumeGroup = getAAIObjectFromJson(VolumeGroup.class,"__files/AAI/VolumeGroupWithTenant.json"); when(client.get(VolumeGroup.class,resourceUri)).thenReturn(volumeGroup) try { deleteVfModuleVolumeV2.callRESTQueryAAIForVolumeGroup(mockExecution, "true") @@ -250,30 +294,20 @@ class DoDeleteVfModuleVolumeV2Test extends MsoGroovyTest{ private ExecutionEntity setupMock() { - ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) - when(mockProcessDefinition.getKey()).thenReturn("DoDeleteVfModuleVolumeV2") - RepositoryService mockRepositoryService = mock(RepositoryService.class) - when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) - when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteVfModuleVolumeV2") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") + mockRepositoryService = mock(RepositoryService.class) ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) - when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) + when(mockProcessEngineServices.getRepositoryService()).thenReturn(this.mockRepositoryService) ExecutionEntity mockExecution = mock(ExecutionEntity.class) // Initialize prerequisite variables - - when(mockExecution.getId()).thenReturn("100") - when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteVfModuleVolumeV2") - when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteVfModuleVolumeV2") when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) - when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) return mockExecution } - private void mockData() { - stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/12345")) + private void mockSuccessfulCloudData() { + wireMockRule.stubFor(get(urlMatching(".*/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/12345")) .willReturn(aResponse() .withStatus(200).withHeader("Content-Type", "text/xml") .withBodyFile("DoCreateVfModuleVolumeV2/cloudRegion_AAIResponse_Success.xml"))) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy index f98d454eb0..9e4ab6f757 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVnfAndModulesTest.groovy @@ -50,9 +50,6 @@ import static org.mockito.Mockito.* @RunWith(MockitoJUnitRunner.class) public class DoDeleteVnfAndModulesTest extends MsoGroovyTest{ - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy index 0189d065df..7bc82c1ccc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceRollbackTest.groovy @@ -52,9 +52,6 @@ import org.apache.commons.lang3.* @RunWith(MockitoJUnitRunner.class) class DoUpdateNetworkInstanceRollbackTest { - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - def utils = new MsoUtils() String Prefix="UPDNETIR_" diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy index 68a9ed659e..19bb7c86b4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstanceTest.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -20,33 +22,34 @@ package org.onap.so.bpmn.infrastructure.scripts - -import static org.mockito.Mockito.* -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkByIdWithDepth; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkVpnBinding; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkTableReference; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkPolicy; -import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutNetworkIdWithDepth; +import com.github.tomakehurst.wiremock.client.WireMock +import com.github.tomakehurst.wiremock.junit.WireMockRule import org.camunda.bpm.engine.ProcessEngineServices import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.camunda.bpm.engine.repository.ProcessDefinition -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.junit.Before -import org.junit.Rule -import org.junit.Test +import org.junit.* import org.junit.runner.RunWith import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner +import org.mockito.junit.MockitoJUnitRunner +import org.onap.aai.domain.yang.* import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException - -import com.github.tomakehurst.wiremock.client.WireMock -import com.github.tomakehurst.wiremock.junit.WireMockRule -import org.apache.commons.lang3.* - +import org.onap.so.bpmn.mock.FileUtil +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.springframework.mock.env.MockEnvironment + +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.ArgumentMatchers.isA +import static org.mockito.ArgumentMatchers.refEq +import static org.mockito.Mockito.atLeast +import static org.mockito.Mockito.mock +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when +import static org.onap.so.bpmn.mock.StubResponseAAI.* @RunWith(MockitoJUnitRunner.class) class DoUpdateNetworkInstanceTest { @@ -200,24 +203,6 @@ String expectedNetworkInputMissingCloudRegion = <sdncVersion>null</sdncVersion> </network-inputs>""" - String networkInputsMissingName = - """<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1"> - <network-name/> - <network-type>CONTRAIL_EXTERNAL</network-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region> - <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id> - </network-inputs>""" - -String networkInputsMissingCloudRegion = -"""<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1"> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <aic-cloud-region/> - <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id> -</network-inputs>""" - // expectedNetworkRequest String expectedNetworkRequest = """<network-request xmlns="http://www.w3.org/2001/XMLSchema"> @@ -384,619 +369,6 @@ String expectedNetworkInputsMissingNetworkId = </vnfreq:network-params> </vnfreq:network-request>""" - // expectedNetworkRequest - String expectedNetworkRequest_Outputs = - """<vnfreq:network-request xmlns:vnfreq="http://org.onap/so/infra/vnf-request/v1"> - <vnfreq:request-info> - <vnfreq:request-id>1ef47428-cade-45bd-a103-0751e8b2deb0</vnfreq:request-id> - <vnfreq:action>UPDATE</vnfreq:action> - <vnfreq:source>PORTAL</vnfreq:source> - </vnfreq:request-info> - <vnfreq:network-inputs> - <vnfreq:network-name>MNS-25180-L-01-dmz_direct_net_1</vnfreq:network-name> - <vnfreq:network-type>CONTRAIL_EXTERNAL</vnfreq:network-type> - <vnfreq:service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</vnfreq:service-id> - <vnfreq:aic-cloud-region>RDM2WAGPLCP</vnfreq:aic-cloud-region> - <vnfreq:tenant-id>7dd5365547234ee8937416c65507d266</vnfreq:tenant-id> - </vnfreq:network-inputs> - <vnfreq:network-outputs> - <vnfreq:network-name>MNS-25180-L-01-dmz_direct_net_1</vnfreq:network-name> - <vnfreq:network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</vnfreq:network-id> - </vnfreq:network-outputs> - <vnfreq:network-params> - <param name="shared">1</param> - <param name="external">0</param> - </vnfreq:network-params> -</vnfreq:network-request>""" - - - String networkInputs = - """<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1"> - <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region> - <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id> -</network-inputs>""" - - String networkOutputs = - """<network-outputs> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - </network-outputs>""" - - String queryAAIResponse = - """<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="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <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"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v3"> - <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> -</rest:RESTResponse>""" - - String queryIdAIIResponse = - """<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="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <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"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <resource-version>l3-version</resource-version> - <orchestration-status>pending-delete</orchestration-status> - <heat-stack-id>ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326</heat-stack-id> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-update</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-name>subnetName</subnet-name> - <subnet-role>ECOMP</subnet-role> - <ip-assignment-direction>true</ip-assignment-direction> - <host-routes> - <host-route> - <host-route-id>400d286b-7e44-4514-b9b3-f70f7360ff32</host-route-id> - <route-prefix>172.20.1.0/24</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857300987</resource-version> - </host-route> - <host-route> - <host-route-id>6f038013-8b15-4eb8-914b-507489fbc8ee</host-route-id> - <route-prefix>10.102.0.0/16</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857301151</resource-version> - </host-route> - <host-route> - <host-route-id>8811c5f8-f1ed-4fa0-a505-e1be60396e28</host-route-id> - <route-prefix>192.168.2.0/25</route-prefix> - <next-hop>10.102.200.1</next-hop> - <resource-version>1505857301954</resource-version> - </host-route> - </host-routes> - <relationship-list/> - </subnet> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-name>subnetName</subnet-name> - <ip-assignment-direction>true</ip-assignment-direction> - <host-routes> - <host-route> - <host-route-id>400d286b-7e44-4514-b9b3-f70f7360ff32</host-route-id> - <route-prefix>172.20.1.0/24</route-prefix> - <next-hop>10.102.200.1</next-hop> - <resource-version>1505857300987</resource-version> - </host-route> - </host-routes> - <relationship-list/> - </subnet> - </subnets> - <segmentation-assignments> - <segmentation-id>414</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <segmentation-assignments> - <segmentation-id>415</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <ctag-assignments> - <ctag-assignment> - <vlan-id-inner>inner</vlan-id-inner> - <resource-version>ctag-version</resource-version> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>897deadc2b954a6bac6d3c197fb3525e</relationship-value> - </relationship-data> - <related-to-property> - <property-key>tenant.tenant-name</property-key> - <property-value>MSOTest1</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>a290b841-f672-44dd-b9cd-6f8c20d7d8c8</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest2</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest1</property-value> - </related-to-property> - </relationship> - </relationship-list> - </ctag-assignment> - </ctag-assignments> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>network-policy</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg</related-link> - <relationship-data> - <relationship-key>network-policy.network-policy-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> -</rest:RESTResponse>""" - - String queryIdAIIResponseTestScenario01 = - """<?xml version="1.0" encoding="UTF-8"?> -<l3-network xmlns="http://org.openecomp.aai.inventory/v7"> - <network-id>4da55fe4-7a9e-478c-a434-8a98d62265ab</network-id> - <network-name>GN_EVPN_direct_net_0_ST1</network-name> - <network-type>CONTRAIL30_BASIC</network-type> - <network-role>GN_EVPN_direct</network-role> - <network-technology>contrail</network-technology> - <is-bound-to-vpn>false</is-bound-to-vpn> - <service-id>9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <resource-version>1465398611</resource-version> - <orchestration-status>pending-delete</orchestration-status> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>cb1a7b47-5428-44c9-89c2-8b17541c3228</subnet-id> - <gateway-address>108.239.40.1</gateway-address> - <network-start-address>108.239.40.0</network-start-address> - <cidr-mask>28</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <dhcp-start>108.239.40.0</dhcp-start> - <dhcp-end>108.239.40.0</dhcp-end> - <resource-version>1465398611</resource-version> - <subnet-name>subnetName</subnet-name> - <relationship-list /> - </subnet> - <subnet> - <subnet-id>e2cc7c14-90f0-4205-840d-b4e07f04e621</subnet-id> - <gateway-address>2606:ae00:2e01:604::1</gateway-address> - <network-start-address>2606:ae00:2e01:604::</network-start-address> - <cidr-mask>64</cidr-mask> - <ip-version>6</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <dhcp-start>2606:ae00:2e01:604::</dhcp-start> - <dhcp-end>2606:ae00:2e01:604::</dhcp-end> - <resource-version>1465398611</resource-version> - <subnet-name>subnetName</subnet-name> - <relationship-list /> - </subnet> - </subnets> - <ctag-assignments /> - <segmentation-assignments> - <segmentation-id>416</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <relationship-list> - <relationship> - <related-to>cloud-region</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/ - </related-link> - <relationship-data> - <relationship-key>cloud-region.cloud-region-id</relationship-key> - <relationship-value>AAIAIC25</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>CloudOwner</relationship-value> - </relationship-data> - <related-to-property> - <property-key>cloud-region.owner-defined-type</property-key> - <property-value></property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://localhost:8443/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/AAIAIC25/tenants/tenant/4ae1d3446a4c48b2bec44b6cfba06d68/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>4ae1d3446a4c48b2bec44b6cfba06d68 - </relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-owner</relationship-key> - <relationship-value>CloudOwner</relationship-value> - </relationship-data> - <relationship-data> - <relationship-key>cloud-region.cloud-region-id</relationship-key> - <relationship-value>AAIAIC25</relationship-value> - </relationship-data> - <related-to-property> - <property-key>tenant.tenant-name</property-key> - <property-value>Ruchira Contrail 3.0 test</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://localhost:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</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>GN_EVPN_direct_net_0_ST1</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - </relationship-list> -</l3-network>""" - - String queryIdAIIResponseVpnNotPresent = - """<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="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <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"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-name>subnetName</subnet-name> - <relationship-list/> - </subnet> - </subnets> - <relationship-list/> - </l3-network> - </rest:payload> -</rest:RESTResponse>""" - - String queryNameAIIResponse = - """<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="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <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"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> - </rest:RESTResponse>""" - - String queryNameAIIResponseVpnNotPresent = - """<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="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:502-132671"/> - <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"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v6> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <orchestration-status>pending-delete</orchestration-status> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>pending-delete</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - </l3-network> - </rest:payload> - </rest:RESTResponse>""" - - String aaiVpnResponseStub = - """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - xmlns="http://org.openecomp.aai.inventory/v8" - contentType="text/xml"> - <vpn-binding> - <global-route-target/> - </vpn-binding> -</rest:payload>""" - - String queryVpnBindingAAIResponse = - """<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"> - <vpn-binding xmlns="http://org.openecomp.aai.inventory/v6"> - <vpn-id>9a7b327d9-287aa00-82c4b0-105757</vpn-id> - <vpn-name>GN_EVPN_Test</vpn-name> - <global-route-target>13979:105757</global-route-target> - <relationship-list> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/689ec39e-c5fc-4462-8db2-4f760763ad28/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>689ec39e-c5fc-4462-8db2-4f760763ad28</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/1a49396b-19b3-40a4-8792-aa2fbd0f0704/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>1a49396b-19b3-40a4-8792-aa2fbd0f0704</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>l3-network</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/network/l3-networks/l3-network/774f3329-3c83-4771-86c7-9e6207cd50fd/</related-link> - <relationship-data> - <relationship-key>l3-network.network-id</relationship-key> - <relationship-value>774f3329-3c83-4771-86c7-9e6207cd50fd</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </vpn-binding> - </rest:payload> -</rest:RESTResponse>""" - String updateNetworkRequest = """<updateNetworkRequest> @@ -1172,271 +544,10 @@ String updateNetworkRequest_noPhysicalName = </networkRollback> </rollbackNetworkRequest>""" - String updateNetworkResponse = - """<ns2:updateNetworkContrailResponse xmlns:ns2="http://org.onap.so/network" - xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> - <networkId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkId> - <neutronNetworkId>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutronNetworkId> - <networkStackId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkStackId> - <networkFqdn>default-domain:MSOTest:GN_EVPN_direct_net_0_ST1</networkFqdn> - <subnetIdMap> - <entry> - <key>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</key> - <value>bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73</value> - </entry> - </subnetIdMap> - <rollback> - <cloudId>RDM2WAGPLCP</cloudId> - <msoRequest> - <requestId>1ef47428-cade-45bd-a103-0751e8b2deb0</requestId> - <serviceInstanceId/> - </msoRequest> - <networkUpdated>true</networkUpdated> - <networkId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkId> - <networkType>CONTRAIL_EXTERNAL</networkType> - <networkUpdated>false</networkUpdated> - <neutronNetworkId>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutronNetworkId> - <tenantId>7dd5365547234ee8937416c65507d266</tenantId> - </rollback> -</ns2:updateNetworkContrailResponse>""" - - String updateContrailAAIPayloadRequest = - """<l3-network xmlns="http://org.openecomp.aai.inventory/v9"> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>dmz_direct</network-role> - <network-technology>contrail</network-technology> - <neutron-network-id>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutron-network-id> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <network-role-instance>0</network-role-instance> - <resource-version>l3-version</resource-version> - <orchestration-status>Active</orchestration-status> - <heat-stack-id>ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326</heat-stack-id> - <contrail-network-fqdn>default-domain:MSOTest:GN_EVPN_direct_net_0_ST1</contrail-network-fqdn> - <physical-network-name>networkName</physical-network-name> - <is-provider-network>false</is-provider-network> - <is-shared-network>true</is-shared-network> - <is-external-network>false</is-external-network> - <subnets> - <subnet> - <subnet-id>57e9a1ff-d14f-4071-a828-b19ae98eb2fc</subnet-id> - <neutron-subnet-id>bd8e87c6-f4e2-41b8-b0bc-9596aa00cd73</neutron-subnet-id> - <gateway-address>107.239.52.1</gateway-address> - <network-start-address>107.239.52.0</network-start-address> - <cidr-mask>24</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>Active</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <subnet-role>ECOMP</subnet-role> - <resource-version>1505857300987</resource-version> - <subnet-name>subnetName</subnet-name> - <ip-assignment-direction>true</ip-assignment-direction> - <host-routes> - <host-route> - <host-route-id>400d286b-7e44-4514-b9b3-f70f7360ff32</host-route-id> - <route-prefix>172.20.1.0/24</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857300987</resource-version> - </host-route> - <host-route> - <host-route-id>6f038013-8b15-4eb8-914b-507489fbc8ee</host-route-id> - <route-prefix>10.102.0.0/16</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type>ip-address</next-hop-type> - <resource-version>1505857301151</resource-version> - </host-route> - <host-route> - <host-route-id>8811c5f8-f1ed-4fa0-a505-e1be60396e28</host-route-id> - <route-prefix>192.168.2.0/25</route-prefix> - <next-hop>10.102.200.1</next-hop> - <next-hop-type/> - <resource-version>1505857301954</resource-version> - </host-route> - </host-routes> - </subnet> - </subnets> - <segmentation-assignments> - <segmentation-id>414</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <segmentation-assignments> - <segmentation-id>415</segmentation-id> - <resource-version>4132176</resource-version> - </segmentation-assignments> - <ctag-assignments> - <ctag-assignment> - <vlan-id-inner>inner</vlan-id-inner> - <resource-version>ctag-version</resource-version> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/897deadc2b954a6bac6d3c197fb3525e/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>897deadc2b954a6bac6d3c197fb3525e</relationship-value> - </relationship-data> - <related-to-property> - <property-key>tenant.tenant-name</property-key> - <property-value>MSOTest1</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/a290b841-f672-44dd-b9cd-6f8c20d7d8c8/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>a290b841-f672-44dd-b9cd-6f8c20d7d8c8</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest2</property-value> - </related-to-property> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-ext1.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/24a4b507-853a-4a38-99aa-05fcc54be24d/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>24a4b507-853a-4a38-99aa-05fcc54be24d</relationship-value> - </relationship-data> - <related-to-property> - <property-key>vpn-binding.vpn-name</property-key> - <property-value>oam_protected_net_6_MTN5_msotest1</property-value> - </related-to-property> - </relationship> - </relationship-list> - </ctag-assignment> - </ctag-assignments> - <relationship-list> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>85f015d0-2e32-4c30-96d2-87a1a27f8017</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>vpn-binding</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/</related-link> - <relationship-data> - <relationship-key>vpn-binding.vpn-id</relationship-key> - <relationship-value>c980a6ef-3b88-49f0-9751-dbad8608d0a6</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/7dd5365547234ee8937416c65507d266/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>7dd5365547234ee8937416c65507d266</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>network-policy</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg</related-link> - <relationship-data> - <relationship-key>network-policy.network-policy-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0cg</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN1</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - <relationship> - <related-to>route-table-reference</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/route-table-references/route-table-reference/refFQDN2</related-link> - <relationship-data> - <relationship-key>route-table-reference.route-table-reference-id</relationship-key> - <relationship-value>cee6d136-e378-4678-a024-2cd15f0ee0hi</relationship-value> - </relationship-data> - </relationship> - </relationship-list> -</l3-network>""" - - - String updateContrailAAIResponse = - """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" - statusCode="200"> - <rest:headers> - <rest:header name="Date" value="Thu,10 Mar 2016 00:01:18 GMT"/> - <rest:header name="Content-Length" value="0"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" value="mtcnjv9aaas03-20160310-00:01:18:551-132672"/> - <rest:header name="Server" value="Apache-Coyote/1.1"/> - <rest:header name="Cache-Control" value="private"/> - </rest:headers> -</rest:RESTResponse>""" - - String updateNetworkErrorResponse = - """<updateNetworkError> - <messageId>680bd458-5ec1-4a16-b77c-509022e53450</messageId><category>INTERNAL</category> - <message>400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data</message> - <rolledBack>true</rolledBack> - </updateNetworkError>""" - String networkException500 = """<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:VersionMismatch</faultcode><faultstring>"http://org.onap.so/network", the namespace on the "updateNetworkContrail" element, is not a valid SOAP version.</faultstring></soap:Fault></soap:Body></soap:Envelope>""" - String aaiResponse = - """<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="Sat,30 Jan 2016 20:09:24 GMT"/> - <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/> - <rest:header name="X-AAI-TXID" - value="localhost-20160130-20:09:24:814-165843"/> - <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"> - <l3-network xmlns="http://org.openecomp.aai.inventory/v3"> - <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-role>HSL_direct</network-role> - <network-technology>contrail</network-technology> - <neutron-network-id>8bbd3edf-b835-4610-96a2-a5cafa029042</neutron-network-id> - <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id> - <orchestration-status>active</orchestration-status> - <heat-stack-id>MNS-25180-L-01-dmz_direct_net_1/57594a56-1c92-4a38-9caa-641c1fa3d4b6</heat-stack-id> - <subnets> - <subnet> - <subnet-id>ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a</subnet-id> - <neutron-subnet-id>5a77fdc2-7789-4649-a1b9-6eaf1db1813a</neutron-subnet-id> - <gateway-address>172.16.34.1</gateway-address> - <network-start-address>172.16.34.0</network-start-address> - <cidr-mask>28</cidr-mask> - <ip-version>4</ip-version> - <orchestration-status>active</orchestration-status> - <dhcp-enabled>true</dhcp-enabled> - <relationship-list/> - </subnet> - </subnets> - <relationship-list> - <relationship> - <related-to>tenant</related-to> - <related-link>https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/</related-link> - <relationship-data> - <relationship-key>tenant.tenant-id</relationship-key> - <relationship-value>e81d842d3e8b45c5a59f57cd76af3aaf</relationship-value> - </relationship-data> - </relationship> - </relationship-list> - </l3-network> - </rest:payload> - </rest:RESTResponse>""" - String changeAssignSDNCRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" xmlns:ns5="http://org.onap/so/request/types/v1" @@ -1465,8 +576,8 @@ String updateNetworkRequest_noPhysicalName = </service-information> <network-request-information> <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - <network-type>CONTRAIL_EXTERNAL</network-type> - <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> + <network-type>CONTRAIL30_BASIC</network-type> + <network-name>vprobes_pktinternal_net_4_1806</network-name> <tenant>7dd5365547234ee8937416c65507d266</tenant> <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region> </network-request-information> @@ -1545,42 +656,6 @@ String assignResponse = </sdncadapterworkflow:response-data> </sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - String expected_sdncAdapterWorkflowResponse_Error = - """<sdncadapterworkflow:SDNCAdapterWorkflowResponse xmlns="com:att:sdnctl:vnf" - xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" - xmlns:tag0="http://org.onap.so/workflow/sdnc/adapter/schema/v1" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> - <sdncadapterworkflow:response-data> - <tag0:RequestData xsi:type="xs:string"> - <output> - <response-code>400</response-code> - <response-message>Error writing to l3-netework</response-message> - <ack-final-indicator>Y</ack-final-indicator> - <svc-request-id>c79240d8-34b5-4853-af69-2021928dba00</svc-request-id> - </output> - </tag0:RequestData> - </sdncadapterworkflow:response-data> -</sdncadapterworkflow:SDNCAdapterWorkflowResponse>""" - - String sdncAdapterWorkflowFormattedResponse = - """<aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1" - xmlns="com:att:sdnctl:vnf"> - <aetgt:response-data> - <output> - <svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id> - <response-code>200</response-code> - <ack-final-indicator>Y</ack-final-indicator> - <network-information> - <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> - </network-information> - <service-information> - <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type> - <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id> - <subscriber-name>notsurewecare</subscriber-name> - </service-information> - </output> - </aetgt:response-data> -</aetgt:SDNCAdapterWorkflowResponse>""" String rollbackSDNCRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1" @@ -1649,6 +724,22 @@ String rollbackNetworkRequest = // - - - - - - - - + @BeforeClass + static void initEnv() { + MockEnvironment mockEnvironment = mock(MockEnvironment.class) + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.version")).thenReturn("14") + when(mockEnvironment.getProperty("mso.workflow.global.default.aai.namespace")).thenReturn("defaultTestNamespace") + when(mockEnvironment.getProperty("aai.endpoint")).thenReturn("http://localhost:8090") + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(mockEnvironment) + } + + @AfterClass + static void cleanupEnv() { + UrnPropertiesReader urnPropertiesReader = new UrnPropertiesReader() + urnPropertiesReader.setEnvironment(null) + } + @Before public void init() { @@ -1743,117 +834,126 @@ String rollbackNetworkRequest = } - @Test - //@Ignore - public void preProcessRequest_NetworkRequest() { - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true) - when(mockExecution.getVariable("recipeTimeout")).thenReturn(0) - when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("vnfId")).thenReturn("") - when(mockExecution.getVariable("volumeGroupId")).thenReturn("") - when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") - when(mockExecution.getVariable("serviceType")).thenReturn("MOG") - when(mockExecution.getVariable("networkType")).thenReturn("modelName") - when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.rollback")).thenReturn("true") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - -// verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - // Authentications - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputs) - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - - } - - @Test - //@Ignore - public void preProcessRequest_vPERNetworkRequest() { - - String networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", + @Test + public void preProcessRequest_NetworkRequest() { + + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("requestAction")).thenReturn("UPDATE") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1610") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.adapters.po.auth")). + thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedNetworkInputs) + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") + verify(mockExecution).setVariable(Prefix + "networkOutputs", """<network-outputs> +\t <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> +\t <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> +\t </network-outputs>""") + verify(mockExecution).setVariable(Prefix + "networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4") + verify(mockExecution).setVariable(Prefix + "networkName", "MNS-25180-L-01-dmz_direct_net_1") + } + + @Test + public void preProcessRequest_vPERNetworkRequest() { + + String networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111", "modelName": "CONTRAIL_EXTERNAL", - "modelType": "CONTRAIL_EXTERNAL", - "modelVersion": "1", - "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", - "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" - }""".trim() - - println "************ preProcessRequest_Payload ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("disableRollback")).thenReturn("true") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") // optional - when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional - when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") - when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") - when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") - when(mockExecution.getVariable("failIfExists")).thenReturn("false") - when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) - when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") - when(mockExecution.getVariable("action")).thenReturn("UPDATE") - when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") - when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - - when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B") - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - - when(mockExecution.getVariable("mso.rollback")).thenReturn("true") - when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")).thenReturn("http://localhost:8090/SDNCAdapter") - when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter") - when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")).thenReturn("http://localhost:8090/SDNCAdapterRpc") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.preProcessRequest(mockExecution) - -// verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix + "") - - //verify variable initialization - initializeVariables(mockExecution) - - // Authentications - verify(mockExecution).setVariable("action", "UPDATE") - verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) - verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) - verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVperNetworkInputs) - verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=") - verify(mockExecution).setVariable(Prefix + "networkOutputs", "") - - } - - @Test + "modelType": "CONTRAIL_EXTERNAL", + "modelVersion": "1", + "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222", + "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764" + }""".trim() + + println "************ preProcessRequest_Payload ************* " + + ExecutionEntity mockExecution = setupMock() + + // Initialize prerequisite variables + when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("action")).thenReturn("UPDATE") + + when(mockExecution.getVariable("disableRollback")).thenReturn("true") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable("networkId")).thenReturn("49c86598-f766-46f8-84f8-8d1c1b10f9b4") // optional + when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1") // optional + when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb") + when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL") + when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266") + when(mockExecution.getVariable("failIfExists")).thenReturn("false") + when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo) + when(mockExecution.getVariable("sdncVersion")).thenReturn("1702") + + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + + when(mockExecution.getVariable("mso.adapters.po.auth")). + thenReturn("5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C") + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + + when(mockExecution.getVariable("mso.rollback")).thenReturn("true") + when(mockExecution.getVariable("mso.adapters.sdnc.endpoint")). + thenReturn("http://localhost:8090/SDNCAdapter") + when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")). + thenReturn("http://localhost:8090/networks/NetworkAdapter") + when(mockExecution.getVariable("mso.adapters.sdnc.resource.endpoint")). + thenReturn("http://localhost:8090/SDNCAdapterRpc") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + + //verify variable initialization + initializeVariables(mockExecution) + + // Authentications + verify(mockExecution).setVariable("action", "UPDATE") + verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest) + verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false) + verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVperNetworkInputs) + verify(mockExecution).setVariable(Prefix + "messageId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56") + verify(mockExecution).setVariable(Prefix + "source", "VID") + verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic dGVzdDp0ZXN0") + verify(mockExecution).setVariable(Prefix + "serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4") + verify(mockExecution).setVariable(eq(Prefix + "networkOutputs"), eq("""<network-outputs> +\t <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id> +\t <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name> +\t </network-outputs>""")) + + verify(mockExecution).setVariable(Prefix + "networkId", "49c86598-f766-46f8-84f8-8d1c1b10f9b4") + verify(mockExecution).setVariable(Prefix + "networkName", "MNS-25180-L-01-dmz_direct_net_1") + } + + @Test //@Ignore public void preProcessRequest_MissingNetworkId() { @@ -1968,107 +1068,88 @@ String rollbackNetworkRequest = } - @Test - //@Ignore - public void prepareUpdateNetworkRequest() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("<routeTableFqdns>refFQDN1</routeTableFqdns><routeTableFqdns>refFQDN2</routeTableFqdns>") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - - verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest) - - } - - - @Test - //@Ignore - public void prepareUpdateNetworkRequest_NoPhysicalname() { - - println "************ prepareNetworkRequest ************* " - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(NetworkRequest_noPhysicalName) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") - when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") - //when(mockExecution.getVariable(Prefix + "queryVpnBindingAAIResponse")).thenReturn(queryVpnBindingAAIResponse) - when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") - when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") - when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("") - when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - //when(mockExecution.getVariable("URN_?????")).thenReturn("") // notificationUrl, //TODO - is this coming from URN? What variable/value to use? - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - - verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest_noPhysicalName) - - } - - @Test - //@Ignore - public void prepareSDNCRequest() { - - println "************ prepareSDNCRequest ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") - when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") - when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn(aaiResponse) - when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") - when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn("https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") - - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareSDNCRequest(mockExecution) - - // verify set prefix = Prefix + "" - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", changeAssignSDNCRequest) - - } + @Test + public void prepareUpdateNetworkRequest() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(getContrailL3Network()) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + when(mockExecution.getVariable(Prefix + "routeCollection")). + thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") + when(mockExecution.getVariable(Prefix + "networkCollection")). + thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") + when(mockExecution.getVariable(Prefix + "tableRefCollection")). + thenReturn("<routeTableFqdns>refFQDN1</routeTableFqdns><routeTableFqdns>refFQDN2</routeTableFqdns>") + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest) + } + + + @Test + public void prepareUpdateNetworkRequest_NoPhysicalname() { + + println "************ prepareNetworkRequest ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_generated") + when(mockExecution.getVariable(Prefix + "source")).thenReturn("VID") + + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(NetworkRequest_noPhysicalName) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")). + thenReturn(getContrailL3Network()) + when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true") + + when(mockExecution.getVariable(Prefix + "routeCollection")).thenReturn("<routeTargets>13979:105757</routeTargets><routeTargets>13979:105757</routeTargets>") + when(mockExecution.getVariable(Prefix + "networkCollection")).thenReturn("<policyFqdns>GN_EVPN_Test</policyFqdns>") + when(mockExecution.getVariable(Prefix + "tableRefCollection")).thenReturn("") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareUpdateNetworkRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateNetworkRequest", updateNetworkRequest_noPhysicalName) + } + + @Test + public void prepareSDNCRequest() { + + println "************ prepareSDNCRequest ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4") + when(mockExecution.getVariable(Prefix + "queryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) + when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") + when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn( + "https://aai-int1.test.com:8443/aai/v8/business/customers/customer/MSO_1610_dev/service-subscriptions/service-subscription/MSO-dev-service-type/service-instances/service-instance/6d4eb22a-82f1-4257-9f80-4176262cfe69/") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareSDNCRequest(mockExecution) + + // verify set prefix = Prefix + "" + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "changeAssignSDNCRequest", changeAssignSDNCRequest) + } @Test //@Ignore @@ -2101,614 +1182,412 @@ String rollbackNetworkRequest = } - @Test - //@Ignore - public void callRESTQueryAAINetworkId_200() { + @Test + public void callRESTQueryAAINetworkId_200() { + + println "************ callRESTQueryAAINetworkId ************* " + + WireMock.reset(); + MockGetNetworkByIdWithDepth(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", + "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "1"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") + verify(mockExecution).setVariable(eq(Prefix + "queryIdAAIResponse"), isA(AAIResultWrapper.class)) + } + + @Test + public void callRESTQueryAAICloudRegion30_200() { + + println "************ callRESTQueryAAICloudRegion30_200 ************* " + + WireMock.reset(); + MockGetNetworkCloudRegion(wireMockRule, "CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); + + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")). + thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + } + + @Test + public void callRESTQueryAAICloudRegion25_200() { - println "************ callRESTQueryAAINetworkId ************* " + println "************ callRESTQueryAAICloudRegion25_200 ************* " - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); + WireMock.reset(); + MockGetNetworkCloudRegion(wireMockRule, "CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkId(mockExecution) + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")). + thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "queryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiIdReturnCode", "200") + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + } - } + @Test + public void callRESTQueryAAICloudRegion_NotFound() { - @Test - //@Ignore - public void callRESTQueryAAICloudRegion30_200() { + println "************ callRESTQueryAAICloudRegionFake ************* " - println "************ callRESTQueryAAICloudRegion30_200 ************* " + WireMock.reset(); + MockGetNetworkCloudRegion_404(wireMockRule, "MDTWNJ21"); - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP"); + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) + when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") + when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") + when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")). + thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') + when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") + when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") + verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") + verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") + verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + } - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) + @Test + public void callRESTQueryAAINetworkVpnBinding_200() { - } + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - @Test - public void callRESTQueryAAICloudRegion25_200() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json"))) - println "************ callRESTQueryAAICloudRegion25_200 ************* " + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", + """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + xmlns="defaultTestNamespacev14"\n contentType="text/xml">\n <vpn-binding> + <global-route-target/>\n </vpn-binding>\n</rest:payload>""") + verify(mockExecution).setVariable(Prefix + "routeCollection", "<routeTargets/>") + } + + @Test + public void callRESTQueryAAINetworkVpnBindingList_200() { + + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - WireMock.reset(); - MockGetNetworkCloudRegion("CreateNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP"); + WireMock.reset(); - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } - - @Test - //@Ignore - public void callRESTQueryAAICloudRegion_NotFound() { - - println "************ callRESTQueryAAICloudRegionFake ************* " - - WireMock.reset(); - MockGetNetworkCloudRegion_404("MDTWNJ21"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestFakeRegion) - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAICloudRegion(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix + "") - verify(mockExecution, atLeast(1)).setVariable(Prefix + "queryCloudRegionReturnCode", "404") - verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21") - verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25") - verify(mockExecution).setVariable(Prefix + "isCloudRegionGood", true) - - } + MockGetNetworkVpnBindingWithDepth(wireMockRule, + "BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json", + "13e94b71-3ce1-4988-ab0e-61208fc91f1c", "2") - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200() { + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "routeCollection", """<routeTargets> + <routeTarget>2001:051111</routeTarget>\n <routeTargetRole>EXPORT</routeTargetRole>\n</routeTargets> +<routeTargets>\n <routeTarget>1000:051113</routeTarget>\n <routeTargetRole>IMPORT</routeTargetRole>\n</routeTargets>\n""") + } - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + @Test + public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + WireMock.reset(); + MockGetNetworkVpnBindingWithDepth(wireMockRule, + "BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json", + "13e94b71-3ce1-4988-ab0e-61208fc91f1c", "2"); - } + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBindingList_200() { + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "routeCollection", + """<routeTargets>\n <routeTarget>2001:051111</routeTarget>\n <routeTargetRole>EXPORT</routeTargetRole> +</routeTargets>\n<routeTargets>\n <routeTarget>1000:051113</routeTarget>\n <routeTargetRole>IMPORT</routeTargetRole> +</routeTargets>\n""") + } - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBindingList_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + @Test + public void callRESTQueryAAINetworkVpnBinding_NotPresent() { - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) // v6 - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + WireMock.reset(); - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + MockGetNetworkVpnBindingWithDepth(wireMockRule, + "BuildingBlocks/Network/queryAAIVpnBindingTestResponse.json", + "13e94b71-3ce1-4988-ab0e-61208fc91f1c", "2") - } + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_TestScenario01_200() { + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "routeCollection", "") + } - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseTestScenario01) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + @Test + public void callRESTQueryAAINetworkTableRef_200() { - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + println "************ callRESTQueryAAINetworkTableRef_200 ************* " + WireMock.reset(); - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 1) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - } + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_200_URN_Uri() { + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 0) + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIResponse", + """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + xmlns="defaultTestNamespacev14"\n contentType="text/xml">\n <route-table-references> + <route-table-reference-fqdn/>\n </route-table-references>\n</rest:payload>""") + verify(mockExecution).setVariable(Prefix + "tableRefCollection", "<routeTableFqdns/>") + } - println "************ callRESTQueryAAINetworkVpnBinding_200 ************* " + @Test + public void callRESTQueryAAINetworkPolicy_200() { - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "c980a6ef-3b88-49f0-9751-dbad8608d0a6"); + println "************ callRESTQueryAAINetworkPolicy_200 ************* " - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.vpn-binding.uri")).thenReturn("/aai/v8/network/vpn-bindings/vpn-binding") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + WireMock.reset(); - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAINetworkTestResponse.json"))) - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "vpnCount", 2) - verify(mockExecution).setVariable(Prefix + "vpnBindings", ['/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017/', '/aai/v8/network/vpn-bindings/vpn-binding/c980a6ef-3b88-49f0-9751-dbad8608d0a6/']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIRequest", "http://localhost:8090/aai/v8/network/vpn-bindings/vpn-binding/85f015d0-2e32-4c30-96d2-87a1a27f8017?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 0) + verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIResponse", + """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd" + xmlns="defaultTestNamespacev14"\n contentType="text/xml">\n <network-policy> + <network-policy-fqdn/>\n </network-policy>\n</rest:payload>""") + verify(mockExecution).setVariable(Prefix + "networkCollection", "<policyFqdns/>") + } - } - @Test - //@Ignore - public void callRESTQueryAAINetworkVpnBinding_NotPresent() { + @Test + public void callRESTReQueryAAINetworkId_200() { - println "************ callRESTQueryAAINetworkVpnBinding_NotPresent ************* " + println "************ callRESTReQueryAAINetworkId ************* " - WireMock.reset(); - MockGetNetworkVpnBinding("UpdateNetworkV2/updateNetwork_queryVpnBinding_AAIResponse_Success.xml", "85f015d0-2e32-4c30-96d2-87a1a27f8017"); + WireMock.reset(); + MockGetNetworkByIdWithDepth(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", + "BuildingBlocks/Network/queryAAINetworkTestResponse.json", "1"); - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponseVpnNotPresent) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkVpnBinding(mockExecution) + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") + verify(mockExecution).setVariable(eq(Prefix + "requeryIdAAIResponse"), isA(AAIResultWrapper.class)) + verify(mockExecution).setVariable(Prefix + "networkOutputs", """<network-outputs> + <network-id>467e3349-bec1-4922-bcb1-d0bb041bce30</network-id> + <network-name>vprobes_pktinternal_net_4_1806</network-name> + </network-outputs>""") + } - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "aaiQqueryVpnBindingReturnCode", "200") - verify(mockExecution).setVariable(Prefix + "vpnCount", 0) - verify(mockExecution).setVariable(Prefix + "queryVpnBindingAAIResponse", aaiVpnResponseStub) + @Test + public void callRESTUpdateContrailAAINetworkREST_200() { - } + println "************ callRESTUpdateContrailAAINetwork ************* " - @Test - //@Ignore - public void callRESTQueryAAINetworkTableRef_200() { + WireMock.reset(); + MockPostNetwork(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4") + MockPostNetworkSubnet(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "209f62cf-cf0c-42f8-b13c-f038b92ef108") + MockPostNetworkSubnet(wireMockRule, "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "971bc608-1aff-47c0-923d-92e43b699f01") - println "************ callRESTQueryAAINetworkTableRef_200 ************* " + ExecutionEntity mockExecution = setupMock() + when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) + when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn( + new AAIResultWrapper(FileUtil.readResourceFile("__files/BuildingBlocks/Network/queryAAIResponseEmptyUri.json"))) + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "isPONR", true) + } - WireMock.reset(); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef1_AAIResponse_Success.xml", "refFQDN1"); - MockGetNetworkTableReference("UpdateNetworkV2/updateNetwork_queryNetworkTableRef2_AAIResponse_Success.xml", "refFQDN2"); - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.default.aai.network-table-reference.uri")).thenReturn("") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.route-table-reference.uri")).thenReturn("/aai/v8/network/route-table-references/route-table-reference") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + @Test + public void validateUpdateNetworkResponseREST() { - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkTableRef(mockExecution) + println "************ validateNetworkResponse ************* " + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", updateNetworkResponseREST) + verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) + verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", updateRollbackNetworkRequest) + } - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + @Test + public void validateUpdateNetworkResponseREST_Error() { - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "networkTableRefCount", 2) - verify(mockExecution).setVariable(Prefix + "networkTableRefUriList", ['/aai/v8/network/route-table-references/route-table-reference/refFQDN1','/aai/v8/network/route-table-references/route-table-reference/refFQDN2']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkTableRefAAIRequest", "http://localhost:8090/aai/v8/network/route-table-references/route-table-reference/refFQDN1?depth=all") - verify(mockExecution, atLeast(2)).setVariable(Prefix + "aaiQqueryNetworkTableRefReturnCode", "200") + println "************ validateNetworkResponse ************* " - } + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - @Test - //@Ignore - public void callRESTQueryAAINetworkPolicy_200() { + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(networkException500) + when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') - println "************ callRESTQueryAAINetworkPolicy_200 ************* " + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) + } catch (Exception ex) { + println " Test End - Handle catch-throw BpmnError()! " + } - WireMock.reset(); - MockGetNetworkPolicy("UpdateNetworkV2/updateNetwork_queryNetworkPolicy_AAIResponse_Success.xml", "cee6d136-e378-4678-a024-2cd15f0ee0cg"); + verify(mockExecution).setVariable("prefix", Prefix + "") + verify(mockExecution, atLeast(1)).setVariable(eq("WorkflowException"), refEq(workflowException)) - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8") - when(mockExecution.getVariable("mso.workflow.default.aai.v8.network-policy.uri")).thenReturn("/aai/v8/network/network-policies/network-policy") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") + } - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTQueryAAINetworkPolicy(mockExecution) + @Test + public void validateSDNCResponse() { - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) + println "************ validateSDNCResponse ************* " - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "networkPolicyCount", 1) - verify(mockExecution).setVariable(Prefix + "networkPolicyUriList", ['/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg']) - // the last vpnBinding value is saved. - verify(mockExecution).setVariable(Prefix + "queryNetworkPolicyAAIRequest", "http://localhost:8090/aai/v8/network/network-policies/network-policy/cee6d136-e378-4678-a024-2cd15f0ee0cg?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiQqueryNetworkPolicyReturnCode", "200") + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "sdncResponseSuccess")).thenReturn(true) - } + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + verify(mockExecution).setVariable(Prefix + "sdncRequestDataResponseCode", "200") + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", true) + verify(mockExecution).setVariable(Prefix + "changeAssignSDNCResponse", sdncAdapterWorkflowResponse) + verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) + } + + @Test(expected = BpmnError.class) + public void validateSDNCResponse_Error() { - - @Test - //@Ignore - public void callRESTReQueryAAINetworkId_200() { - - println "************ callRESTReQueryAAINetworkId ************* " - - WireMock.reset(); - MockGetNetworkByIdWithDepth("49c86598-f766-46f8-84f8-8d1c1b10f9b4", "UpdateNetworkV2/updateNetwork_queryNetworkId_AAIResponse_Success.xml", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTReQueryAAINetworkId(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "requeryIdAAIRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "aaiRequeryIdReturnCode", "200") - - } - - - @Test - //@Ignore - public void callRESTUpdateContrailAAINetworkREST_200() { - - println "************ callRESTUpdateContrailAAINetwork ************* " - - WireMock.reset(); - MockPutNetworkIdWithDepth("UpdateNetworkV2/updateNetwork_updateContrail_AAIResponse_Success.xml", "49c86598-f766-46f8-84f8-8d1c1b10f9b4", "all"); - - ExecutionEntity mockExecution = setupMock() - when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest) - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse) - when(mockExecution.getVariable(Prefix + "requeryIdAAIResponse")).thenReturn(queryIdAIIResponse) - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6") - when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090") - when(mockExecution.getVariable("mso.workflow.DoUpdateNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network") - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/') - when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7") - when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC") - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.callRESTUpdateContrailAAINetwork(mockExecution) - - // check the sequence of variable invocation - //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl() - //preDebugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIUrlRequest", "http://localhost:8090/aai/v9/network/l3-networks/l3-network/49c86598-f766-46f8-84f8-8d1c1b10f9b4"+"?depth=all") - verify(mockExecution).setVariable(Prefix + "updateContrailAAIPayloadRequest", updateContrailAAIPayloadRequest) - verify(mockExecution).setVariable(Prefix + "aaiUpdateContrailReturnCode", "200") - //verify(mockExecution).setVariable(Prefix + "updateContrailAAIResponse", updateContrailAAIResponse) - verify(mockExecution).setVariable(Prefix + "isPONR", true) - - } - - - - @Test - //@Ignore - public void validateUpdateNetworkResponseREST() { - - println "************ validateNetworkResponse ************* " - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(updateNetworkResponseREST) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200') - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) - - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution).setVariable(Prefix + "updateNetworkResponse", updateNetworkResponseREST) - verify(mockExecution).setVariable(Prefix + "isNetworkRollbackNeeded", true) - verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", updateRollbackNetworkRequest) - - } - - @Test - //@Ignore - public void validateUpdateNetworkResponseREST_Error() { - - println "************ validateNetworkResponse ************* " - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "updateNetworkResponse")).thenReturn(networkException500) - when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('500') - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateUpdateNetworkResponse(mockExecution) - } catch (Exception ex) { - println " Test End - Handle catch-throw BpmnError()! " - } - - verify(mockExecution).setVariable("prefix", Prefix + "") - verify(mockExecution, atLeast(1)).setVariable("WorkflowException", refEq(workflowException, any(WorkflowException.class))) - - } - - @Test - //@Ignore - public void validateSDNCResponse() { - - println "************ validateSDNCResponse ************* " - - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) - verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - verify(mockExecution).setVariable(Prefix + "rollbackSDNCRequest", "") - - } catch (Exception ex) { - println " Graceful Exit - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true) - - } - - @Test - //@Ignore - public void validateSDNCResponse_Error() { - - println "************ validateSDNCResponse ************* " - //ExecutionEntity mockExecution = mock(ExecutionEntity.class) - ExecutionEntity mockExecution = setupMock() - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) - when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") - when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) - when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") - when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) - - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - try { - DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) - } catch (Exception ex) { - println " Graceful Exit! - " + ex.getMessage() - } - //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl() - //debugger.printInvocations(mockExecution) - - // verify set prefix = Prefix + "" - //verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) - - } - - @Test - //@Ignore - public void prepareRollbackData() { - - println "************ prepareRollbackData() ************* " - - - - WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") - - ExecutionEntity mockExecution = mock(ExecutionEntity.class) - // Initialize prerequisite variables - when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") - when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) - when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) - when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) - - // preProcessRequest(DelegateExecution execution) - DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() - DoUpdateNetworkInstance.prepareRollbackData(mockExecution) - -// verify(mockExecution).getVariable("isDebugLogEnabled") - verify(mockExecution).setVariable("prefix", Prefix) - - } + println "************ validateSDNCResponse ************* " + ExecutionEntity mockExecution = setupMock() + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "changeAssignSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse_Error) + when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "") + when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false) + when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200") + when(mockExecution.getVariable(Prefix + "isResponseGood")).thenReturn(true) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + try { + DoUpdateNetworkInstance.validateSDNCResponse(mockExecution) + } catch (BpmnError ex) { + verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false) + println " Graceful Exit! - " + ex.getMessage() + throw ex + } + } + + @Test + public void prepareRollbackData() { + + println "************ prepareRollbackData() ************* " + + WorkflowException workflowException = new WorkflowException("DoUpdateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.") + + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable(Prefix + "rollbackSDNCRequest")).thenReturn(rollbackSDNCRequest) + when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(rollbackNetworkRequest) + when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException) + + DoUpdateNetworkInstance DoUpdateNetworkInstance = new DoUpdateNetworkInstance() + DoUpdateNetworkInstance.prepareRollbackData(mockExecution) + + verify(mockExecution).setVariable("prefix", Prefix) + } @Test //@Ignore @@ -2735,6 +1614,37 @@ String rollbackNetworkRequest = } + private static L3Network getContrailL3Network() { + + HostRoutes routes1 = new HostRoutes() + routes1.getHostRoute().add(new HostRoute(routePrefix: "172.20.1.0/24", nextHop: "10.102.200.1")) + routes1.getHostRoute().add(new HostRoute(routePrefix: "10.102.0.0/16", nextHop: "10.102.200.1")) + routes1.getHostRoute().add(new HostRoute(routePrefix: "192.168.2.0/25", nextHop: "10.102.200.1")) + + Subnet subnet1 = new Subnet(networkStartAddress: "107.239.52.0", cidrMask: "24", dhcpEnabled: true, + gatewayAddress: "107.239.52.1", ipVersion: "4", subnetId: "57e9a1ff-d14f-4071-a828-b19ae98eb2fc", + subnetName: "subnetName", ipAssignmentDirection: "true", hostRoutes: routes1) + Subnets subnets = new Subnets() + subnets.getSubnet().add(subnet1) + + SegmentationAssignments segments = new SegmentationAssignments() + segments.getSegmentationAssignment().add(new SegmentationAssignment(segmentationId: "414")) + segments.getSegmentationAssignment().add(new SegmentationAssignment(segmentationId: "415")) + + return new L3Network( + networkName: "MNS-25180-L-01-dmz_direct_net_1", + networkType: "CONTRAIL_EXTERNAL", + networkTechnology: "Contrail", + networkId: "49c86598-f766-46f8-84f8-8d1c1b10f9b4", + orchestrationStatus: "pending-create", + physicalNetworkName: "networkName", + heatStackId: "ST_2Bindings_6006/55288ef0-595c-47d3-819e-cf93aaac6326", + isSharedNetwork: true, + subnets: subnets, + segmentationAssignments: segments + ) + } + private ExecutionEntity setupMock() { ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) @@ -2742,16 +1652,13 @@ String rollbackNetworkRequest = RepositoryService mockRepositoryService = mock(RepositoryService.class) when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition) when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoUpdateNetworkInstance") - when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100") ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class) when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService) ExecutionEntity mockExecution = mock(ExecutionEntity.class) // Initialize prerequisite variables - when(mockExecution.getId()).thenReturn("100") when(mockExecution.getProcessDefinitionId()).thenReturn("DoUpdateNetworkInstance") - when(mockExecution.getProcessInstanceId()).thenReturn("DoUpdateNetworkInstance") when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices) when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy index d635b2311a..f16bc575a4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVfModuleTest.groovy @@ -57,9 +57,6 @@ class DoUpdateVfModuleTest extends MsoGroovyTest{ @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090) - @Spy DoUpdateVfModule doUpdateVfModule @@ -182,6 +179,7 @@ class DoUpdateVfModuleTest extends MsoGroovyTest{ ExecutionEntity mockExecution = setupMock() when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "cloudRegion")).thenReturn("CloudOwner") when(mockExecution.getVariable(prefix + "vfModuleId")).thenReturn("cb510af0-5b21-4bc7-86d9-323cb396ce32") when(mockExecution.getVariable(prefix + "volumeGroupStackId")).thenReturn("12345") when(mockExecution.getVariable(prefix + "vfModuleName")).thenReturn("PCRF::module-0-2") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy index a86029ea30..8e81e91228 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModulesTest.groovy @@ -47,9 +47,6 @@ class DoUpdateVnfAndModulesTest { @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) - @Rule - public WireMockRule wireMockRule = new WireMockRule(28090); - @Before public void init() { MockitoAnnotations.initMocks(this) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy index 06ae576307..80e2c863e8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.groovy @@ -4,7 +4,9 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * 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 * @@ -32,7 +34,7 @@ import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.Captor import org.mockito.MockitoAnnotations -import org.mockito.runners.MockitoJUnitRunner +import org.mockito.junit.MockitoJUnitRunner import org.onap.aai.domain.yang.GenericVnf import org.onap.aai.domain.yang.VfModule import org.onap.aai.domain.yang.VolumeGroup @@ -48,23 +50,23 @@ import javax.ws.rs.core.UriBuilder import static org.mockito.Mockito.* -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.Silent.class) class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ - + def prefix = "UPDVfModVol_" @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) @Rule public ExpectedException thrown = ExpectedException.none() - - @Before - public void init(){ + + @Before + public void init() { super.init("UpdateVfModuleVolumeInfraV1") - MockitoAnnotations.initMocks(this) + MockitoAnnotations.initMocks(this) } - + @Test void testQueryAAIForVfModule() { ExecutionEntity mockExecution = setupMock() @@ -143,6 +145,7 @@ class UpdateVfModuleVolumeInfraV1Test extends MsoGroovyTest{ when(mockExecution.getVariable("prefix")).thenReturn(prefix) when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") when(mockExecution.getVariable(prefix + "aicCloudRegion")).thenReturn("RDM2WAGPLCP") + when(mockExecution.getVariable(prefix + "cloudOwner")).thenReturn("CloudOwner") when(mockExecution.getVariable(prefix + "tenantId")).thenReturn("") VolumeGroup volumeGroup = new VolumeGroup(); volumeGroup.setHeatStackId("heatStackId") diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy index 41a862e00e..5c3521f5ba 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollbackTest.groovy @@ -238,8 +238,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() DoCreateAllottedResourceBRGRollback.updateAaiAROrchStatus(mex, "success") @@ -265,8 +265,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) when(mex.getVariable("aaiARPath")).thenReturn(null) @@ -354,8 +354,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoCreateAllottedResourceBRGRollback DoCreateAllottedResourceBRGRollback = new DoCreateAllottedResourceBRGRollback() DoCreateAllottedResourceBRGRollback.deleteAaiAR(mex) @@ -366,8 +366,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -381,8 +381,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -396,8 +396,8 @@ class DoCreateAllottedResourceBRGRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy index f094ef25fa..09244bedc4 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGTest.groovy @@ -94,7 +94,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test @Ignore public void getAaiAR() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -107,7 +107,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test public void getAaiAR_Duplicate() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -122,7 +122,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test public void getAaiAR_NotActive() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -138,7 +138,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test @Ignore public void getAaiAR_NoStatus() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -205,7 +205,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("PSI_resourceLink")).thenReturn(null) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -217,7 +217,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) - MockPutAllottedResource_500(CUST, SVC, INST, ARID) + MockPutAllottedResource_500(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -231,7 +231,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -245,7 +245,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceBRG DoCreateAllottedResourceBRG = new DoCreateAllottedResourceBRG() @@ -621,7 +621,7 @@ class DoCreateAllottedResourceBRGTest extends GroovyTestBase { @Test @Ignore public void updateAaiAROrchStatus() { - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy index a877ce42e7..e25f43f796 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollbackTest.groovy @@ -238,8 +238,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() DoCreateAllottedResourceTXCRollback.updateAaiAROrchStatus(mex, "success") @@ -265,8 +265,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) when(mex.getVariable("aaiARPath")).thenReturn(null) @@ -354,8 +354,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoCreateAllottedResourceTXCRollback DoCreateAllottedResourceTXCRollback = new DoCreateAllottedResourceTXCRollback() DoCreateAllottedResourceTXCRollback.deleteAaiAR(mex) @@ -366,8 +366,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -381,8 +381,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -396,8 +396,8 @@ class DoCreateAllottedResourceTXCRollbackTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy index b53e5fce21..901bdaf7b3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCTest.groovy @@ -93,7 +93,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test @Ignore public void getAaiAR() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -107,7 +107,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test public void getAaiAR_Duplicate() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -122,7 +122,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test public void getAaiAR_NotActive() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -138,7 +138,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test @Ignore public void getAaiAR_NoStatus() { - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc.xml") ExecutionEntity mex = setupMock() initGetAaiAR(mex) @@ -177,7 +177,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("PSI_resourceLink")).thenReturn(null) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -189,7 +189,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initCreateAaiAr(mex) - MockPutAllottedResource_500(CUST, SVC, INST, ARID) + MockPutAllottedResource_500(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -203,7 +203,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new BpmnError("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -217,7 +217,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { when(mex.getVariable("aai.endpoint")).thenThrow(new RuntimeException("expected exception")) - MockPutAllottedResource(CUST, SVC, INST, ARID) + MockPutAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoCreateAllottedResourceTXC DoCreateAllottedResourceTXC = new DoCreateAllottedResourceTXC() @@ -559,7 +559,7 @@ class DoCreateAllottedResourceTXCTest extends GroovyTestBase { @Test @Ignore public void updateAaiAROrchStatus() { - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy index e77c1dd9ed..ab9be8217d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRGTest.groovy @@ -132,7 +132,7 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() DoDeleteAllottedResourceBRG.updateAaiAROrchStatus(mex, "success") @@ -412,8 +412,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoDeleteAllottedResourceBRG DoDeleteAllottedResourceBRG = new DoDeleteAllottedResourceBRG() DoDeleteAllottedResourceBRG.deleteAaiAR(mex) @@ -424,8 +424,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -439,8 +439,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -454,8 +454,8 @@ class DoDeleteAllottedResourceBRGTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy index 23115874a2..6a75c145ff 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXCTest.groovy @@ -132,7 +132,7 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initUpdateAaiAROrchStatus(mex) - MockPatchAllottedResource(CUST, SVC, INST, ARID) + MockPatchAllottedResource(wireMockRule, CUST, SVC, INST, ARID) DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() DoDeleteAllottedResourceTXC.updateAaiAROrchStatus(mex, "success") @@ -412,8 +412,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) DoDeleteAllottedResourceTXC DoDeleteAllottedResourceTXC = new DoDeleteAllottedResourceTXC() DoDeleteAllottedResourceTXC.deleteAaiAR(mex) @@ -424,8 +424,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenReturn("") @@ -439,8 +439,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new BpmnError("expected exception")) @@ -454,8 +454,8 @@ class DoDeleteAllottedResourceTXCTest extends GroovyTestBase { ExecutionEntity mex = setupMock() initDeleteAaiAR(mex) - MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") - MockDeleteAllottedResource(CUST, SVC, INST, ARID, VERS) + MockGetAllottedResource(wireMockRule, CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml") + MockDeleteAllottedResource(wireMockRule, CUST, SVC, INST, ARID, VERS) when(mex.getVariable("aaiARPath")).thenThrow(new RuntimeException("expected exception")) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java index 0f77e41120..03d9b37522 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllBPMNTestSuites.java @@ -19,14 +19,14 @@ */ package org.onap.so.bpmn; -import org.junit.runner.RunWith; +import org.junit.runner.RunWith; import com.googlecode.junittoolbox.SuiteClasses; import com.googlecode.junittoolbox.WildcardPatternSuite; @RunWith(WildcardPatternSuite.class) @SuiteClasses({"**/service/*Test.class", "**/process/*Test.class", "**/subprocess/*Test.class"}) public class AllBPMNTestSuites { - // the class remains empty, - // used only as a holder for the above annotations + // the class remains empty, + // used only as a holder for the above annotations } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java index 57d842f8b5..7f86709432 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTasksTestsTestSuite.java @@ -19,14 +19,14 @@ */ package org.onap.so.bpmn; -import org.junit.runner.RunWith; +import org.junit.runner.RunWith; import com.googlecode.junittoolbox.SuiteClasses; import com.googlecode.junittoolbox.WildcardPatternSuite; @RunWith(WildcardPatternSuite.class) -@SuiteClasses({"**/tasks/*Test.class","**/infrastructure/aai/*Test.class"}) +@SuiteClasses({"**/tasks/*Test.class", "**/infrastructure/aai/*Test.class"}) public class AllTasksTestsTestSuite { - // the class remains empty, - // used only as a holder for the above annotations + // the class remains empty, + // used only as a holder for the above annotations } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java index 01f37ad655..7123567247 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/AllTestsTestSuite.java @@ -23,15 +23,16 @@ package org.onap.so.bpmn; import org.junit.runner.RunWith; - import com.googlecode.junittoolbox.SuiteClasses; import com.googlecode.junittoolbox.WildcardPatternSuite; @RunWith(WildcardPatternSuite.class) -@SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class", - "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class", - "!**/infrastructure/scripts/*Test.class", "**/*Test.class"}) +@SuiteClasses({"!**/service/*Test.class", "!**/subprocess/*Test.class", "!**/process/*Test.class", + "!**/tasks/*Test.class", "!**/infrastructure/aai/*Test.class", "!**/infrastructure/scripts/*Test.class", + "**/infrastructure/scripts/DoDeleteVfModuleVolumeV2Test.class", + "**/infrastructure/scripts/DoUpdateNetworkInstanceTest.class", + "**/infrastructure/scripts/UpdateVfModuleVolumeInfraV1Test.class", "**/*Test.class"}) public class AllTestsTestSuite { - // the class remains empty, - // used only as a holder for the above annotations + // the class remains empty, + // used only as a holder for the above annotations } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java index f69521fd76..1c4074cae1 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/BeansTest.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure; import org.junit.Test; - import com.openpojo.validation.Validator; import com.openpojo.validation.ValidatorBuilder; import com.openpojo.validation.rule.impl.GetterMustExistRule; @@ -38,35 +37,31 @@ import com.openpojo.reflection.filters.FilterPackageInfo; public class BeansTest { - private PojoClassFilter filterTestClasses = new FilterTestClasses(); - - private PojoClassFilter enumFilter = new FilterEnum(); - + private PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private PojoClassFilter enumFilter = new FilterEnum(); + + + @Test + public void pojoStructure() { + test("org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule()) + + .with(new SetterTester()).with(new GetterTester()).with(new SetterTester()).with(new GetterTester()) - @Test - public void pojoStructure() { - test("org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity"); - } + .build(); - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - .with(new GetterMustExistRule()) - .with(new SetterMustExistRule()) - - .with(new SetterTester()) - .with(new GetterTester()) - .with(new SetterTester()) - .with(new GetterTester()) - - .build(); + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter, + new FilterNonConcrete()); + } - validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete()); - } - - private static class FilterTestClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.getSourcePath().contains("/test-classes/"); - } - } + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java index ad9e210452..c2af155d51 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java @@ -31,22 +31,19 @@ import org.springframework.util.StringUtils; @EnableWebSecurity public class WebSecurityConfigImpl extends WebSecurityConfig { - @Override - protected void configure(HttpSecurity http) throws Exception { - http.csrf().disable() - .authorizeRequests() - .antMatchers("/manage/health","/manage/info").permitAll() - .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify") - .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString()) - .and() - .httpBasic(); - } - - @Override - public void configure(WebSecurity web) throws Exception { - super.configure(web); - StrictHttpFirewall firewall = new MSOSpringFirewall(); - web.httpFirewall(firewall); - } + @Override + protected void configure(HttpSecurity http) throws Exception { + http.csrf().disable().authorizeRequests().antMatchers("/manage/health", "/manage/info").permitAll() + .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", + "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify") + .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(), ",").toString()).and().httpBasic(); + } + + @Override + public void configure(WebSecurity web) throws Exception { + super.configure(web); + StrictHttpFirewall firewall = new MSOSpringFirewall(); + web.httpFirewall(firewall); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java index 2e588b7078..289d97108f 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAICreateResourcesTest.java @@ -28,10 +28,8 @@ 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.HashMap; import java.util.Optional; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -48,150 +46,157 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory; @RunWith(MockitoJUnitRunner.class) public class AAICreateResourcesTest { - - private AAICreateResources aaiCreateResources; - - private String projectName; - private String serviceInstanceId; - private String owningEntityId; - private String owningEntityName; - private String platformName; - private String vnfId; - private String lineOfBusiness; - private String globalCustomerId; - private String serviceType; - - @Spy - private AAIResourcesClient aaiResourcesClient; - - @Before - public void before() { - - - aaiCreateResources = new AAICreateResources(); - aaiCreateResources.setAaiClient(aaiResourcesClient); - - projectName = "projectName"; - serviceInstanceId = "serviceInstanceId"; - owningEntityId = "owningEntityId"; - owningEntityName = "owningEntityName"; - platformName = "platformName"; - vnfId = "vnfId"; - lineOfBusiness = "lineOfBusiness"; - globalCustomerId = "globalCustomerId"; - serviceType = "serviceType"; - } - - @Test - public void createAAIProjectTest() { - doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); - doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - - - aaiCreateResources.createAAIProject(projectName, serviceInstanceId); - - AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); - - verify(aaiResourcesClient, times(1)).createIfNotExists(projectURI, Optional.empty()); - verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - } - - @Test - public void createAAIOwningEntityTest() { - doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); - doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - - aaiCreateResources.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstanceId); - - HashMap<String, String> owningEntityMap = new HashMap<>(); - owningEntityMap.put("owning-entity-name", owningEntityName); - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - - verify(aaiResourcesClient, times(1)).createIfNotExists(owningEntityURI, Optional.of(owningEntityMap)); - verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - } - - @Test - public void existsOwningEntityTest() { - doReturn(true).when(aaiResourcesClient).exists(isA(AAIResourceUri.class)); - - boolean expectedBoolean = aaiCreateResources.existsOwningEntity(owningEntityId); - - AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); - - verify(aaiResourcesClient, times(1)).exists(owningEntityURI); - assertTrue(expectedBoolean); - } - - @Test - public void connectOwningEntityandServiceInstanceTest() { - doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - - aaiCreateResources.connectOwningEntityandServiceInstance(owningEntityId, serviceInstanceId); - - verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - } - - @Test - public void createAAIPlatformTest() { - doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); - doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - - aaiCreateResources.createAAIPlatform(platformName, vnfId); - - AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); - - verify(aaiResourcesClient, times(1)).createIfNotExists(platformURI, Optional.empty()); - verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - } - - @Test - public void createAAILineOfBusinessTest() { - doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); - doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - - aaiCreateResources.createAAILineOfBusiness(lineOfBusiness, vnfId); - - AAIResourceUri lineOfBusinessURI = AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); - - verify(aaiResourcesClient, times(1)).createIfNotExists(lineOfBusinessURI, Optional.empty()); - verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); - } - - @Test - public void createAAIServiceInstanceTest() { - doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), isA(Optional.class)); - - aaiCreateResources.createAAIServiceInstance(globalCustomerId, serviceType, serviceInstanceId); - - AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalCustomerId,serviceType,serviceInstanceId); - - verify(aaiResourcesClient, times(1)).createIfNotExists(serviceInstanceURI, Optional.empty()); - } - - @Test - public void getVnfInstanceTest() { - AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("vnfUriAaiResponse"); - - doReturn(aaiResultWrapper).when(aaiResourcesClient).get(isA(AAIResourceUri.class)); - - Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId); - - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); - - verify(aaiResourcesClient, times(1)).get(vnfURI); - assertEquals(actualVnf, aaiResultWrapper.asBean(GenericVnf.class)); - } - - @Test - public void getVnfInstanceExceptionTest() { - doThrow(RuntimeException.class).when(aaiResourcesClient).get(isA(AAIResourceUri.class)); - - Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId); - - AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); - - verify(aaiResourcesClient, times(1)).get(vnfURI); - assertEquals(actualVnf, Optional.empty()); - } + + private AAICreateResources aaiCreateResources; + + private String projectName; + private String serviceInstanceId; + private String owningEntityId; + private String owningEntityName; + private String platformName; + private String vnfId; + private String lineOfBusiness; + private String globalCustomerId; + private String serviceType; + + @Spy + private AAIResourcesClient aaiResourcesClient; + + @Before + public void before() { + + + aaiCreateResources = new AAICreateResources(); + aaiCreateResources.setAaiClient(aaiResourcesClient); + + projectName = "projectName"; + serviceInstanceId = "serviceInstanceId"; + owningEntityId = "owningEntityId"; + owningEntityName = "owningEntityName"; + platformName = "platformName"; + vnfId = "vnfId"; + lineOfBusiness = "lineOfBusiness"; + globalCustomerId = "globalCustomerId"; + serviceType = "serviceType"; + } + + @Test + public void createAAIProjectTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), + isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + + aaiCreateResources.createAAIProject(projectName, serviceInstanceId); + + AAIResourceUri projectURI = AAIUriFactory.createResourceUri(AAIObjectType.PROJECT, projectName); + + verify(aaiResourcesClient, times(1)).createIfNotExists(projectURI, Optional.empty()); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAIOwningEntityTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), + isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.createAAIOwningEntity(owningEntityId, owningEntityName, serviceInstanceId); + + HashMap<String, String> owningEntityMap = new HashMap<>(); + owningEntityMap.put("owning-entity-name", owningEntityName); + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + + verify(aaiResourcesClient, times(1)).createIfNotExists(owningEntityURI, Optional.of(owningEntityMap)); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void existsOwningEntityTest() { + doReturn(true).when(aaiResourcesClient).exists(isA(AAIResourceUri.class)); + + boolean expectedBoolean = aaiCreateResources.existsOwningEntity(owningEntityId); + + AAIResourceUri owningEntityURI = AAIUriFactory.createResourceUri(AAIObjectType.OWNING_ENTITY, owningEntityId); + + verify(aaiResourcesClient, times(1)).exists(owningEntityURI); + assertTrue(expectedBoolean); + } + + @Test + public void connectOwningEntityandServiceInstanceTest() { + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.connectOwningEntityandServiceInstance(owningEntityId, serviceInstanceId); + + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAIPlatformTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), + isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.createAAIPlatform(platformName, vnfId); + + AAIResourceUri platformURI = AAIUriFactory.createResourceUri(AAIObjectType.PLATFORM, platformName); + + verify(aaiResourcesClient, times(1)).createIfNotExists(platformURI, Optional.empty()); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAILineOfBusinessTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), + isA(Optional.class)); + doNothing().when(aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + + aaiCreateResources.createAAILineOfBusiness(lineOfBusiness, vnfId); + + AAIResourceUri lineOfBusinessURI = + AAIUriFactory.createResourceUri(AAIObjectType.LINE_OF_BUSINESS, lineOfBusiness); + + verify(aaiResourcesClient, times(1)).createIfNotExists(lineOfBusinessURI, Optional.empty()); + verify(aaiResourcesClient, times(1)).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class)); + } + + @Test + public void createAAIServiceInstanceTest() { + doReturn(aaiResourcesClient).when(aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class), + isA(Optional.class)); + + aaiCreateResources.createAAIServiceInstance(globalCustomerId, serviceType, serviceInstanceId); + + AAIResourceUri serviceInstanceURI = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalCustomerId, serviceType, serviceInstanceId); + + verify(aaiResourcesClient, times(1)).createIfNotExists(serviceInstanceURI, Optional.empty()); + } + + @Test + public void getVnfInstanceTest() { + AAIResultWrapper aaiResultWrapper = new AAIResultWrapper("vnfUriAaiResponse"); + + doReturn(aaiResultWrapper).when(aaiResourcesClient).get(isA(AAIResourceUri.class)); + + Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId); + + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + + verify(aaiResourcesClient, times(1)).get(vnfURI); + assertEquals(actualVnf, aaiResultWrapper.asBean(GenericVnf.class)); + } + + @Test + public void getVnfInstanceExceptionTest() { + doThrow(RuntimeException.class).when(aaiResourcesClient).get(isA(AAIResourceUri.class)); + + Optional<GenericVnf> actualVnf = aaiCreateResources.getVnfInstance(vnfId); + + AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId); + + verify(aaiResourcesClient, times(1)).get(vnfURI); + assertEquals(actualVnf, Optional.empty()); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java index a540a6d2cc..1aca331a17 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIDeleteServiceInstanceTest.java @@ -26,7 +26,6 @@ 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.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Before; @@ -38,47 +37,47 @@ import org.mockito.MockitoAnnotations; import org.onap.so.client.aai.AAIResourcesClient; import org.onap.so.client.aai.entities.uri.AAIResourceUri; -public class AAIDeleteServiceInstanceTest { - private AAIDeleteServiceInstance aaiDeleteServiceInstance; - @Mock - private DelegateExecution execution; - - @Mock - private AAIResourcesClient aaiResourcesClient; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - - @Before - public void before() { - MockitoAnnotations.initMocks(this); - - aaiDeleteServiceInstance = new AAIDeleteServiceInstance(); - aaiDeleteServiceInstance.setAaiClient(aaiResourcesClient); - } - - @Test - public void executeTest() throws Exception { - doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId"); - doNothing().when(aaiResourcesClient).delete(isA(AAIResourceUri.class)); - doNothing().when(execution).setVariable(isA(String.class), isA(Boolean.class)); - - aaiDeleteServiceInstance.execute(execution); - - verify(execution, times(1)).getVariable("serviceInstanceId"); - verify(aaiResourcesClient, times(1)).delete(isA(AAIResourceUri.class)); - verify(execution, times(1)).setVariable("GENDS_SuccessIndicator", true); - } - - @Test - public void executeExceptionTest() throws Exception { - expectedException.expect(BpmnError.class); - - doReturn("testProcessKey").when(execution).getVariable("testProcessKey"); - doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId"); - doThrow(RuntimeException.class).when(aaiResourcesClient).delete(isA(AAIResourceUri.class)); - - aaiDeleteServiceInstance.execute(execution); - } +public class AAIDeleteServiceInstanceTest { + private AAIDeleteServiceInstance aaiDeleteServiceInstance; + @Mock + private DelegateExecution execution; + + @Mock + private AAIResourcesClient aaiResourcesClient; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + + @Before + public void before() { + MockitoAnnotations.initMocks(this); + + aaiDeleteServiceInstance = new AAIDeleteServiceInstance(); + aaiDeleteServiceInstance.setAaiClient(aaiResourcesClient); + } + + @Test + public void executeTest() throws Exception { + doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId"); + doNothing().when(aaiResourcesClient).delete(isA(AAIResourceUri.class)); + doNothing().when(execution).setVariable(isA(String.class), isA(Boolean.class)); + + aaiDeleteServiceInstance.execute(execution); + + verify(execution, times(1)).getVariable("serviceInstanceId"); + verify(aaiResourcesClient, times(1)).delete(isA(AAIResourceUri.class)); + verify(execution, times(1)).setVariable("GENDS_SuccessIndicator", true); + } + + @Test + public void executeExceptionTest() throws Exception { + expectedException.expect(BpmnError.class); + + doReturn("testProcessKey").when(execution).getVariable("testProcessKey"); + doReturn("serviceInstanceId").when(execution).getVariable("serviceInstanceId"); + doThrow(RuntimeException.class).when(aaiResourcesClient).delete(isA(AAIResourceUri.class)); + + aaiDeleteServiceInstance.execute(execution); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java index e17d3f8fb5..90576c9566 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/aai/AAIServiceInstanceTest.java @@ -26,7 +26,11 @@ import org.junit.Test; public class AAIServiceInstanceTest { - AAIServiceInstance test = new AAIServiceInstance("serviceInstanceName","serviceType","serviceRole","orchestrationStatus","modelInvariantUuid","modelVersionId","environmentContext","workloadContext"); + AAIServiceInstance test = new AAIServiceInstance.AAIServiceInstanceBuilder() + .setServiceInstanceName("serviceInstanceName").setServiceType("serviceType").setServiceRole("serviceRole") + .setOrchestrationStatus("orchestrationStatus").setModelInvariantUuid("modelInvariantUuid") + .setModelVersionId("modelVersionId").setEnvironmentContext("environmentContext") + .setWorkloadContext("workloadContext").createAAIServiceInstance(); @Test public void getServiceInstanceNameTest() throws Exception { @@ -48,7 +52,6 @@ public class AAIServiceInstanceTest { test.setServiceType("serviceType"); } - @Test public void getServiceRoleTest() throws Exception { test.getServiceRole(); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java index ebcce191e9..9030fa8328 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/common/name/generation/AAIObjectInstanceNameGeneratorTest.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.common.name.generation; import static org.junit.Assert.assertEquals; - import org.junit.Before; import org.junit.Test; import org.mockito.MockitoAnnotations; @@ -34,25 +33,25 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup; public class AAIObjectInstanceNameGeneratorTest { - @Before - public void before() { - } - - @Test - public void generateInstanceGroupNameTest() throws Exception { - - ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup(); - modelVnfc.setFunction("vre"); - modelVnfc.setType("VNFC"); - - InstanceGroup instanceGroup = new InstanceGroup(); - instanceGroup.setId("test-001"); - instanceGroup.setModelInfoInstanceGroup(modelVnfc); - GenericVnf vnf = new GenericVnf(); - vnf.setVnfId("vnf-123"); - vnf.setVnfName("test-vnf"); - - assertEquals("test-vnf_vre", new AAIObjectInstanceNameGenerator().generateInstanceGroupName(instanceGroup, vnf)); - } - + @Before + public void before() {} + + @Test + public void generateInstanceGroupNameTest() throws Exception { + + ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup(); + modelVnfc.setFunction("vre"); + modelVnfc.setType("VNFC"); + + InstanceGroup instanceGroup = new InstanceGroup(); + instanceGroup.setId("test-001"); + instanceGroup.setModelInfoInstanceGroup(modelVnfc); + GenericVnf vnf = new GenericVnf(); + vnf.setVnfId("vnf-123"); + vnf.setVnfName("test-vnf"); + + assertEquals("test-vnf_vre", + new AAIObjectInstanceNameGenerator().generateInstanceGroupName(instanceGroup, vnf)); + } + } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java index b0ff82e3aa..c67b44e44a 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Test; - import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; @@ -37,7 +36,8 @@ public class CancelDmaapSubscriptionTest { DmaapClientTestImpl dmaapClientTest = new DmaapClientTestImpl(); delegate.setDmaapClient(dmaapClientTest); DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId"); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))) + .thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); dmaapClientTest.registerForUpdate("testPnfCorrelationId", () -> { }); @@ -46,4 +46,4 @@ public class CancelDmaapSubscriptionTest { // then assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse(); } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java index 6a0aaf776e..4206d796f6 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForPnfCorrelationIdDelegateTest.java @@ -29,7 +29,6 @@ import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITH_ENTRY; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; - import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Before; @@ -46,9 +45,9 @@ public class CheckAaiForPnfCorrelationIdDelegateTest { public static class ConnectionOkTests { private CheckAaiForPnfCorrelationIdDelegate delegate; - + @Rule - public ExpectedException expectedException = ExpectedException.none(); + public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { @@ -94,9 +93,9 @@ public class CheckAaiForPnfCorrelationIdDelegateTest { public static class NoConnectionTests { private CheckAaiForPnfCorrelationIdDelegate delegate; - + @Rule - public ExpectedException expectedException = ExpectedException.none(); + public ExpectedException expectedException = ExpectedException.none(); @Before public void setUp() { @@ -116,4 +115,4 @@ public class CheckAaiForPnfCorrelationIdDelegateTest { verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class)); } } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java new file mode 100644 index 0000000000..5000ca017c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/ConfigCheckerDelegateTest.java @@ -0,0 +1,139 @@ +/* + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ 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. + * + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.fail; +import static org.mockito.BDDMockito.given; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MODEL_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_NAME; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_VERSION; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_MODEL_INFO; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SKIP_POST_INSTANTIATION_CONFIGURATION; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import org.camunda.bpm.engine.ProcessEngineConfiguration; +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.Test; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.db.catalog.beans.PnfResourceCustomization; +import org.onap.so.db.catalog.client.CatalogDbClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {CatalogDbClient.class, ExceptionBuilder.class, ConfigCheckerDelegate.class, + ProcessEngineConfiguration.class}) +public class ConfigCheckerDelegateTest { + + private static String TEST_PROCESS_KEY = "processKey1"; + private static String TEST_PNF_RESOURCE_INSTANCE_NAME = "PNF_demo_resource"; + private static String TEST_PNF_RESOURCE_BLUEPRINT_NAME = "blueprintOnap"; + private static String TEST_PNF_RESOURCE_BLUEPRINT_VERSION = "1.0.1"; + private static String TEST_PNF_RESOURCE_CUSTOMIZATION_UUID = "9acb3a83-8a52-412c-9a45-901764938144"; + + /** + * Service model info json. + */ + private static String TEST_SERVICE_MODEL_INFO = "{\n" + " \"modelType\":\"service\",\n" + + " \"modelInvariantUuid\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n" + + " \"modelInvariantId\":\"539b7a2f-9524-4dbf-9eee-f2e05521df3f\",\n" + + " \"modelUuid\":\"f2daaac6-5017-4e1e-96c8-6a27dfbe1421\",\n" + + " \"modelName\":\"PNF_demo_resource\",\n" + " \"modelVersion\":\"1.0\"\n" + " }"; + + /** + * Testing model UUID, should be the same as specified in the TEST_SERVICE_MODEL_INFO. + */ + private static String TEST_MODEL_UUID = "f2daaac6-5017-4e1e-96c8-6a27dfbe1421"; + + @MockBean + private CatalogDbClient catalogDbClient; + + @MockBean + private ProcessEngineConfiguration processEngineConfiguration; + + @Autowired + private ConfigCheckerDelegate configCheckerDelegate; + + private DelegateExecution execution = new DelegateExecutionFake(); + + @Before + public void setUp() { + List<PnfResourceCustomization> pnfResourceCustomizations = new ArrayList<>(); + pnfResourceCustomizations.add(buildPnfResourceCustomization()); + given(catalogDbClient.getPnfResourceCustomizationByModelUuid(TEST_MODEL_UUID)) + .willReturn(pnfResourceCustomizations); + execution.setVariable("testProcessKey", TEST_PROCESS_KEY); + execution.setVariable(SERVICE_MODEL_INFO, TEST_SERVICE_MODEL_INFO); + } + + private PnfResourceCustomization buildPnfResourceCustomization() { + PnfResourceCustomization pnfResourceCustomization = new PnfResourceCustomization(); + pnfResourceCustomization.setSkipPostInstConf(true); + pnfResourceCustomization.setBlueprintName(TEST_PNF_RESOURCE_BLUEPRINT_NAME); + pnfResourceCustomization.setBlueprintVersion(TEST_PNF_RESOURCE_BLUEPRINT_VERSION); + pnfResourceCustomization.setModelInstanceName(TEST_PNF_RESOURCE_INSTANCE_NAME); + pnfResourceCustomization.setModelCustomizationUUID(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID); + return pnfResourceCustomization; + } + + @Test + public void testExecution_validCatalogdb_skipVariableSet() { + try { + configCheckerDelegate.execute(execution); + assertThat(execution.getVariable(MODEL_UUID)).isEqualTo(TEST_MODEL_UUID); + assertThat(execution.getVariable(SKIP_POST_INSTANTIATION_CONFIGURATION)).isEqualTo(Boolean.TRUE); + assertThat(execution.getVariable(PRC_BLUEPRINT_NAME)).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_NAME); + assertThat(execution.getVariable(PRC_BLUEPRINT_VERSION)).isEqualTo(TEST_PNF_RESOURCE_BLUEPRINT_VERSION); + assertThat(execution.getVariable(PRC_CUSTOMIZATION_UUID)).isEqualTo(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID); + assertThat(execution.getVariable(PRC_INSTANCE_NAME)).isEqualTo(TEST_PNF_RESOURCE_INSTANCE_NAME); + } catch (Exception e) { + e.printStackTrace(); + fail("Exception thrown" + e.getMessage()); + } + } + + @Test + public void testExecution_EmptyPnfResourceCustomization_exceptionThrown() { + given(catalogDbClient.getPnfResourceCustomizationByModelUuid("f2daaac6-5017-4e1e-96c8-6a27dfbe1421")) + .willReturn(Collections.EMPTY_LIST); + + assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class); + assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString() + .contains("Unable to find the PNF resource customizations of model service UUID") + .contains("f2daaac6-5017-4e1e-96c8-6a27dfbe1421"); + assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class); + } + + @Test + public void testExecution_NonExistingServiceModelInfo_exceptionThrown() { + execution.removeVariable("serviceModelInfo"); + assertThatThrownBy(() -> configCheckerDelegate.execute(execution)).isInstanceOf(BpmnError.class); + assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString() + .contains("Unable to find parameter serviceModelInfo"); + assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java index 986edfeecf..c90235b103 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreatePnfEntryInAaiDelegateTest.java @@ -27,7 +27,6 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; - import java.util.UUID; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.junit.Test; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java index c743ee7018..85a9a5c166 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateRelationTest.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.assertj.core.api.AssertionsForClassTypes.assertThatThrownBy; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; - import java.io.IOException; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java index 8a1cdfa4c0..597d111e2c 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/GeneratePnfUuidDelegateTest.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import static org.assertj.core.api.Assertions.assertThat; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; - import org.camunda.bpm.engine.delegate.DelegateExecution; import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake; import org.junit.Test; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java index eb9f657d4f..96c3db0ccc 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java @@ -27,13 +27,14 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder; import org.junit.Before; import org.junit.Test; import org.mockito.InOrder; - +import org.onap.so.bpmn.infrastructure.pnf.PnfNotificationEvent; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; public class InformDmaapClientTest { + @Before public void setUp() throws Exception { informDmaapClient = new InformDmaapClient(); @@ -72,9 +73,23 @@ public class InformDmaapClientTest { inOrder.verify(messageCorrelationBuilder).correlateWithResult(); } + @Test + public void onApplicationEvent_validPnfNotificationEvent_expectedOutput() { + + PnfNotificationEvent pnfNotificationEvent = new PnfNotificationEvent(this, "testPnfCorrelationId"); + + informDmaapClient.execute(delegateExecution); + informDmaapClient.onApplicationEvent(pnfNotificationEvent); + + InOrder inOrder = inOrder(messageCorrelationBuilder); + inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey"); + inOrder.verify(messageCorrelationBuilder).correlateWithResult(); + } + private DelegateExecution mockDelegateExecution() { DelegateExecution delegateExecution = mock(DelegateExecution.class); - when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))).thenReturn("testPnfCorrelationId"); + when(delegateExecution.getVariable(eq(ExecutionVariableNames.PNF_CORRELATION_ID))) + .thenReturn("testPnfCorrelationId"); when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey"); ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class); when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices); @@ -85,4 +100,4 @@ public class InformDmaapClientTest { when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder); return delegateExecution; } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java index 001815b206..6c8716cbd7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java @@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; - import java.util.UUID; import org.apache.commons.lang3.StringUtils; import org.camunda.bpm.engine.delegate.BpmnError; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java index 3a9d6d0055..8577d9555b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfManagementTestImpl.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.pnf.delegate; import org.onap.aai.domain.yang.Pnf; import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement; - import java.io.IOException; import java.util.HashMap; import java.util.Map; @@ -51,8 +50,7 @@ public class PnfManagementTestImpl implements PnfManagement { } @Override - public void createRelation(String serviceInstanceId, String pnfName) { - } + public void createRelation(String serviceInstanceId, String pnfName) {} public Map<String, Pnf> getCreated() { return created; diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java new file mode 100644 index 0000000000..110ee2146c --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigAssignDelegateTest.java @@ -0,0 +1,130 @@ +/* + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ 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. + * + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.fail; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MODEL_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_NAME; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_VERSION; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +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.Test; +import org.junit.runner.RunWith; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.cds.beans.ConfigAssignPropertiesForPnf; +import org.onap.so.client.cds.beans.ConfigAssignRequestPnf; +import org.onap.so.client.exception.ExceptionBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {ExceptionBuilder.class, PrepareConfigAssignDelegate.class}) +public class PrepareConfigAssignDelegateTest { + + private static String TEST_MODEL_UUID = "6bc0b04d-1873-4721-b53d-6615225b2a28"; + private static String TEST_SERVICE_INSTANCE_ID = "test_service_id"; + private static String TEST_PROCESS_KEY = "processKey1"; + private static String TEST_PNF_RESOURCE_INSTANCE_NAME = "PNF_demo_resource"; + private static String TEST_PNF_CORRELATION_ID = "PNFDemo"; + private static String TEST_PNF_RESOURCE_BLUEPRINT_NAME = "blueprintOnap"; + private static String TEST_PNF_RESOURCE_BLUEPRINT_VERSION = "1.0.1"; + private static String TEST_PNF_RESOURCE_CUSTOMIZATION_UUID = "9acb3a83-8a52-412c-9a45-901764938144"; + private static String TEST_MSO_REQUEST_ID = "ff874603-4222-11e7-9252-005056850d2e"; + private static String TEST_PNF_UUID = "5df8b6de-2083-11e7-93ae-92361f002671"; + + @Autowired + private PrepareConfigAssignDelegate prepareConfigAssignDelegate; + + private DelegateExecution execution = new DelegateExecutionFake(); + + @Before + public void setUp() { + execution.setVariable("testProcessKey", TEST_PROCESS_KEY); + execution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID); + execution.setVariable(MODEL_UUID, TEST_MODEL_UUID); + execution.setVariable(SERVICE_INSTANCE_ID, TEST_SERVICE_INSTANCE_ID); + execution.setVariable(MSO_REQUEST_ID, TEST_MSO_REQUEST_ID); + execution.setVariable(PNF_UUID, TEST_PNF_UUID); + execution.setVariable(PRC_INSTANCE_NAME, TEST_PNF_RESOURCE_INSTANCE_NAME); + execution.setVariable(PRC_CUSTOMIZATION_UUID, TEST_PNF_RESOURCE_CUSTOMIZATION_UUID); + execution.setVariable(PRC_BLUEPRINT_NAME, TEST_PNF_RESOURCE_BLUEPRINT_NAME); + execution.setVariable(PRC_BLUEPRINT_VERSION, TEST_PNF_RESOURCE_BLUEPRINT_VERSION); + } + + @Test + public void testExecution_validPnf_executionObjectCreated() { + try { + prepareConfigAssignDelegate.execute(execution); + Object executionObject = execution.getVariable(EXECUTION_OBJECT); + assertThat(executionObject).isNotNull(); + assertThat(executionObject).isInstanceOf(AbstractCDSPropertiesBean.class); + checkCDSPropertiesBean((AbstractCDSPropertiesBean) executionObject); + } catch (Exception e) { + e.printStackTrace(); + fail("Exception thrown" + e.getMessage()); + } + } + + private void checkCDSPropertiesBean(AbstractCDSPropertiesBean executionObject) { + assertThat(executionObject.getBlueprintName()).matches(TEST_PNF_RESOURCE_BLUEPRINT_NAME); + assertThat(executionObject.getBlueprintVersion()).matches(TEST_PNF_RESOURCE_BLUEPRINT_VERSION); + assertThat(executionObject.getRequestId()).matches(TEST_MSO_REQUEST_ID); + assertThat(executionObject.getSubRequestId()).matches(TEST_PNF_UUID); + assertThat(executionObject.getMode()).matches("sync"); + assertThat(executionObject.getActionName()).matches("config-assign"); + assertThat(executionObject.getOriginatorId()).matches("SO"); + + assertThat(executionObject.getRequestObject()).isNotNull(); + String requestObject = executionObject.getRequestObject(); + + checkRequestJson(requestObject); + } + + private void checkRequestJson(String requestObject) { + try { + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(requestObject); + ConfigAssignRequestPnf configAssignRequestPnf = + mapper.treeToValue(tree.at("/config-assign-request"), ConfigAssignRequestPnf.class); + assertThat(configAssignRequestPnf.getResolutionKey()).matches(TEST_PNF_CORRELATION_ID); + + ConfigAssignPropertiesForPnf properties = configAssignRequestPnf.getConfigAssignPropertiesForPnf(); + assertThat(properties.getServiceInstanceId()).matches(TEST_SERVICE_INSTANCE_ID); + assertThat(properties.getPnfName()).matches(TEST_PNF_CORRELATION_ID); + assertThat(properties.getPnfId()).matches(TEST_PNF_UUID); + assertThat(properties.getPnfCustomizationUuid()).matches(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID); + assertThat(properties.getServiceModelUuid()).matches(TEST_MODEL_UUID); + } catch (IOException e) { + e.printStackTrace(); + fail("Check request body is json message" + e.getMessage()); + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java new file mode 100644 index 0000000000..8d19d9e563 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PrepareConfigDeployDelegateTest.java @@ -0,0 +1,183 @@ +/* + * ============LICENSE_START======================================================= Copyright (C) 2019 Nordix + * Foundation. ================================================================================ 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. + * + * SPDX-License-Identifier: Apache-2.0 ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.pnf.delegate; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Assertions.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MODEL_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_NAME; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_BLUEPRINT_VERSION; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_CUSTOMIZATION_UUID; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PRC_INSTANCE_NAME; +import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.SERVICE_INSTANCE_ID; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import java.io.IOException; +import java.util.Optional; +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.Test; +import org.junit.runner.RunWith; +import org.onap.aai.domain.yang.Pnf; +import org.onap.so.bpmn.core.WorkflowException; +import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement; +import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.cds.beans.ConfigDeployPropertiesForPnf; +import org.onap.so.client.cds.beans.ConfigDeployRequestPnf; +import org.onap.so.client.exception.ExceptionBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(classes = {ExceptionBuilder.class, PrepareConfigDeployDelegate.class}) +public class PrepareConfigDeployDelegateTest { + + private static String TEST_MODEL_UUID = "6bc0b04d-1873-4721-b53d-6615225b2a28"; + private static String TEST_SERVICE_INSTANCE_ID = "test_service_id"; + private static String TEST_PROCESS_KEY = "processKey1"; + private static String TEST_PNF_RESOURCE_INSTANCE_NAME = "PNF_demo_resource"; + private static String TEST_PNF_CORRELATION_ID = "PNFDemo"; + private static String TEST_PNF_RESOURCE_BLUEPRINT_NAME = "blueprintOnap"; + private static String TEST_PNF_RESOURCE_BLUEPRINT_VERSION = "1.0.1"; + private static String TEST_PNF_RESOURCE_CUSTOMIZATION_UUID = "9acb3a83-8a52-412c-9a45-901764938144"; + private static String TEST_MSO_REQUEST_ID = "ff874603-4222-11e7-9252-005056850d2e"; + private static String TEST_PNF_UUID = "5df8b6de-2083-11e7-93ae-92361f002671"; + private static String TEST_IPV4_ADDRESS = "1.1.1.1"; + private static String TEST_IPV6_ADDRESS = "::1/128"; + + @Autowired + private PrepareConfigDeployDelegate prepareConfigDeployDelegate; + + @MockBean + private PnfManagement pnfManagement; + + private DelegateExecution execution = new DelegateExecutionFake(); + + @Before + public void setUp() throws IOException { + execution.setVariable("testProcessKey", TEST_PROCESS_KEY); + execution.setVariable(PNF_CORRELATION_ID, TEST_PNF_CORRELATION_ID); + execution.setVariable(MODEL_UUID, TEST_MODEL_UUID); + execution.setVariable(SERVICE_INSTANCE_ID, TEST_SERVICE_INSTANCE_ID); + execution.setVariable(MSO_REQUEST_ID, TEST_MSO_REQUEST_ID); + execution.setVariable(PNF_UUID, TEST_PNF_UUID); + execution.setVariable(PRC_INSTANCE_NAME, TEST_PNF_RESOURCE_INSTANCE_NAME); + execution.setVariable(PRC_CUSTOMIZATION_UUID, TEST_PNF_RESOURCE_CUSTOMIZATION_UUID); + execution.setVariable(PRC_BLUEPRINT_NAME, TEST_PNF_RESOURCE_BLUEPRINT_NAME); + execution.setVariable(PRC_BLUEPRINT_VERSION, TEST_PNF_RESOURCE_BLUEPRINT_VERSION); + mockAai(); + } + + private void mockAai() throws IOException { + Pnf pnf = new Pnf(); + pnf.setIpaddressV4Oam(TEST_IPV4_ADDRESS); + pnf.setIpaddressV6Oam(TEST_IPV6_ADDRESS); + when(pnfManagement.getEntryFor(TEST_PNF_CORRELATION_ID)).thenReturn(Optional.of(pnf)); + } + + @Test + public void testExecution_validPnf_executionObjectCreated() { + try { + prepareConfigDeployDelegate.execute(execution); + Object executionObject = execution.getVariable(EXECUTION_OBJECT); + assertThat(executionObject).isNotNull(); + assertThat(executionObject).isInstanceOf(AbstractCDSPropertiesBean.class); + checkCDSPropertiesBean((AbstractCDSPropertiesBean) executionObject); + } catch (Exception e) { + e.printStackTrace(); + fail("Exception thrown" + e.getMessage()); + } + } + + @Test + public void testExecution_failedAaiConnection_exceptionThrown() { + try { + /** + * Mock the IOException from AAI. + */ + when(pnfManagement.getEntryFor(TEST_PNF_CORRELATION_ID)).thenThrow(new IOException("Connection failed")); + } catch (IOException e) { + e.printStackTrace(); + } + assertThatThrownBy(() -> prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class); + assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString() + .contains("Unable to fetch from AAI"); + assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class); + } + + @Test + public void testExecution_aaiEntryNotExist_exceptionThrown() { + try { + /** + * Mock the AAI without PNF. + */ + when(pnfManagement.getEntryFor(TEST_PNF_CORRELATION_ID)).thenReturn(Optional.empty()); + } catch (IOException e) { + e.printStackTrace(); + } + assertThatThrownBy(() -> prepareConfigDeployDelegate.execute(execution)).isInstanceOf(BpmnError.class); + assertThat(execution.getVariable("WorkflowExceptionErrorMessage")).asString() + .contains("AAI entry for PNF: " + TEST_PNF_CORRELATION_ID + " does not exist"); + assertThat(execution.getVariable("WorkflowException")).isInstanceOf(WorkflowException.class); + } + + private void checkCDSPropertiesBean(AbstractCDSPropertiesBean executionObject) { + assertThat(executionObject.getBlueprintName()).matches(TEST_PNF_RESOURCE_BLUEPRINT_NAME); + assertThat(executionObject.getBlueprintVersion()).matches(TEST_PNF_RESOURCE_BLUEPRINT_VERSION); + assertThat(executionObject.getRequestId()).matches(TEST_MSO_REQUEST_ID); + assertThat(executionObject.getSubRequestId()).matches(TEST_PNF_UUID); + assertThat(executionObject.getMode()).matches("async"); + assertThat(executionObject.getActionName()).matches("config-deploy"); + assertThat(executionObject.getOriginatorId()).matches("SO"); + + assertThat(executionObject.getRequestObject()).isNotNull(); + String requestObject = executionObject.getRequestObject(); + + checkRequestJson(requestObject); + } + + private void checkRequestJson(String requestObject) { + try { + ObjectMapper mapper = new ObjectMapper(); + JsonNode tree = mapper.readTree(requestObject); + ConfigDeployRequestPnf configDeployRequestPnf = + mapper.treeToValue(tree.at("/config-deploy-request"), ConfigDeployRequestPnf.class); + assertThat(configDeployRequestPnf.getResolutionKey()).matches(TEST_PNF_CORRELATION_ID); + + ConfigDeployPropertiesForPnf properties = configDeployRequestPnf.getConfigDeployPropertiesForPnf(); + assertThat(properties.getServiceInstanceId()).matches(TEST_SERVICE_INSTANCE_ID); + assertThat(properties.getPnfName()).matches(TEST_PNF_CORRELATION_ID); + assertThat(properties.getPnfId()).matches(TEST_PNF_UUID); + assertThat(properties.getPnfCustomizationUuid()).matches(TEST_PNF_RESOURCE_CUSTOMIZATION_UUID); + assertThat(properties.getServiceModelUuid()).matches(TEST_MODEL_UUID); + assertThat(properties.getPnfIpV4Address()).matches(TEST_IPV4_ADDRESS); + assertThat(properties.getPnfIpV6Address()).matches(TEST_IPV6_ADDRESS); + } catch (IOException e) { + e.printStackTrace(); + fail("Check request body is json message" + e.getMessage()); + } + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java index 17a6ee09d8..8741208d26 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import static org.assertj.core.api.Assertions.assertThat; - import java.util.List; import org.junit.Test; @@ -41,12 +40,12 @@ public class JsonUtilForPnfCorrelationIdTest { @Test public void parseJsonSuccessful() { - List<String> expectedResult = JsonUtilForPnfCorrelationId - .parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID); + List<String> expectedResult = + JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID); assertThat(expectedResult).containsExactly("corrTest1", "corrTest2"); - List<String> expectedResult2 = JsonUtilForPnfCorrelationId - .parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID); + List<String> expectedResult2 = + JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_ONE_PNF_CORRELATION_ID); assertThat(expectedResult2).containsExactly("corrTest3"); } @@ -59,8 +58,8 @@ public class JsonUtilForPnfCorrelationIdTest { @Test public void parseJson_emptyListReturnedWhenNothingFound() { - List<String> expectedResult = JsonUtilForPnfCorrelationId - .parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID); + List<String> expectedResult = + JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(JSON_WITH_NO_PNF_CORRELATION_ID); assertThat(expectedResult).isEmpty(); } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index 60f51ff783..9f31e2a5df 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -25,19 +25,19 @@ package org.onap.so.bpmn.infrastructure.pnf.dmaap; import static org.junit.Assert.*; import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyObject; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; - import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledThreadPoolExecutor; - import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.ProtocolVersion; @@ -49,10 +49,14 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.bpmn.infrastructure.pnf.PnfNotificationEvent; import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread; +import org.springframework.context.ApplicationEventPublisher; import org.springframework.core.env.Environment; + @RunWith(MockitoJUnitRunner.class) public class PnfEventReadyDmaapClientTest { @@ -81,10 +85,13 @@ public class PnfEventReadyDmaapClientTest { private Runnable threadMockToNotifyCamundaFlow; private ScheduledThreadPoolExecutor executorMock; + @Mock + private ApplicationEventPublisher applicationEventPublisher; + @Before public void init() throws NoSuchFieldException, IllegalAccessException { - when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT); - when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST); + when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT); + when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST); when(env.getProperty(eq("pnf.dmaap.protocol"))).thenReturn(PROTOCOL); when(env.getProperty(eq("pnf.dmaap.uriPathPrefix"))).thenReturn(URI_PATH_PREFIX); when(env.getProperty(eq("pnf.dmaap.topicName"))).thenReturn(EVENT_TOPIC_TEST); @@ -92,7 +99,7 @@ public class PnfEventReadyDmaapClientTest { when(env.getProperty(eq("pnf.dmaap.consumerGroup"))).thenReturn(CONSUMER_GROUP); when(env.getProperty(eq("pnf.dmaap.topicListenerDelayInSeconds"), eq(Integer.class))) .thenReturn(TOPIC_LISTENER_DELAY_IN_SECONDS); - testedObject = new PnfEventReadyDmaapClient(env); + testedObject = new PnfEventReadyDmaapClient(env, applicationEventPublisher); testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread(); httpClientMock = mock(HttpClient.class); threadMockToNotifyCamundaFlow = mock(Runnable.class); @@ -102,56 +109,63 @@ public class PnfEventReadyDmaapClientTest { /** * Test run method, where the are following conditions: - * <p> - DmaapThreadListener is running, flag is set to true - * <p> - map is filled with one entry with the key that we get from response - * <p> run method should invoke thread from map to notify camunda process, remove element from the map (map is - * empty) and shutdown the executor because of empty map + * <p> + * - DmaapThreadListener is running, flag is set to true + * <p> + * - map is filled with one entry with the key that we get from response + * <p> + * run method should invoke thread from map to notify camunda process, remove element from the map (map is empty) + * and shutdown the executor because of empty map */ @Test - public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady() - throws IOException { - when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID))); + public void pnfCorrelationIdIsFoundInHttpResponse_notifyAboutPnfReady() throws IOException { + when(httpClientMock.execute(any(HttpGet.class))) + .thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID))); testedObjectInnerClassThread.run(); ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class); - verify(httpClientMock).execute(captor1.capture()); - - assertEquals(captor1.getValue().getURI().getHost(),HOST); - assertEquals(captor1.getValue().getURI().getPort(),PORT); - assertEquals(captor1.getValue().getURI().getScheme(),PROTOCOL); - assertEquals(captor1.getValue().getURI().getPath(),"/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + ""); - - verify(threadMockToNotifyCamundaFlow).run(); + verify(httpClientMock).execute(captor1.capture()); + + assertEquals(captor1.getValue().getURI().getHost(), HOST); + assertEquals(captor1.getValue().getURI().getPort(), PORT); + assertEquals(captor1.getValue().getURI().getScheme(), PROTOCOL); + assertEquals(captor1.getValue().getURI().getPath(), + "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + ""); + + /** + * Two PNF returned from HTTP request. + */ + verify(applicationEventPublisher, times(2)).publishEvent(any(PnfNotificationEvent.class)); verify(executorMock).shutdown(); } /** * Test run method, where the are following conditions: - * <p> - DmaapThreadListener is running, flag is set to true - * <p> - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId - * taken from http response. run method should not do anything with the map not run any thread to notify camunda - * process + * <p> + * - DmaapThreadListener is running, flag is set to true + * <p> + * - map is filled with one entry with the pnfCorrelationId that does not match to pnfCorrelationId taken from http + * response. run method should not do anything with the map not run any thread to notify camunda process */ @Test - public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap() - throws IOException { - when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse( - String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP))); + public void pnfCorrelationIdIsFoundInHttpResponse_NotFoundInMap() throws IOException { + when(httpClientMock.execute(any(HttpGet.class))).thenReturn(createResponse( + String.format(JSON_EXAMPLE_WITH_PNF_CORRELATION_ID, PNF_CORRELATION_ID_NOT_FOUND_IN_MAP))); testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } /** * Test run method, where the are following conditions: - * <p> - DmaapThreadListener is running, flag is set to true - * <p> - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse - * run method should not do anything with the map and not run any thread to notify camunda process + * <p> + * - DmaapThreadListener is running, flag is set to true + * <p> + * - map is filled with one entry with the pnfCorrelationId but no correlation id is taken from HttpResponse run + * method should not do anything with the map and not run any thread to notify camunda process */ @Test public void pnfCorrelationIdIsNotFoundInHttpResponse() throws IOException { - when(httpClientMock.execute(any(HttpGet.class))). - thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID)); + when(httpClientMock.execute(any(HttpGet.class))) + .thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_PNF_CORRELATION_ID)); testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } @@ -167,8 +181,7 @@ public class PnfEventReadyDmaapClientTest { executorField.set(testedObject, executorMock); executorField.setAccessible(false); - Field pnfCorrelationToThreadMapField = testedObject.getClass() - .getDeclaredField("pnfCorrelationIdToThreadMap"); + Field pnfCorrelationToThreadMapField = testedObject.getClass().getDeclaredField("pnfCorrelationIdToThreadMap"); pnfCorrelationToThreadMapField.setAccessible(true); Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>(); pnfCorrelationToThreadMap.put(PNF_CORRELATION_ID, threadMockToNotifyCamundaFlow); diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java index 239361d306..61a4654668 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/vfcmodel/VfcModelPojoTest.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.vfcmodel; import org.junit.Test; - import com.openpojo.validation.Validator; import com.openpojo.validation.ValidatorBuilder; import com.openpojo.validation.rule.impl.NoNestedClassRule; @@ -30,16 +29,12 @@ import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; public class VfcModelPojoTest { - private String packageName = "org.onap.so.bpmn.infrastructure.vfcmodel"; + private String packageName = "org.onap.so.bpmn.infrastructure.vfcmodel"; - @Test - public void validate() { - Validator validator = ValidatorBuilder.create() - .with(new NoNestedClassRule()) - .with(new NoPublicFieldsRule()) - .with(new SetterTester()) - .with(new GetterTester()) - .build(); - validator.validate(packageName); - } + @Test + public void validate() { + Validator validator = ValidatorBuilder.create().with(new NoNestedClassRule()).with(new NoPublicFieldsRule()) + .with(new SetterTester()).with(new GetterTester()).build(); + validator.validate(packageName); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java new file mode 100644 index 0000000000..0b4050beec --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactoryTest.java @@ -0,0 +1,157 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2019 Samsung 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.service; + +import static org.mockito.Mockito.doReturn; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.so.bpmn.core.domain.ServiceDecomposition; + +@RunWith(MockitoJUnitRunner.class) +public class ServicePluginFactoryTest { + + @Mock + ServiceDecomposition serviceDecomposition; + + @Spy + ServicePluginFactory servicePluginFactory; + + String uuiRequest = "{" + " \"service\":{" + " \"name\":\"ONAP_223531\"," + + " \"description\":\"ONAP_1546\"," + + " \"serviceInvariantUuid\":\"4a09419a-c9fd-4a53-b1bd-b49603169ca1\"," + + " \"serviceUuid\":\"1bd0eae6-2dcc-4461-9ae6-56d641f369d6\"," + + " \"globalSubscriberId\":\"test_custormer\"," + " \"serviceType\":\"example-service-type\"," + + " \"parameters\":{" + " \"locationConstraints\":[" + " ]," + + " \"resources\":[" + " {" + + " \"resourceName\":\"vEPC_ONAP01\"," + + " \"resourceInvariantUuid\":\"36ebe421-283a-4ee8-92f1-d09e7c44b911\"," + + " \"resourceUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed111\"," + + " \"resourceCustomizationUuid\":\"47a0e235-b67a-4ea4-a0cf-25761afed231\"," + + " \"parameters\":{" + " \"locationConstraints\":[" + + " {" + + " \"vnfProfileId\":\"b244d433-8c9c-49ad-9c70-8e34b8dc8328\"," + + " \"locationConstraints\":{" + + " \"vimId\":\"vmware_vio\"" + " }" + + " }," + " {" + + " \"vnfProfileId\":\"8a9f7c48-21ce-41b7-95b8-a8ac61ccb1ff\"," + + " \"locationConstraints\":{" + + " \"vimId\":\"core-dc_RegionOne\"" + + " }" + " }" + " ]," + + " \"resources\":[" + " ]," + + " \"requestInputs\":{" + " \"sdncontroller\":\"\"" + + " }" + " }" + " }," + " {" + + " \"resourceName\":\"VL OVERLAYTUNNEL\"," + + " \"resourceInvariantUuid\":\"184494cf-472f-436f-82e2-d83dddde21cb\"," + + " \"resourceUuid\":\"95bc3e59-c9c5-458f-ad6e-78874ab4b3cc\"," + + " \"resourceCustomizationUuid\":\"27a0e235-b67a-4ea4-a0cf-25761afed232\"," + + " \"parameters\":{" + " \"locationConstraints\":[" + + " ]," + " \"resources\":[" + " ]," + + " \"requestInputs\":{" + " }" + " }" + + " }" + " ]," + " \"requestInputs\":{" + + " \"vlunderlayvpn0_name\":\"l3connect\"," + + " \"vlunderlayvpn0_site1_id\":\"IP-WAN-Controller-1\"," + + " \"vlunderlayvpn0_site2_id\":\"SPTNController\"," + + " \"vlunderlayvpn0_site1_networkName\":\"network1,network2\"," + + " \"vlunderlayvpn0_site2_networkName\":\"network3,network4\"," + + " \"vlunderlayvpn0_site1_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1a\"," + + " \"vlunderlayvpn0_site2_routerId\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\"," + + " \"vlunderlayvpn0_site2_importRT1\":\"200:1,200:2\"," + + " \"vlunderlayvpn0_site1_exportRT1\":\"300:1,300:2\"," + + " \"vlunderlayvpn0_site2_exportRT1\":\"400:1,400:2\"," + + " \"vlunderlayvpn0_site1_vni\":\"2000\"," + + " \"vlunderlayvpn0_site2_vni\":\"3000\"," + + " \"vlunderlayvpn0_tunnelType\":\"L3-DCI\"," + + " \"CallSource\":\"NOT-ExternalAPI\"," + " \"sotnconnectivity\":\"\"" + + " }" + " }" + " }" + "}"; + + + @Test + public void doProcessSiteLocation_isNeedProcessSite() { + String result = servicePluginFactory.doProcessSiteLocation(serviceDecomposition, uuiRequest); + Assert.assertEquals(result, uuiRequest); + } + + @Test + public void doProcessSiteLocation_uuiObjectNull() { + String faultyJsonInput = "site_address,sotncondition_clientsignal"; + String result = servicePluginFactory.doProcessSiteLocation(serviceDecomposition, faultyJsonInput); + Assert.assertEquals(result, faultyJsonInput); + } + + @Test + public void doProcessSiteLocation_isSiteLocationLocal() { + String jsonWithOnlyNeededValues = "{\"site_address\":\"\",\"sotncondition_clientsignal\":\"\"}"; + String result = servicePluginFactory.doProcessSiteLocation(serviceDecomposition, jsonWithOnlyNeededValues); + Assert.assertEquals(result, jsonWithOnlyNeededValues); + } + + + @Test + public void doTPResourcesAllocation_Success() { + doReturn(null).when(servicePluginFactory).getTPsfromAAI(); + String result = servicePluginFactory.doTPResourcesAllocation(null, uuiRequest); + Assert.assertNotEquals(result, uuiRequest); + } + + @Test + public void doTPResourcesAllocation_uuiObjectNull() { + String faultyJsonInput = "site_address,sotncondition_clientsignal"; + String result = servicePluginFactory.doTPResourcesAllocation(null, faultyJsonInput); + Assert.assertEquals(result, faultyJsonInput); + } + + @Test + public void doTPResourcesAllocation_isNeedAllocateCrossTPResources() { + // doReturn(null).when(servicePluginFactory).getTPsfromAAI(); + String jsonWithOnlyNeededValues = "{\"site_address\":\"\",\"sotncondition_clientsignal\":\"\"}"; + String result = servicePluginFactory.doTPResourcesAllocation(null, jsonWithOnlyNeededValues); + Assert.assertEquals(result, jsonWithOnlyNeededValues); + } + + @Test + public void preProcessService_isSOTN() { + String invalidJsonWithOnlyNeededValues = "\"clientSignal\":\"\",\"vpnType\":\"\"}"; + String result = servicePluginFactory.preProcessService(null, invalidJsonWithOnlyNeededValues); + Assert.assertEquals(result, invalidJsonWithOnlyNeededValues); + } + + @Test + public void preProcessService() { + String result = servicePluginFactory.preProcessService(null, uuiRequest); + Assert.assertEquals(result, uuiRequest); + } + + @Test + public void doServiceHoming() { + String result = servicePluginFactory.doServiceHoming(null, uuiRequest); + Assert.assertEquals(result, uuiRequest); + } + + @Test + public void doServiceHoming_isSOTN() { + String invalidJsonWithOnlyNeededValues = "\"clientSignal\":\"\",\"vpnType\":\"\"}"; + String result = servicePluginFactory.doServiceHoming(null, invalidJsonWithOnlyNeededValues); + Assert.assertEquals(result, invalidJsonWithOnlyNeededValues); + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java index ca8ec22088..f523e7ab1d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/HeaderUtilTest.java @@ -20,15 +20,14 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client; import static org.junit.Assert.assertEquals; - import org.junit.Test; public class HeaderUtilTest { @Test public void getAuthorizationTest() throws Exception { - String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS); - assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization); + String authorization = HeaderUtil.getAuthorization(HeaderUtil.USER, HeaderUtil.PASS); + assertEquals("Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==", authorization); } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java index 4ac131f873..6f884cb126 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/AbstractBuilderTest.java @@ -20,13 +20,11 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; import static org.junit.Assert.assertEquals; - import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; - import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -52,10 +50,10 @@ public class AbstractBuilderTest { DelegateExecution delegateExecution = new DelegateExecution() { private String operType; - private String resourceType; - private String requestId; + private String resourceType; + private String requestId; - @Override + @Override public String getProcessInstanceId() { return null; } @@ -207,14 +205,14 @@ public class AbstractBuilderTest { @Override public Object getVariable(String s) { - if (AbstractBuilder.OPERATION_TYPE.equals(s)) { - return operType; - } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { - return resourceType; - } else if ("msoRequestId".equals(s)) { - return requestId; - } - return null; + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + return operType; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + return resourceType; + } else if ("msoRequestId".equals(s)) { + return requestId; + } + return null; } @Override @@ -254,13 +252,13 @@ public class AbstractBuilderTest { @Override public void setVariable(String s, Object o) { - if (AbstractBuilder.OPERATION_TYPE.equals(s)) { - operType = (String) o; - } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { - resourceType = (String) o; - } else if ("msoRequestId".equals(s)) { - requestId = (String) o; - } + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + operType = (String) o; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + resourceType = (String) o; + } else if ("msoRequestId".equals(s)) { + requestId = (String) o; + } } @Override @@ -328,27 +326,27 @@ public class AbstractBuilderTest { } - @Override - public ProcessEngine getProcessEngine(){ - // TODO Auto-generated method stub - return null; - } + @Override + public ProcessEngine getProcessEngine() { + // TODO Auto-generated method stub + return null; + } - @Override - public void setProcessBusinessKey(String arg0){ - // TODO Auto-generated method stub + @Override + public void setProcessBusinessKey(String arg0) { + // TODO Auto-generated method stub - } + } }; @Test public void requestActionGetIntValueTest() { - assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue()); + assertEquals(0, RequestAction.CREATE_NETWORK_INSTANCE.getIntValue()); } @Test public void svcActionGetIntValueTest() { - assertEquals(0, SvcAction.RESERVE.getIntValue()); + assertEquals(0, SvcAction.RESERVE.getIntValue()); } @Test @@ -358,81 +356,93 @@ public class AbstractBuilderTest { @Test public void getRequestActionBlankOperationTypeTest() throws Exception { - assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionDeleteOperationTypeBlankResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); - assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionDeleteOperationTypeBadResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); - assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); - assertEquals(AbstractBuilder.RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.RequestAction.DEACTIVATE_DCI_NETWORK_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); - assertEquals(AbstractBuilder.RequestAction.DELETE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.RequestAction.DELETE_NETWORK_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionDeleteOperationTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + assertEquals(AbstractBuilder.RequestAction.DELETE_SERVICE_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionCreateOperationTypeBlankResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); - assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionCreateOperationTypeBadResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); - assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionCreateOperationTypeOverlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); - assertEquals(AbstractBuilder.RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.RequestAction.ACTIVATE_DCI_NETWORK_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); - assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionCreateOperationTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + assertEquals(AbstractBuilder.RequestAction.CREATE_SERVICE_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test public void getRequestActionBadOperationType() { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad"); - assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), abstractBuilder.getRequestAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad"); + assertEquals(AbstractBuilder.RequestAction.CREATE_NETWORK_INSTANCE.getName(), + abstractBuilder.getRequestAction(delegateExecution)); } @Test @@ -442,95 +452,95 @@ public class AbstractBuilderTest { @Test public void getSvcActionDeleteOperationTypeBlankResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); - assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionDeleteOperationTypeBadResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); - assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionDeleteOperationTypeOverlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); - assertEquals(AbstractBuilder.SvcAction.DEACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.SvcAction.DEACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionDeleteOperationTypeUnderlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); - assertEquals(AbstractBuilder.SvcAction.DELETE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.SvcAction.DELETE.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionDeleteOperationTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); - assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.DELETE); + assertEquals(AbstractBuilder.SvcAction.UNASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionCreateOperationTypeBlankResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); - assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, ""); + assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionCreateOperationTypeBadResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); - assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "bad"); + assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionCreateOperationTypeOverlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); - assertEquals(AbstractBuilder.SvcAction.ACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "overlay"); + assertEquals(AbstractBuilder.SvcAction.ACTIVATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionCreateOperationTypeUnderlayResourceTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); - assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + delegateExecution.setVariable(AbstractBuilder.RESOURCE_TYPE, "underlay"); + assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionCreateOperationTypeTest() throws Exception { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); - assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, RequestsDbConstant.OperationType.CREATE); + assertEquals(AbstractBuilder.SvcAction.ASSIGN.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getSvcActionBadOperationType() { - delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad"); - assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); + delegateExecution.setVariable(AbstractBuilder.OPERATION_TYPE, "bad"); + assertEquals(AbstractBuilder.SvcAction.CREATE.getName(), abstractBuilder.getSvcAction(delegateExecution)); } @Test public void getRequestIdBlankNotOnExecutionTest() { - abstractBuilder.getRequestId(delegateExecution); + abstractBuilder.getRequestId(delegateExecution); } @Test public void getRequestIdBlankOnExecutionTest() { - String expected = "requestId"; - delegateExecution.setVariable("msoRequestId", expected); - assertEquals(expected, abstractBuilder.getRequestId(delegateExecution)); + String expected = "requestId"; + delegateExecution.setVariable("msoRequestId", expected); + assertEquals(expected, abstractBuilder.getRequestId(delegateExecution)); } @Test public void getRequestIdTest() { - String expected = "requestId"; - abstractBuilder.requestId = expected; - assertEquals(expected, abstractBuilder.getRequestId(delegateExecution)); + String expected = "requestId"; + abstractBuilder.requestId = expected; + assertEquals(expected, abstractBuilder.getRequestId(delegateExecution)); } @Test @@ -545,8 +555,8 @@ public class AbstractBuilderTest { @Test public void getParamEntitiesTest() throws Exception { - Map<String, String> inputs = new HashMap<>(); - inputs.put("foo", "bar"); + Map<String, String> inputs = new HashMap<>(); + inputs.put("foo", "bar"); List<ParamEntity> list = abstractBuilder.getParamEntities(inputs); assertEquals(1, list.size()); assertEquals("foo", list.get(0).getName()); @@ -555,14 +565,14 @@ public class AbstractBuilderTest { @Test public void getParamEntitiesNullInputsTest() { - List<ParamEntity> list = abstractBuilder.getParamEntities(null); - assertEquals(0, list.size()); + List<ParamEntity> list = abstractBuilder.getParamEntities(null); + assertEquals(0, list.size()); } @Test public void getParamEntitiesEmptyInputsTest() { - List<ParamEntity> list = abstractBuilder.getParamEntities(new HashMap<>()); - assertEquals(0, list.size()); + List<ParamEntity> list = abstractBuilder.getParamEntities(new HashMap<>()); + assertEquals(0, list.size()); } @Test @@ -580,4 +590,4 @@ public class AbstractBuilderTest { abstractBuilder.getServiceInstanceName(delegateExecution); } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java index 4e39c7b4e3..ed16f5d197 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/NetworkRpcInputEntityBuilderTest.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; import java.util.Collection; import java.util.Map; import java.util.Set; - import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -35,14 +34,14 @@ import org.camunda.bpm.model.bpmn.instance.FlowElement; import org.junit.Test; public class NetworkRpcInputEntityBuilderTest { - NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder(); + NetworkRpcInputEntityBuilder networRpcInputEntityBuilder = new NetworkRpcInputEntityBuilder(); - DelegateExecution delegateExecution = new DelegateExecution() { + DelegateExecution delegateExecution = new DelegateExecution() { private String operType; - private String resourceType; - private String requestId; + private String resourceType; + private String requestId; - @Override + @Override public String getProcessInstanceId() { return null; } @@ -194,14 +193,14 @@ public class NetworkRpcInputEntityBuilderTest { @Override public Object getVariable(String s) { - if (AbstractBuilder.OPERATION_TYPE.equals(s)) { - return operType; - } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { - return resourceType; - } else if ("msoRequestId".equals(s)) { - return requestId; - } - return null; + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + return operType; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + return resourceType; + } else if ("msoRequestId".equals(s)) { + return requestId; + } + return null; } @Override @@ -241,13 +240,13 @@ public class NetworkRpcInputEntityBuilderTest { @Override public void setVariable(String s, Object o) { - if (AbstractBuilder.OPERATION_TYPE.equals(s)) { - operType = (String) o; - } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { - resourceType = (String) o; - } else if ("msoRequestId".equals(s)) { - requestId = (String) o; - } + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + operType = (String) o; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + resourceType = (String) o; + } else if ("msoRequestId".equals(s)) { + requestId = (String) o; + } } @Override @@ -315,22 +314,22 @@ public class NetworkRpcInputEntityBuilderTest { } - @Override - public ProcessEngine getProcessEngine(){ - // TODO Auto-generated method stub - return null; - } + @Override + public ProcessEngine getProcessEngine() { + // TODO Auto-generated method stub + return null; + } - @Override - public void setProcessBusinessKey(String arg0){ - // TODO Auto-generated method stub + @Override + public void setProcessBusinessKey(String arg0) { + // TODO Auto-generated method stub - } + } }; - @Test - public void buildTest() { - networRpcInputEntityBuilder.build(delegateExecution, null); - } + @Test + public void buildTest() { + networRpcInputEntityBuilder.build(delegateExecution, null); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java index 556ff67fad..3d1b1de8c0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/builder/ServiceRpcInputEntityBuilderTest.java @@ -23,7 +23,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder; import java.util.Collection; import java.util.Map; import java.util.Set; - import org.camunda.bpm.engine.ProcessEngine; import org.camunda.bpm.engine.ProcessEngineServices; import org.camunda.bpm.engine.delegate.DelegateExecution; @@ -35,14 +34,14 @@ import org.camunda.bpm.model.bpmn.instance.FlowElement; import org.junit.Test; public class ServiceRpcInputEntityBuilderTest { - ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder(); + ServiceRpcInputEntityBuilder serviceRpcInputEntityBuilder = new ServiceRpcInputEntityBuilder(); - DelegateExecution delegateExecution = new DelegateExecution() { + DelegateExecution delegateExecution = new DelegateExecution() { private String operType; - private String resourceType; - private String requestId; + private String resourceType; + private String requestId; - @Override + @Override public String getProcessInstanceId() { return null; } @@ -194,14 +193,14 @@ public class ServiceRpcInputEntityBuilderTest { @Override public Object getVariable(String s) { - if (AbstractBuilder.OPERATION_TYPE.equals(s)) { - return operType; - } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { - return resourceType; - } else if ("msoRequestId".equals(s)) { - return requestId; - } - return null; + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + return operType; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + return resourceType; + } else if ("msoRequestId".equals(s)) { + return requestId; + } + return null; } @Override @@ -241,13 +240,13 @@ public class ServiceRpcInputEntityBuilderTest { @Override public void setVariable(String s, Object o) { - if (AbstractBuilder.OPERATION_TYPE.equals(s)) { - operType = (String) o; - } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { - resourceType = (String) o; - } else if ("msoRequestId".equals(s)) { - requestId = (String) o; - } + if (AbstractBuilder.OPERATION_TYPE.equals(s)) { + operType = (String) o; + } else if (AbstractBuilder.RESOURCE_TYPE.equals(s)) { + resourceType = (String) o; + } else if ("msoRequestId".equals(s)) { + requestId = (String) o; + } } @Override @@ -315,22 +314,22 @@ public class ServiceRpcInputEntityBuilderTest { } - @Override - public ProcessEngine getProcessEngine(){ - // TODO Auto-generated method stub - return null; - } + @Override + public ProcessEngine getProcessEngine() { + // TODO Auto-generated method stub + return null; + } - @Override - public void setProcessBusinessKey(String arg0){ - // TODO Auto-generated method stub + @Override + public void setProcessBusinessKey(String arg0) { + // TODO Auto-generated method stub - } + } }; - @Test - public void buildTest() throws Exception { - serviceRpcInputEntityBuilder.build(delegateExecution, null); - } + @Test + public void buildTest() throws Exception { + serviceRpcInputEntityBuilder.build(delegateExecution, null); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java index c8949cee0f..70dfd6bd57 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java +++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/client/entity/ClientEntityPojoTest.java @@ -21,7 +21,6 @@ package org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity; import org.junit.Test; - import com.openpojo.reflection.PojoClass; import com.openpojo.reflection.impl.PojoClassFactory; import com.openpojo.validation.Validator; @@ -36,41 +35,34 @@ import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; public class ClientEntityPojoTest { - @Test - public void pojoStructure() { - test(PojoClassFactory.getPojoClass(NetworkInformationEntity.class)); - test(PojoClassFactory.getPojoClass(NetworkInputParametersEntity.class)); - test(PojoClassFactory.getPojoClass(NetworkRequestInputEntity.class)); - test(PojoClassFactory.getPojoClass(NetworkResponseInformationEntity.class)); - test(PojoClassFactory.getPojoClass(NetworkTopologyOperationInputEntity.class)); - test(PojoClassFactory.getPojoClass(NetworkTopologyOperationOutputEntity.class)); - test(PojoClassFactory.getPojoClass(OnapModelInformationEntity.class)); - test(PojoClassFactory.getPojoClass(ParamEntity.class)); - test(PojoClassFactory.getPojoClass(RequestInformationEntity.class)); - test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationInputEntity.class)); - test(PojoClassFactory.getPojoClass(SdncRequestHeaderEntity.class)); - test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationInputEntity.class)); - test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationOutputEntity.class)); - test(PojoClassFactory.getPojoClass(ServiceInformationEntity.class)); - test(PojoClassFactory.getPojoClass(ServiceInputParametersEntity.class)); - test(PojoClassFactory.getPojoClass(ServiceRequestInputEntity.class)); - test(PojoClassFactory.getPojoClass(ServiceResponseInformationEntity.class)); - test(PojoClassFactory.getPojoClass(ServiceTopologyOperationInputEntity.class)); - test(PojoClassFactory.getPojoClass(ServiceTopologyOperationOutputEntity.class)); - test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationOutputEntity.class)); - } - - private void test(PojoClass pojoClass) { - Validator validator = ValidatorBuilder.create() - .with(new GetterMustExistRule()) - .with(new SetterMustExistRule()) - .with(new NoNestedClassRule()) - .with(new NoPrimitivesRule()) - .with(new NoPublicFieldsRule()) - .with(new SetterTester()) - .with(new GetterTester()) - .with(new DefaultValuesNullTester()) - .build(); - validator.validate(pojoClass); - } + @Test + public void pojoStructure() { + test(PojoClassFactory.getPojoClass(NetworkInformationEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkInputParametersEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkRequestInputEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkResponseInformationEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(NetworkTopologyOperationOutputEntity.class)); + test(PojoClassFactory.getPojoClass(OnapModelInformationEntity.class)); + test(PojoClassFactory.getPojoClass(ParamEntity.class)); + test(PojoClassFactory.getPojoClass(RequestInformationEntity.class)); + test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(SdncRequestHeaderEntity.class)); + test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(RpcServiceTopologyOperationOutputEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceInformationEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceInputParametersEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceRequestInputEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceResponseInformationEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceTopologyOperationInputEntity.class)); + test(PojoClassFactory.getPojoClass(ServiceTopologyOperationOutputEntity.class)); + test(PojoClassFactory.getPojoClass(RpcNetworkTopologyOperationOutputEntity.class)); + } + + private void test(PojoClass pojoClass) { + Validator validator = ValidatorBuilder.create().with(new GetterMustExistRule()).with(new SetterMustExistRule()) + .with(new NoNestedClassRule()).with(new NoPrimitivesRule()).with(new NoPublicFieldsRule()) + .with(new SetterTester()).with(new GetterTester()).with(new DefaultValuesNullTester()).build(); + validator.validate(pojoClass); + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json new file mode 100644 index 0000000000..4a30d4bcec --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/BuildingBlocks/Network/queryAAIVpnBindingTestResponseWithRoutes.json @@ -0,0 +1,903 @@ +{ + "vpn-id": "13e94b71-3ce1-4988-ab0e-61208fc91f1c", + "vpn-name": "vMDNS", + "resource-version": "1510956324462", + "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" + } + ]}, + "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-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml index fd6c228cba..f7d44c030b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModuleVolumeV2/vnfAdapterDeleteRequest.xml @@ -1,5 +1,6 @@ <deleteVolumeGroupRequest> <cloudSiteId>null</cloudSiteId> + <cloudOwner>null</cloudOwner> <tenantId>12345</tenantId> <volumeGroupId>12345</volumeGroupId> <volumeGroupStackId>null</volumeGroupStackId> |