diff options
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test')
68 files changed, 9519 insertions, 5346 deletions
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java index 7aa86da237..ea9512bfa7 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/BeansTest.java @@ -36,55 +36,53 @@ import org.springframework.stereotype.Component; public class BeansTest { - private final PojoClassFilter filterTestClasses = new FilterTestClasses(); - - private final PojoClassFilter enumFilter = new FilterEnum(); - - private final PojoClassFilter noNestedClasses = new FilterTestNestedClasses(); - - - - @Test - public void pojoStructure() { - test("org.onap.so.adapters.network.async.client"); - test("org.onap.so.adapters.vnf.async.client"); - test("org.onap.so.adapters.network"); - test("org.onap.so.adapters.vnf"); - test("org.onap.so.adapters.valet"); - test("org.onap.so.adapters.valet.beans"); - test("org.onap.so.vdu.utils"); - } - - private void test(String pojoPackage) { - Validator validator = ValidatorBuilder.create() - .with(new NoStaticExceptFinalRule()) - .with(new SerializableMustHaveSerialVersionUIDRule()) - .with(new NoPublicFieldsExceptStaticFinalRule()) - .with(new SetterTester()) - .with(new GetterTester()) - .with(new ToStringTester()) - - .build(); - - - validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses,enumFilter,new FilterNonConcrete(), noNestedClasses, new FilterBeans()); - } - private static class FilterTestClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.getSourcePath().contains("/test-classes/"); - } - } - - private static class FilterTestNestedClasses implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return !pojoClass.isNestedClass(); - } - } - - private static class FilterBeans implements PojoClassFilter { - public boolean include(PojoClass pojoClass) { - return pojoClass.getAnnotations().stream().filter(o -> o instanceof Component).count() <= 0; - } - } + private final PojoClassFilter filterTestClasses = new FilterTestClasses(); + + private final PojoClassFilter enumFilter = new FilterEnum(); + + private final PojoClassFilter noNestedClasses = new FilterTestNestedClasses(); + + + + @Test + public void pojoStructure() { + test("org.onap.so.adapters.network.async.client"); + test("org.onap.so.adapters.vnf.async.client"); + test("org.onap.so.adapters.network"); + test("org.onap.so.adapters.vnf"); + test("org.onap.so.adapters.valet"); + test("org.onap.so.adapters.valet.beans"); + test("org.onap.so.vdu.utils"); + } + + private void test(String pojoPackage) { + Validator validator = ValidatorBuilder.create().with(new NoStaticExceptFinalRule()) + .with(new SerializableMustHaveSerialVersionUIDRule()).with(new NoPublicFieldsExceptStaticFinalRule()) + .with(new SetterTester()).with(new GetterTester()).with(new ToStringTester()) + + .build(); + + + validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, enumFilter, new FilterNonConcrete(), + noNestedClasses, new FilterBeans()); + } + + private static class FilterTestClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.getSourcePath().contains("/test-classes/"); + } + } + + private static class FilterTestNestedClasses implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return !pojoClass.isNestedClass(); + } + } + + private static class FilterBeans implements PojoClassFilter { + public boolean include(PojoClass pojoClass) { + return pojoClass.getAnnotations().stream().filter(o -> o instanceof Component).count() <= 0; + } + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditCreateStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditCreateStackServiceTest.java deleted file mode 100644 index bcf126d887..0000000000 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditCreateStackServiceTest.java +++ /dev/null @@ -1,150 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.adapters.audit; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.doReturn; - -import java.io.IOException; -import java.util.Optional; - -import org.camunda.bpm.client.task.ExternalTask; -import org.camunda.bpm.client.task.ExternalTaskService; -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.MockitoAnnotations; -import org.onap.aai.domain.yang.LInterface; -import org.onap.so.audit.beans.AuditInventory; -import org.springframework.core.env.Environment; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; - -public class AuditCreateStackServiceTest extends AuditCreateStackService { - - @InjectMocks - AuditCreateStackService auditStackService = new AuditCreateStackService(); - - @Mock - HeatStackAudit heatStackAuditMock; - - @Mock - Environment mockEnv; - - @Mock - ExternalTask mockExternalTask; - - @Mock - ExternalTaskService mockExternalTaskService; - - AuditInventory auditInventory = new AuditInventory(); - - @Before - public void setup() { - auditInventory.setCloudOwner("cloudOwner"); - auditInventory.setCloudRegion("cloudRegion"); - auditInventory.setTenantId("tenantId"); - auditInventory.setHeatStackName("stackName"); - MockitoAnnotations.initMocks(this); - doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory"); - doReturn("6000").when(mockEnv).getProperty("mso.workflow.topics.retryMultiplier","6000"); - doReturn("aasdfasdf").when(mockExternalTask).getId(); - } - - @Test - public void execute_external_task_audit_success_Test() { - doReturn(true).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName"); - auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); - Mockito.verify(mockExternalTaskService).complete(mockExternalTask); - } - - @Test - public void execute_external_task_audit_first_failure_Test() { - doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName"); - doReturn(null).when(mockExternalTask).getRetries(); - auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); - Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask, - "Unable to find all VServers and L-Interaces in A&AI", - "Unable to find all VServers and L-Interaces in A&AI", 8, 10000L); - } - - @Test - public void execute_external_task_audit_intermediate_failure_Test() { - doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName"); - doReturn(6).when(mockExternalTask).getRetries(); - auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); - Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask, - "Unable to find all VServers and L-Interaces in A&AI", - "Unable to find all VServers and L-Interaces in A&AI", 5, 12000L); - - } - - @Test - public void execute_external_task_audit_final_failure_Test() { - doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName"); - doReturn(1).when(mockExternalTask).getRetries(); - auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); - Mockito.verify(mockExternalTaskService).handleBpmnError(mockExternalTask, - "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory"); - } - - @Test - public void retry_sequence_calculation_Test() { - long firstRetry = auditStackService.calculateRetryDelay(8); - assertEquals(6000L, firstRetry); - long secondRetry = auditStackService.calculateRetryDelay(7); - assertEquals(6000L, secondRetry); - long thirdRetry = auditStackService.calculateRetryDelay(6); - assertEquals(12000L, thirdRetry); - long fourthRetry = auditStackService.calculateRetryDelay(5); - assertEquals(18000L, fourthRetry); - long fifthRetry = auditStackService.calculateRetryDelay(4); - assertEquals(30000L, fifthRetry); - long sixRetry = auditStackService.calculateRetryDelay(3); - assertEquals(48000L, sixRetry); - long seventhRetry = auditStackService.calculateRetryDelay(2); - assertEquals(78000L, seventhRetry); - long eigthRetry = auditStackService.calculateRetryDelay(1); - assertEquals(120000L, eigthRetry); - } - - @Test - public void retry_sequence_Test() { - long firstRetry = auditStackService.calculateRetryDelay(8); - assertEquals(6000L, firstRetry); - long secondRetry = auditStackService.calculateRetryDelay(7); - assertEquals(6000L, secondRetry); - long thirdRetry = auditStackService.calculateRetryDelay(6); - assertEquals(12000L, thirdRetry); - long fourthRetry = auditStackService.calculateRetryDelay(5); - assertEquals(18000L, fourthRetry); - long fifthRetry = auditStackService.calculateRetryDelay(4); - assertEquals(30000L, fifthRetry); - long sixRetry = auditStackService.calculateRetryDelay(3); - assertEquals(48000L, sixRetry); - long seventhRetry = auditStackService.calculateRetryDelay(2); - assertEquals(78000L, seventhRetry); - long eigthRetry = auditStackService.calculateRetryDelay(1); - assertEquals(120000L, eigthRetry); - } -} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java new file mode 100644 index 0000000000..80b2a21419 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java @@ -0,0 +1,202 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.audit; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.doReturn; +import java.io.File; +import java.io.IOException; +import java.util.Map; +import java.util.Optional; +import org.camunda.bpm.client.task.ExternalTask; +import org.camunda.bpm.client.task.ExternalTaskService; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.so.audit.beans.AuditInventory; +import org.springframework.core.env.Environment; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class AuditStackServiceDataTest extends AuditCreateStackService { + + @InjectMocks + private AuditCreateStackService auditStackService = new AuditCreateStackService(); + + @Mock + private HeatStackAudit heatStackAuditMock; + + @Mock + private Environment mockEnv; + + @Mock + private ExternalTask mockExternalTask; + + @Mock + private ExternalTaskService mockExternalTaskService; + + private ObjectMapper objectMapper = new ObjectMapper(); + + private AuditInventory auditInventory = new AuditInventory(); + + Optional<AAIObjectAuditList> auditListOptSuccess; + + Optional<AAIObjectAuditList> auditListOptFailure; + + @Before + public void setup() throws JsonParseException, JsonMappingException, IOException { + auditInventory.setCloudOwner("cloudOwner"); + auditInventory.setCloudRegion("cloudRegion"); + auditInventory.setTenantId("tenantId"); + auditInventory.setHeatStackName("stackName"); + MockitoAnnotations.initMocks(this); + + AAIObjectAuditList auditListSuccess = objectMapper + .readValue(new File("src/test/resources/ExpectedVServerFound.json"), AAIObjectAuditList.class); + auditListOptSuccess = Optional.of(auditListSuccess); + + AAIObjectAuditList auditListFailure = objectMapper.readValue( + new File("src/test/resources/Vserver2_Found_VServer1_Not_Found.json"), AAIObjectAuditList.class); + auditListOptFailure = Optional.of(auditListFailure); + String[] retrySequence = new String[8]; + retrySequence[0] = "1"; + retrySequence[1] = "1"; + retrySequence[2] = "2"; + retrySequence[3] = "3"; + retrySequence[4] = "5"; + retrySequence[5] = "8"; + retrySequence[6] = "13"; + retrySequence[7] = "20"; + doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory"); + doReturn("6000").when(mockEnv).getProperty("mso.workflow.topics.retryMultiplier", "6000"); + doReturn(retrySequence).when(mockEnv).getProperty("mso.workflow.topics.retrySequence", String[].class); + doReturn("aasdfasdf").when(mockExternalTask).getId(); + } + + @Test + public void execute_external_task_audit_success_Test() { + doReturn(auditListOptSuccess).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", + "stackName"); + auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); + ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class); + ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class); + Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture()); + Map actualMap = captor.getValue(); + assertEquals(true, actualMap.get("auditIsSuccessful")); + assertNotNull(actualMap.get("auditInventoryResult")); + } + + @Test + public void execute_external_task_audit_first_failure_Test() { + doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", + "stackName"); + doReturn(null).when(mockExternalTask).getRetries(); + auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); + Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask, + "Unable to find all VServers and L-Interaces in A&AI", + "Unable to find all VServers and L-Interaces in A&AI", 8, 10000L); + } + + @Test + public void execute_external_task_audit_intermediate_failure_Test() { + doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", + "stackName"); + doReturn(6).when(mockExternalTask).getRetries(); + auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); + Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask, + "Unable to find all VServers and L-Interaces in A&AI", + "Unable to find all VServers and L-Interaces in A&AI", 5, 12000L); + + } + + @Test + public void execute_external_task_audit_final_failure_Test() { + doReturn(auditListOptFailure).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", + "stackName"); + doReturn(1).when(mockExternalTask).getRetries(); + auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService); + ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class); + ArgumentCaptor<ExternalTask> taskCaptor = ArgumentCaptor.forClass(ExternalTask.class); + Mockito.verify(mockExternalTaskService).complete(taskCaptor.capture(), captor.capture()); + Map actualMap = captor.getValue(); + assertEquals(false, actualMap.get("auditIsSuccessful")); + assertNotNull(actualMap.get("auditInventoryResult")); + } + + @Test + public void retry_sequence_calculation_Test() { + long firstRetry = auditStackService.calculateRetryDelay(8); + assertEquals(6000L, firstRetry); + long secondRetry = auditStackService.calculateRetryDelay(7); + assertEquals(6000L, secondRetry); + long thirdRetry = auditStackService.calculateRetryDelay(6); + assertEquals(12000L, thirdRetry); + long fourthRetry = auditStackService.calculateRetryDelay(5); + assertEquals(18000L, fourthRetry); + long fifthRetry = auditStackService.calculateRetryDelay(4); + assertEquals(30000L, fifthRetry); + long sixRetry = auditStackService.calculateRetryDelay(3); + assertEquals(48000L, sixRetry); + long seventhRetry = auditStackService.calculateRetryDelay(2); + assertEquals(78000L, seventhRetry); + long eigthRetry = auditStackService.calculateRetryDelay(1); + assertEquals(120000L, eigthRetry); + } + + @Test + public void retry_sequence_Test() { + long firstRetry = auditStackService.calculateRetryDelay(8); + assertEquals(6000L, firstRetry); + long secondRetry = auditStackService.calculateRetryDelay(7); + assertEquals(6000L, secondRetry); + long thirdRetry = auditStackService.calculateRetryDelay(6); + assertEquals(12000L, thirdRetry); + long fourthRetry = auditStackService.calculateRetryDelay(5); + assertEquals(18000L, fourthRetry); + long fifthRetry = auditStackService.calculateRetryDelay(4); + assertEquals(30000L, fifthRetry); + long sixRetry = auditStackService.calculateRetryDelay(3); + assertEquals(48000L, sixRetry); + long seventhRetry = auditStackService.calculateRetryDelay(2); + assertEquals(78000L, seventhRetry); + long eigthRetry = auditStackService.calculateRetryDelay(1); + assertEquals(120000L, eigthRetry); + } + + + @Test + public void determineAuditResult_Test() throws Exception { + boolean actual = auditStackService.didCreateAuditFail(auditListOptSuccess); + assertEquals(false, actual); + } + + @Test + public void determineAuditResult_Failure_Test() throws Exception { + boolean actual = auditStackService.didCreateAuditFail(auditListOptFailure); + assertEquals(true, actual); + } +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java index 9176b58de8..d43dbd99f9 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java @@ -13,7 +13,7 @@ * 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 + * See the License for the specific language governing perservice2sions and * limitations under the License. * ============LICENSE_END========================================================= */ @@ -24,15 +24,15 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; - import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Stream; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -48,7 +48,8 @@ import org.onap.so.client.aai.AAIResourcesClient; 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.skyscreamer.jsonassert.JSONAssert; +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; @@ -58,297 +59,312 @@ import com.woorea.openstack.heat.model.Resources; @RunWith(MockitoJUnitRunner.Silent.class) public class AuditVServerTest extends AuditVServer { - @InjectMocks - private AuditVServer auditNova = new AuditVServer(); - - @Mock - private AAIResourcesClient aaiResourcesMock; - - private String cloudOwner = "cloudOwner"; - private String cloudRegion = "cloudRegion"; - private String tenantId = "tenantId"; - - private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,cloudOwner, cloudRegion, - tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"); - - private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, - tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"); - - private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c"); - - private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "1c56a24b-5f03-435a-850d-31cd4252de56"); - - private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "12afcd28-929f-4d80-8a5a-0833bfd5e20b"); - - private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "80baec42-ffae-425f-ad8c-3f7b2c24bfff"); - - private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "13eddf95-4cf3-45f2-823a-2d890a6549b4"); - - private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db").queryParam("interface-id", "9cab2903-70f7-44fd-b681-491d6ae2adb8"); - - private AAIResourceUri test_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").queryParam("interface-id", "9cab2903-70f7-44fd-b681-491d6ae2adz1"); - - - private AAIResourceUri test_port_2_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz").queryParam("interface-id", "9cab2903-70f7-44fd-b681-491d6ae2adz2"); - - - - private AAIResourceUri service2_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "f711be16-2654-4a09-b89d-0511fda20e81"); - - private AAIResourceUri service1_sub_0_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb"); - - private AAIResourceUri service1_sub_1_uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.SUB_L_INTERFACE, - cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db","interface-name").queryParam("interface-id", "b7019dd0-2ee9-4447-bdef-ac25676b205a"); - - - - private Set<Vserver> vserversToAudit = new HashSet<>(); - - - LInterface test_port_1 = new LInterface(); - LInterface test_port_2 = new LInterface(); - LInterface ssc_1_int_ha_port_0 = new LInterface(); - LInterface service2_sub_interface_1 = new LInterface(); - LInterface ssc_1_service2_port_0 = new LInterface(); - LInterface ssc_1_mgmt_port_0 = new LInterface(); - LInterface ssc_1_mgmt_port_1 = new LInterface(); - LInterface service1_sub_interface_2 = new LInterface(); - LInterface service1_sub_interface_1 = new LInterface(); - LInterface ssc_1_service1_port_0 = new LInterface(); - LInterface ssc_1_trusted_port_0 = new LInterface(); - - LInterfaces test_port_1_plural = new LInterfaces(); - LInterfaces test_port_2_plural = new LInterfaces(); - LInterfaces ssc_1_int_ha_port_0_plural = new LInterfaces(); - LInterfaces service2_sub_interface_1_plural = new LInterfaces(); - LInterfaces ssc_1_service2_port_0_plural = new LInterfaces(); - LInterfaces ssc_1_mgmt_port_0_plural = new LInterfaces(); - LInterfaces ssc_1_mgmt_port_1_plural = new LInterfaces(); - LInterfaces service1_sub_interface_2_plural = new LInterfaces(); - LInterfaces service1_sub_interface_1_plural = new LInterfaces(); - LInterfaces ssc_1_service1_port_0_plural = new LInterfaces(); - LInterfaces ssc_1_trusted_port_0_plural = new LInterfaces(); - - - @Before - public void setup() { - auditNova.setAaiClient(aaiResourcesMock); - - Vserver vServer1= new Vserver(); - vServer1.setVserverId("3a4c2ca5-27b3-4ecc-98c5-06804867c4db"); - LInterfaces vServer1Linterfaces = new LInterfaces(); - vServer1.setLInterfaces(vServer1Linterfaces); - - ssc_1_trusted_port_0.setInterfaceId("dec8bdc7-5718-41dc-bfbb-561ff6eeb81c"); - ssc_1_trusted_port_0.setInterfaceName("interface-name"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0); - - - ssc_1_service1_port_0.setInterfaceId("1c56a24b-5f03-435a-850d-31cd4252de56"); - ssc_1_service1_port_0.setInterfaceName("interface-name"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0); - ssc_1_service1_port_0.setLInterfaces(new LInterfaces()); - - - service1_sub_interface_1.setInterfaceId("0d9cd813-2ae1-46c0-9ebb-48081f6cffbb"); - ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1); - - - service1_sub_interface_2.setInterfaceId("b7019dd0-2ee9-4447-bdef-ac25676b205a"); - ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2); - - - ssc_1_mgmt_port_1.setInterfaceId("12afcd28-929f-4d80-8a5a-0833bfd5e20b"); - ssc_1_mgmt_port_1.setInterfaceName("interface-name"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1); - - ssc_1_mgmt_port_0.setInterfaceId("80baec42-ffae-425f-ad8c-3f7b2c24bfff"); - ssc_1_mgmt_port_0.setInterfaceName("interface-name"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0); - - - ssc_1_service2_port_0.setLInterfaces(new LInterfaces()); - ssc_1_service2_port_0.setInterfaceId("13eddf95-4cf3-45f2-823a-2d890a6549b4"); - ssc_1_service2_port_0.setInterfaceName("interface-name"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0); - - - service2_sub_interface_1.setInterfaceId("f711be16-2654-4a09-b89d-0511fda20e81"); - ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1); - - - ssc_1_int_ha_port_0.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adb8"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0); - - - Vserver vServer2= new Vserver(); - vServer2.setVserverId("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"); - LInterfaces vServer2Linterfaces = new LInterfaces(); - vServer2.setLInterfaces(vServer2Linterfaces); - - test_port_1.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz1"); - test_port_1.setInterfaceName("interface-name"); - - - test_port_2.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz2"); - test_port_2.setInterfaceName("interface-name"); - - vServer2.getLInterfaces().getLInterface().add(test_port_1); - vServer2.getLInterfaces().getLInterface().add(test_port_2); - - vserversToAudit.add(vServer1); - vserversToAudit.add(vServer2); - - - test_port_1_plural.getLInterface().add(test_port_1); - test_port_2_plural.getLInterface().add(test_port_2); - ssc_1_int_ha_port_0_plural.getLInterface().add(ssc_1_int_ha_port_0); - ssc_1_service2_port_0_plural.getLInterface().add(ssc_1_service2_port_0); - ssc_1_mgmt_port_0_plural.getLInterface().add(ssc_1_mgmt_port_0); - ssc_1_mgmt_port_1_plural.getLInterface().add(ssc_1_mgmt_port_1); - ssc_1_service1_port_0_plural.getLInterface().add(ssc_1_service1_port_0); - ssc_1_trusted_port_0_plural.getLInterface().add(ssc_1_trusted_port_0); - - } - - @Test - public void audit_Vserver_Empty_HashSet() throws JsonParseException, JsonMappingException, IOException { - boolean exists = auditNova.auditAllVserversDoExist(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion); - assertEquals(false, exists); - - boolean doNotExist = auditNova.auditAllVserversDoNotExist(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion); - assertEquals(true, doNotExist); - } - - - @Test - public void audit_Vserver_Found_Test() throws JsonParseException, JsonMappingException, IOException { - doReturn(true).when(aaiResourcesMock).exists(vserverURI); - doReturn(true).when(aaiResourcesMock).exists(vserverURI2); - doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_trusted_port_0_uri); - doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service1_port_0_uri); - doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_1_uri); - doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_0_uri); - doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service2_port_0_uri); - doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_int_ha_port_0_uri); - doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_1_uri); - doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_2_uri); - - doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); - - boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(true, exists); - - boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, doNotExist); - } - - @Test - public void audit_Vserver_Found_Test_Network_Not_Found() - throws JsonParseException, JsonMappingException, IOException { - doReturn(true).when(aaiResourcesMock).exists(vserverURI); - doReturn(true).when(aaiResourcesMock).exists(vserverURI2); - doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_trusted_port_0_uri); - doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service1_port_0_uri); - doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_1_uri); - doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_mgmt_port_0_uri); - doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_service2_port_0_uri); - doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterfaces.class,ssc_1_int_ha_port_0_uri); - doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_1_uri); - doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterfaces.class,test_port_2_uri); - - doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); - - boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, exists); - - boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, doNotExist); - } - - @Test - public void audit_Vserver_Found_Test_Network_Not_Found_Second_Server() - throws JsonParseException, JsonMappingException, IOException { - doReturn(true).when(aaiResourcesMock).exists(vserverURI); - doReturn(true).when(aaiResourcesMock).exists(vserverURI2); - doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri); - doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri); - doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri); - doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri); - doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri); - doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri); - doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri); - doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri); - doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); - boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, exists); - - boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, doNotExist); - } - - @Test - public void audit_Vservers_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException { - doReturn(false).when(aaiResourcesMock).exists(vserverURI); - doReturn(false).when(aaiResourcesMock).exists(vserverURI2); - - boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, exists); - - boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(true, doNotExist); - } - - @Test - public void audit_Vserver_first_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException { - doReturn(false).when(aaiResourcesMock).exists(vserverURI); - doReturn(true).when(aaiResourcesMock).exists(vserverURI2); - doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri); - doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri); - boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, exists); - - boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, doNotExist); - } - - @Test - public void audit_Vserver_Second_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException { - doReturn(true).when(aaiResourcesMock).exists(vserverURI); - doReturn(Optional.of(ssc_1_trusted_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_trusted_port_0_uri); - doReturn(Optional.of(ssc_1_service1_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service1_port_0_uri); - doReturn(Optional.of(ssc_1_mgmt_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_1_uri); - doReturn(Optional.of(ssc_1_mgmt_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_mgmt_port_0_uri); - doReturn(Optional.of(ssc_1_service2_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_service2_port_0_uri); - doReturn(Optional.of(ssc_1_int_ha_port_0_plural)).when(aaiResourcesMock).get(LInterface.class,ssc_1_int_ha_port_0_uri); - doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri); - doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri); - doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); - doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); - doReturn(false).when(aaiResourcesMock).exists(vserverURI2); - - boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, exists); - - boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion); - assertEquals(false, doNotExist); - } + private ObjectMapper objectMapper = new ObjectMapper(); + + @InjectMocks + private AuditVServer auditNova = new AuditVServer(); + + @Mock + private AAIResourcesClient aaiResourcesMock; + + private String cloudOwner = "cloudOwner"; + private String cloudRegion = "cloudRegion"; + private String tenantId = "tenantId"; + + private AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, + tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db"); + + private AAIResourceUri vserverURI2 = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, + tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"); + + private AAIResourceUri ssc_1_trusted_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, + cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_trusted_port_0"); + + private AAIResourceUri ssc_1_service1_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, + cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0"); + + private AAIResourceUri ssc_1_mgmt_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, + cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_1"); + + private AAIResourceUri ssc_1_mgmt_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, + cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_mgmt_port_0"); + + private AAIResourceUri ssc_1_service2_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, + cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service2_port_0"); + + private AAIResourceUri ssc_1_int_ha_port_0_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, + cloudOwner, cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_int_ha_port_0"); + + private AAIResourceUri test_port_1_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner, + cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_1"); + + private AAIResourceUri test_port_2_uri = AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner, + cloudRegion, tenantId, "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz", "test_port_2"); + + private AAIResourceUri service2_sub_1_uri = + AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId, + "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service2_port_0", "service2_sub_interface_1"); + + private AAIResourceUri service1_sub_0_uri = + AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId, + "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0", "service1_sub_interface_1"); + + private AAIResourceUri service1_sub_1_uri = + AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, cloudRegion, tenantId, + "3a4c2ca5-27b3-4ecc-98c5-06804867c4db", "ssc_1_service1_port_0", "service1_sub_interface_2"); + + + + private Set<Vserver> vserversToAudit = new HashSet<>(); + + LInterface test_port_1 = new LInterface(); + LInterface test_port_2 = new LInterface(); + LInterface ssc_1_int_ha_port_0 = new LInterface(); + LInterface service2_sub_interface_1 = new LInterface(); + LInterface ssc_1_service2_port_0 = new LInterface(); + LInterface ssc_1_mgmt_port_0 = new LInterface(); + LInterface ssc_1_mgmt_port_1 = new LInterface(); + LInterface service1_sub_interface_2 = new LInterface(); + LInterface service1_sub_interface_1 = new LInterface(); + LInterface ssc_1_service1_port_0 = new LInterface(); + LInterface ssc_1_trusted_port_0 = new LInterface(); + + + + @Before + public void setup() { + objectMapper.setSerializationInclusion(Include.NON_NULL); + auditNova.setAaiClient(aaiResourcesMock); + + Vserver vServer1 = new Vserver(); + vServer1.setVserverId("3a4c2ca5-27b3-4ecc-98c5-06804867c4db"); + LInterfaces vServer1Linterfaces = new LInterfaces(); + vServer1.setLInterfaces(vServer1Linterfaces); + + ssc_1_trusted_port_0.setInterfaceId("dec8bdc7-5718-41dc-bfbb-561ff6eeb81c"); + ssc_1_trusted_port_0.setInterfaceName("ssc_1_trusted_port_0"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0); + + + ssc_1_service1_port_0.setInterfaceId("1c56a24b-5f03-435a-850d-31cd4252de56"); + ssc_1_service1_port_0.setInterfaceName("ssc_1_service1_port_0"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0); + ssc_1_service1_port_0.setLInterfaces(new LInterfaces()); + + + service1_sub_interface_1.setInterfaceId("0d9cd813-2ae1-46c0-9ebb-48081f6cffbb"); + service1_sub_interface_1.setInterfaceName("service1_sub_interface_1"); + ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1); + + + service1_sub_interface_2.setInterfaceId("b7019dd0-2ee9-4447-bdef-ac25676b205a"); + service1_sub_interface_2.setInterfaceName("service1_sub_interface_2"); + ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2); + + + ssc_1_mgmt_port_1.setInterfaceId("12afcd28-929f-4d80-8a5a-0833bfd5e20b"); + ssc_1_mgmt_port_1.setInterfaceName("ssc_1_mgmt_port_1"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1); + + ssc_1_mgmt_port_0.setInterfaceId("80baec42-ffae-425f-ad8c-3f7b2c24bfff"); + ssc_1_mgmt_port_0.setInterfaceName("ssc_1_mgmt_port_0"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0); + + + ssc_1_service2_port_0.setLInterfaces(new LInterfaces()); + ssc_1_service2_port_0.setInterfaceId("13eddf95-4cf3-45f2-823a-2d890a6549b4"); + ssc_1_service2_port_0.setInterfaceName("ssc_1_service2_port_0"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0); + + + service2_sub_interface_1.setInterfaceId("f711be16-2654-4a09-b89d-0511fda20e81"); + service2_sub_interface_1.setInterfaceName("service2_sub_interface_1"); + ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1); + + + ssc_1_int_ha_port_0.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adb8"); + ssc_1_int_ha_port_0.setInterfaceName("ssc_1_int_ha_port_0"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0); + + Vserver vServer2 = new Vserver(); + vServer2.setVserverId("3a4c2ca5-27b3-4ecc-98c5-06804867c4dz"); + LInterfaces vServer2Linterfaces = new LInterfaces(); + vServer2.setLInterfaces(vServer2Linterfaces); + + test_port_1.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz1"); + test_port_1.setInterfaceName("test_port_1"); + + + test_port_2.setInterfaceId("9cab2903-70f7-44fd-b681-491d6ae2adz2"); + test_port_2.setInterfaceName("test_port_2"); + + vServer2.getLInterfaces().getLInterface().add(test_port_1); + vServer2.getLInterfaces().getLInterface().add(test_port_2); + + vserversToAudit.add(vServer1); + vserversToAudit.add(vServer2); + } + + @Test + public void audit_Vserver_Empty_HashSet() throws JsonParseException, JsonMappingException, IOException { + Optional<AAIObjectAuditList> actual = + auditNova.auditVservers(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion); + assertEquals(Optional.empty(), actual); + } + + @Test + public void audit_Vserver_Found_Test() throws JsonParseException, JsonMappingException, IOException { + doReturn(true).when(aaiResourcesMock).exists(vserverURI); + doReturn(true).when(aaiResourcesMock).exists(vserverURI2); + doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_trusted_port_0_uri); + doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service1_port_0_uri); + doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri); + doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri); + doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service2_port_0_uri); + doReturn(Optional.of(service2_sub_interface_1)).when(aaiResourcesMock).get(LInterface.class, + service1_sub_1_uri); + doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_int_ha_port_0_uri); + doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri); + doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri); + + doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); + + Optional<AAIObjectAuditList> actual = + auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion); + String actualString = objectMapper.writeValueAsString(actual.get()); + String expected = getJson("ExpectedVServerFound.json"); + JSONAssert.assertEquals(expected, actualString, false); + } + + @Test + public void audit_Vserver_Found_Test_Network_Not_Found() + throws JsonParseException, JsonMappingException, IOException { + doReturn(true).when(aaiResourcesMock).exists(vserverURI); + doReturn(true).when(aaiResourcesMock).exists(vserverURI2); + doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_trusted_port_0_uri); + doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service1_port_0_uri); + doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri); + doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri); + doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service2_port_0_uri); + doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_int_ha_port_0_uri); + doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri); + doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri); + + doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); + + Optional<AAIObjectAuditList> actual = + auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion); + String actualString = objectMapper.writeValueAsString(actual.get()); + String expected = getJson("VServer_Found_network_Not_Found.json"); + JSONAssert.assertEquals(expected, actualString, false); + } + + @Test + public void audit_Vserver_Found_Test_Network_Not_Found_Second_Server() + throws JsonParseException, JsonMappingException, IOException { + doReturn(true).when(aaiResourcesMock).exists(vserverURI); + doReturn(true).when(aaiResourcesMock).exists(vserverURI2); + doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_trusted_port_0_uri); + doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service1_port_0_uri); + doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri); + doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri); + doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service2_port_0_uri); + doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_int_ha_port_0_uri); + doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri); + doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri); + doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); + Optional<AAIObjectAuditList> actual = + auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion); + String actualString = objectMapper.writeValueAsString(actual.get()); + String expected = getJson("VServer_Found_Network_Sec_Server_Not_Found.json"); + JSONAssert.assertEquals(expected, actualString, false); + } + + @Test + public void audit_Vserver_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException { + doReturn(false).when(aaiResourcesMock).exists(vserverURI); + doReturn(false).when(aaiResourcesMock).exists(vserverURI2); + Optional<AAIObjectAuditList> actual = + auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion); + String actualString = objectMapper.writeValueAsString(actual.get()); + String expected = getJson("Vservers_Not_Found.json"); + JSONAssert.assertEquals(expected, actualString, false); + } + + @Test + public void audit_Vserver_first_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException { + doReturn(false).when(aaiResourcesMock).exists(vserverURI); + doReturn(true).when(aaiResourcesMock).exists(vserverURI2); + doReturn(Optional.of(test_port_1)).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri); + doReturn(Optional.of(test_port_2)).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri); + Optional<AAIObjectAuditList> actual = + auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion); + String actualString = objectMapper.writeValueAsString(actual.get()); + String expected = getJson("Vserver2_Found_VServer1_Not_Found.json"); + JSONAssert.assertEquals(expected, actualString, false); + } + + + @Test + public void doesSubInterfaceExistinAAI_Test() { + AAIResourceUri subInterfaceURI = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, cloudOwner, + cloudRegion, tenantId, "vserverId", "l-interface", "sub-interface"); + + assertEquals( + "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/vserverId/l-interfaces/l-interface/l-interface/l-interfaces/l-interface/sub-interface", + subInterfaceURI.build().toString()); + } + + @Test + public void audit_Vserver_Second_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException { + doReturn(true).when(aaiResourcesMock).exists(vserverURI); + doReturn(Optional.of(ssc_1_trusted_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_trusted_port_0_uri); + doReturn(Optional.of(ssc_1_service1_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service1_port_0_uri); + doReturn(Optional.of(ssc_1_mgmt_port_1)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_1_uri); + doReturn(Optional.of(ssc_1_mgmt_port_0)).when(aaiResourcesMock).get(LInterface.class, ssc_1_mgmt_port_0_uri); + doReturn(Optional.of(ssc_1_service2_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_service2_port_0_uri); + doReturn(Optional.of(ssc_1_int_ha_port_0)).when(aaiResourcesMock).get(LInterface.class, + ssc_1_int_ha_port_0_uri); + doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, test_port_1_uri); + doReturn(Optional.empty()).when(aaiResourcesMock).get(LInterface.class, test_port_2_uri); + doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri); + doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri); + + doReturn(false).when(aaiResourcesMock).exists(vserverURI2); + Optional<AAIObjectAuditList> actual = + auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion); + String actualString = objectMapper.writeValueAsString(actual.get()); + String expected = getJson("VServer_Found_Sec_Server_Not_Found2.json"); + + JSONAssert.assertEquals(expected, actualString, false); + } + + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename))); + } + + } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java index 5eea46d09f..bc7ce53b8d 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java @@ -24,14 +24,16 @@ import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doReturn; - import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -42,212 +44,252 @@ import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.Vserver; import org.onap.so.openstack.utils.MsoHeatUtils; +import org.onap.so.openstack.utils.MsoNeutronUtils; import org.skyscreamer.jsonassert.JSONAssert; - +import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.heat.model.Resource; import com.woorea.openstack.heat.model.Resources; import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.quantum.model.Port; @RunWith(MockitoJUnitRunner.Silent.class) public class HeatStackAuditTest extends HeatStackAudit { - @InjectMocks - private HeatStackAudit heatStackAudit = new HeatStackAudit(); - - @Mock - private MsoHeatUtils msoHeatUtilsMock; - - @Mock - private AuditVServer auditVserver; - - private static final String cloudRegion = "cloudRegion"; - private static final String tenantId = "tenantId"; - - private Resources resources = new Resources(); - - private ObjectMapper objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - - private ObjectMapper stackObjectMapper = new ObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); - - @Before - public void setup() throws Exception{ - resources= objectMapper.readValue(new File("src/test/resources/GetResources.json"), Resources.class); - - } - - @Test - public void extract_proper_path_Test(){ - Optional<String> actualResult = extractStackPathFromHref("https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81"); - assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81", actualResult.get()); - } - - @Test - public void extract_proper_resources_path_Test(){ - Optional<String> actualResult = extractResourcePathFromHref("https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81"); - assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81/resources", actualResult.get()); - } - - @Test - public void extract_invalid_uri_Test(){ - Optional<String> actualResult = extractStackPathFromHref("orchestrn.com:8004/v18b44d60a6f94bdcb2738f9e//stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81"); - assertEquals(false, actualResult.isPresent()); - } - - @Test - public void createVserverSet_Test() throws Exception{ - List<Resource> novaResources = resources.getList().stream() - .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList()); - - List<Resource> resourceGroups = resources.getList().stream() - .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType())).collect(Collectors.toList()); - - Set<Vserver> expectedVservers = new HashSet<>(); - Vserver vServer1= new Vserver(); - vServer1.setVserverId("92272b67-d23f-42ca-87fa-7b06a9ec81f3"); - LInterfaces vServer1Linterfaces = new LInterfaces(); - vServer1.setLInterfaces(vServer1Linterfaces); - - LInterface ssc_1_trusted_port_0 = new LInterface(); - ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0); - - - - LInterface ssc_1_mgmt_port_1 = new LInterface(); - ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1); - - LInterface ssc_1_mgmt_port_0 = new LInterface(); - ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0); - - LInterface ssc_1_service2_port_0 = new LInterface(); - ssc_1_service2_port_0.setLInterfaces(new LInterfaces()); - ssc_1_service2_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0); - - LInterface service2_sub_interface_1 = new LInterface(); - service2_sub_interface_1.setInterfaceId("2bbfa345-33bb-495a-94b2-fb514ee1cffc"); - ssc_1_service2_port_0.getLInterfaces().getLInterface().add(service2_sub_interface_1); - - LInterface ssc_1_int_ha_port_0 = new LInterface(); - ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0); - - - LInterface ssc_1_service1_port_0 = new LInterface(); - ssc_1_service1_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0); - ssc_1_service1_port_0.setLInterfaces(new LInterfaces()); - - LInterface service1_sub_interface_0 = new LInterface(); - service1_sub_interface_0.setInterfaceId("d54dfd09-75c6-4e04-b204-909455b8f933"); - ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_0); - - LInterface service1_sub_interface_1 = new LInterface(); - service1_sub_interface_1.setInterfaceId("f7a998c0-8939-4b07-bf4a-0862e9c325e1"); - ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_1); - - LInterface service1_sub_interface_2 = new LInterface(); - service1_sub_interface_2.setInterfaceId("621c1fea-60b8-44ee-aede-c01b8b1aaa70"); - ssc_1_service1_port_0.getLInterfaces().getLInterface().add(service1_sub_interface_2); - - - expectedVservers.add(vServer1); - - - Resources service1QueryResponse = objectMapper.readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class); - doReturn(service1QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources", cloudRegion, tenantId, Resources.class); - - Resources service2QueryResponse =objectMapper.readValue(new File("src/test/resources/Service2ResourceGroupResponse.json"), Resources.class); - doReturn(service2QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources", cloudRegion, tenantId, Resources.class); - - - Stack service2StackQuerySubInt = stackObjectMapper.readValue(new File("src/test/resources/Service2SubInterface0.json"), Stack.class); - doReturn(service2StackQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", cloudRegion,tenantId, Stack.class); - Resources service2ResourceQuerySubInt = objectMapper.readValue(new File("src/test/resources/Service2SubInterface1Resources.json"), Resources.class); - doReturn(service2ResourceQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources", cloudRegion,tenantId, Resources.class); - - Stack service1StackQuerySubInt1 =stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface0.json"), Stack.class); - doReturn(service1StackQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", cloudRegion,tenantId, Stack.class); - Resources service1ResourceQuerySubInt1 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface0Resources.json"), Resources.class); - doReturn(service1ResourceQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb/resources", cloudRegion,tenantId, Resources.class); - - - Stack service1StackQuerySubInt2 =stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface1.json"), Stack.class); - doReturn(service1StackQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a", cloudRegion,tenantId, Stack.class); - Resources service1ResourceQuerySubInt2 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface1Resources.json"), Resources.class); - doReturn(service1ResourceQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a/resources", cloudRegion,tenantId, Resources.class); - - Stack service1StackQuerySubInt3 =stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface2.json"), Stack.class); - doReturn(service1StackQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c", cloudRegion,tenantId, Stack.class); - Resources service1ResourceQuerySubInt3 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class); - doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", cloudRegion,tenantId, Resources.class); - - Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources); - Set<Vserver> vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit); - - String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces); - String expectedValue = objectMapper.writeValueAsString(expectedVservers); - - JSONAssert.assertEquals(expectedValue, actualValue, false); - } - - @Test - public void auditHeatStackNoServers_Test() throws Exception{ - - - Resources getResource = objectMapper.readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class); - doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName"); - - boolean actual = heatStackAudit.auditHeatStackCreate(cloudRegion, "cloudOwner", tenantId, "heatStackName"); - assertEquals(true, actual); - } - - - @Test - public void findInterfaceInformation_Test(){ - List<Resource> novaResources = resources.getList().stream() - .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList()); - Set<Vserver> expectedVservers = new HashSet<>(); - Vserver vServer1= new Vserver(); - vServer1.setVserverId("92272b67-d23f-42ca-87fa-7b06a9ec81f3"); - LInterfaces vServer1Linterfaces = new LInterfaces(); - vServer1.setLInterfaces(vServer1Linterfaces); - - LInterface ssc_1_trusted_port_0 = new LInterface(); - ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0); - - LInterface ssc_1_service1_port_0 = new LInterface(); - ssc_1_service1_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_service1_port_0); - - LInterface ssc_1_mgmt_port_1 = new LInterface(); - ssc_1_mgmt_port_1.setInterfaceId("07f5b14c-147a-4d14-8c94-a9e94dbc097b"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1); - - LInterface ssc_1_mgmt_port_0 = new LInterface(); - ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0); - - LInterface ssc_1_service2_port_0 = new LInterface(); - ssc_1_service2_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_service2_port_0); - - LInterface ssc_1_int_ha_port_0 = new LInterface(); - ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3"); - vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0); - - expectedVservers.add(vServer1); - - Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources); - - assertThat(actualVservers, sameBeanAs(expectedVservers)); - } + @InjectMocks + private HeatStackAudit heatStackAudit = new HeatStackAudit(); + + @Mock + private MsoHeatUtils msoHeatUtilsMock; + + @Mock + private MsoNeutronUtils neutronUtilsMock; + + @Mock + private AuditVServer auditVserver; + + private static final String cloudRegion = "cloudRegion"; + private static final String tenantId = "tenantId"; + + private Resources resources = new Resources(); + + private ObjectMapper objectMapper = + new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) + .setSerializationInclusion(Include.NON_NULL); + + private ObjectMapper stackObjectMapper = new ObjectMapper() + .configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true).setSerializationInclusion(Include.NON_NULL); + + private List<Optional<Port>> portList = new ArrayList<>(); + + @Before + public void setup() throws Exception { + resources = objectMapper.readValue(new File("src/test/resources/GetResources.json"), Resources.class); + Port neutronPort1 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort1.json"), Port.class); + doReturn(Optional.of(neutronPort1)).when(neutronUtilsMock) + .getNeutronPort("7ee06d9d-3d18-411c-9d3e-aec930f70413", cloudRegion, tenantId); + Port neutronPort2 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort2.json"), Port.class); + doReturn(Optional.of(neutronPort2)).when(neutronUtilsMock) + .getNeutronPort("27391d94-33af-474a-927d-d409249e8fd3", cloudRegion, tenantId); + Port neutronPort3 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort3.json"), Port.class); + doReturn(Optional.of(neutronPort3)).when(neutronUtilsMock) + .getNeutronPort("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", cloudRegion, tenantId); + Port neutronPort4 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort4.json"), Port.class); + doReturn(Optional.of(neutronPort4)).when(neutronUtilsMock) + .getNeutronPort("8d93f63e-e972-48c7-ad98-b2122da47315", cloudRegion, tenantId); + Port neutronPort5 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort5.json"), Port.class); + doReturn(Optional.of(neutronPort5)).when(neutronUtilsMock) + .getNeutronPort("0594a2f2-7ea4-42eb-abc2-48ea49677fca", cloudRegion, tenantId); + Port neutronPort6 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort6.json"), Port.class); + doReturn(Optional.of(neutronPort6)).when(neutronUtilsMock) + .getNeutronPort("00bb8407-650e-48b5-b919-33b88d6f8fe3", cloudRegion, tenantId); + + + portList.add(Optional.empty()); + portList.add(Optional.of(neutronPort1)); + portList.add(Optional.of(neutronPort2)); + portList.add(Optional.of(neutronPort3)); + portList.add(Optional.of(neutronPort4)); + portList.add(Optional.of(neutronPort5)); + portList.add(Optional.of(neutronPort6)); + } + + @Test + public void extract_proper_path_Test() { + Optional<String> actualResult = extractStackPathFromHref( + "https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81"); + assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81", actualResult.get()); + } + + @Test + public void extract_proper_resources_path_Test() { + Optional<String> actualResult = extractResourcePathFromHref( + "https://orchestration.com:8004/v1/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81"); + assertEquals("/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81/resources", actualResult.get()); + } + + @Test + public void extract_invalid_uri_Test() { + Optional<String> actualResult = extractStackPathFromHref( + "orchestrn.com:8004/v18b44d60a6f94bdcb2738f9e//stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81"); + assertEquals(false, actualResult.isPresent()); + } + + @Test + public void createVserverSet_Test() throws Exception { + List<Resource> novaResources = resources.getList().stream().filter(p -> "OS::Nova::Server".equals(p.getType())) + .collect(Collectors.toList()); + + List<Resource> resourceGroups = resources.getList().stream() + .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType())).collect(Collectors.toList()); + + Resources service1QueryResponse = objectMapper + .readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class); + doReturn(service1QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources", + cloudRegion, tenantId, Resources.class); + + Resources service2QueryResponse = objectMapper + .readValue(new File("src/test/resources/Service2ResourceGroupResponse.json"), Resources.class); + doReturn(service2QueryResponse).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources", + cloudRegion, tenantId, Resources.class); + + + Stack service2StackQuerySubInt = + stackObjectMapper.readValue(new File("src/test/resources/Service2SubInterface0.json"), Stack.class); + doReturn(service2StackQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + cloudRegion, tenantId, Stack.class); + Resources service2ResourceQuerySubInt = objectMapper + .readValue(new File("src/test/resources/Service2SubInterface1Resources.json"), Resources.class); + doReturn(service2ResourceQuerySubInt).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources", + cloudRegion, tenantId, Resources.class); + + Stack service1StackQuerySubInt1 = + stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface0.json"), Stack.class); + doReturn(service1StackQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + cloudRegion, tenantId, Stack.class); + Resources service1ResourceQuerySubInt1 = objectMapper + .readValue(new File("src/test/resources/Service1SubInterface0Resources.json"), Resources.class); + doReturn(service1ResourceQuerySubInt1).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb/resources", + cloudRegion, tenantId, Resources.class); + + + Stack service1StackQuerySubInt2 = + stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface1.json"), Stack.class); + doReturn(service1StackQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a", + cloudRegion, tenantId, Stack.class); + Resources service1ResourceQuerySubInt2 = objectMapper + .readValue(new File("src/test/resources/Service1SubInterface1Resources.json"), Resources.class); + doReturn(service1ResourceQuerySubInt2).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a/resources", + cloudRegion, tenantId, Resources.class); + + Stack service1StackQuerySubInt3 = + stackObjectMapper.readValue(new File("src/test/resources/Service1SubInterface2.json"), Stack.class); + doReturn(service1StackQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c", + cloudRegion, tenantId, Stack.class); + Resources service1ResourceQuerySubInt3 = objectMapper + .readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class); + doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest( + "/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", + cloudRegion, tenantId, Resources.class); + + Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources, portList); + Set<Vserver> vserversWithSubInterfaces = + heatStackAudit.processSubInterfaces(cloudRegion, tenantId, resourceGroups, vServersToAudit); + + String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces); + String expectedValue = getJson("ExpectedVserversToAudit.json"); + JSONAssert.assertEquals(expectedValue, actualValue, false); + } + + @Test + public void auditHeatStackNoServers_Test() throws Exception { + Resources getResource = objectMapper + .readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class); + doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName", 3); + + Optional<AAIObjectAuditList> actual = + heatStackAudit.auditHeatStack(cloudRegion, "cloudOwner", tenantId, "heatStackName"); + assertEquals(true, actual.get().getAuditList().isEmpty()); + } + + @Test + public void auditHeatStackNestedServers_Test() throws Exception { + Resources getResource = + objectMapper.readValue(new File("src/test/resources/GetNestedResources.json"), Resources.class); + List<Resource> novaResources = getResource.getList().stream() + .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList()); + List<Resource> resourceGroups = getResource.getList().stream() + .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType())).collect(Collectors.toList()); + + doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion, tenantId, "heatStackName", 3); + Set<Vserver> vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources, portList); + Set<Vserver> vserversWithSubInterfaces = + heatStackAudit.processSubInterfaces(cloudRegion, tenantId, resourceGroups, vServersToAudit); + String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces); + String expectedValue = getJson("NestedExpectedValue.json"); + JSONAssert.assertEquals(expectedValue, actualValue, false); + } + + + @Test + public void findInterfaceInformation_Test() { + List<Resource> novaResources = resources.getList().stream().filter(p -> "OS::Nova::Server".equals(p.getType())) + .collect(Collectors.toList()); + Set<Vserver> expectedVservers = new HashSet<>(); + Vserver vServer1 = new Vserver(); + vServer1.setVserverId("92272b67-d23f-42ca-87fa-7b06a9ec81f3"); + LInterfaces vServer1Linterfaces = new LInterfaces(); + vServer1.setLInterfaces(vServer1Linterfaces); + + LInterface ssc_1_trusted_port_0 = new LInterface(); + ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413"); + ssc_1_trusted_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0); + + LInterface ssc_1_svc2_port_0 = new LInterface(); + ssc_1_svc2_port_0.setInterfaceId("27391d94-33af-474a-927d-d409249e8fd3"); + ssc_1_svc2_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_svc2_port_0); + + LInterface ssc_1_mgmt_port_1 = new LInterface(); + ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943"); + ssc_1_mgmt_port_1.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1); + + LInterface ssc_1_mgmt_port_0 = new LInterface(); + ssc_1_mgmt_port_0.setInterfaceId("8d93f63e-e972-48c7-ad98-b2122da47315"); + ssc_1_mgmt_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_0); + + LInterface ssc_1_svc1_port_0 = new LInterface(); + ssc_1_svc1_port_0.setInterfaceId("0594a2f2-7ea4-42eb-abc2-48ea49677fca"); + ssc_1_svc1_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_svc1_port_0); + + LInterface ssc_1_int_ha_port_0 = new LInterface(); + ssc_1_int_ha_port_0.setInterfaceId("00bb8407-650e-48b5-b919-33b88d6f8fe3"); + ssc_1_int_ha_port_0.setInterfaceName("ibcx0026v_ibcx0026vm003_untrusted_port"); + vServer1.getLInterfaces().getLInterface().add(ssc_1_int_ha_port_0); + + expectedVservers.add(vServer1); + + Set<Vserver> actualVservers = heatStackAudit.createVserverSet(resources, novaResources, portList); + assertThat(actualVservers, sameBeanAs(expectedVservers)); + } + private String getJson(String filename) throws IOException { + return new String(Files.readAllBytes(Paths.get("src/test/resources/" + filename))); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java new file mode 100644 index 0000000000..0fd2bd4b7f --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateAAIInventoryTest.java @@ -0,0 +1,122 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.inventory.create; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.times; +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import org.camunda.bpm.client.task.ExternalTask; +import org.hamcrest.Matchers; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.Mockito; +import org.mockito.MockitoAnnotations; +import org.onap.so.adapters.audit.AAIObjectAuditList; +import org.onap.so.audit.beans.AuditInventory; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIUriFactory; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class CreateAAIInventoryTest extends CreateAAIInventory { + + @InjectMocks + private CreateAAIInventory createAAIInventory = new CreateAAIInventory(); + + @Mock + private ExternalTask mockExternalTask; + + @Mock + private AAIResourcesClient mockClient; + + private ObjectMapper objectMapper = new ObjectMapper(); + + private AuditInventory auditInventory = new AuditInventory(); + + AAIObjectAuditList auditListSuccess; + + AAIObjectAuditList auditListFailure; + + AAIObjectAuditList missingSubInterfaces; + + @Before + public void setup() throws JsonParseException, JsonMappingException, IOException { + auditInventory.setCloudOwner("cloudOwner"); + auditInventory.setCloudRegion("cloudRegion"); + auditInventory.setTenantId("tenantId"); + auditInventory.setHeatStackName("stackName"); + MockitoAnnotations.initMocks(this); + auditListSuccess = objectMapper.readValue(new File("src/test/resources/ExpectedVServerFound.json"), + AAIObjectAuditList.class); + auditListFailure = objectMapper.readValue(new File("src/test/resources/Vserver2_Found_VServer1_Not_Found.json"), + AAIObjectAuditList.class); + missingSubInterfaces = objectMapper.readValue(new File("src/test/resources/AuditResultsMissSub.json"), + AAIObjectAuditList.class); + doReturn(auditInventory).when(mockExternalTask).getVariable("auditInventory"); + } + + @Test + public void determineAuditResult_Test() throws Exception { + boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListSuccess); + assertEquals(false, actual); + } + + @Test + public void determineAuditResult_Failure_Test() throws Exception { + boolean actual = createAAIInventory.didAuditFailVserverLInterfaces(auditListFailure); + assertEquals(true, actual); + } + + @Test + public void missing_Sub_Interfaces_Test() throws Exception { + AAIResourceUri aaiURI2 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, "cloudOwner", + "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "tsbc0005v_tsbc0005vm002_svc1_port_0", "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81"); + AAIResourceUri aaiURI1 = AAIUriFactory.createResourceUri(AAIObjectType.SUB_L_INTERFACE, "cloudOwner", + "regionOne", "0422ffb57ba042c0800a29dc85ca70f8", "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "tsbc0005v_tsbc0005vm002_svc2_port_0", "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103"); + ArgumentCaptor<Optional> captor = ArgumentCaptor.forClass(Optional.class); + ArgumentCaptor<AAIResourceUri> uriCaptor = ArgumentCaptor.forClass(AAIResourceUri.class); + + createAAIInventory.setAaiClient(mockClient); + createAAIInventory.createInventory(missingSubInterfaces); + Mockito.verify(mockClient, times(2)).createIfNotExists(uriCaptor.capture(), captor.capture()); + + List<AAIResourceUri> capturedURI = uriCaptor.getAllValues(); + assertTrue(capturedURI.stream().anyMatch(item -> aaiURI1.build().toString().equals(item.build().toString()))); + assertTrue(capturedURI.stream().anyMatch(item -> aaiURI2.build().toString().equals(item.build().toString()))); + + + + } +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java index d552f8d893..66cee2d804 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java @@ -19,6 +19,7 @@ */ package org.onap.so.adapters.msoopenstackadapters; + import ch.vorburger.exec.ManagedProcessException; import ch.vorburger.mariadb4j.DBConfigurationBuilder; import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; @@ -40,21 +41,16 @@ public class EmbeddedMariaDbConfig { @Bean DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService, - @Value("${mariaDB4j.databaseName}") String databaseName, - @Value("${spring.datasource.username}") String datasourceUsername, - @Value("${spring.datasource.password}") String datasourcePassword, - @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { - //Create our database with default root user and no password + @Value("${mariaDB4j.databaseName}") String databaseName, + @Value("${spring.datasource.username}") String datasourceUsername, + @Value("${spring.datasource.password}") String datasourcePassword, + @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException { + // Create our database with default root user and no password mariaDB4jSpringService.getDB().createDB(databaseName); DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration(); - return DataSourceBuilder - .create() - .username(datasourceUsername) - .password(datasourcePassword) - .url(config.getURL(databaseName)) - .driverClassName(datasourceDriver) - .build(); + return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword) + .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build(); } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java index 4df9a7af6d..61a8f627a6 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/HealthCheckHandlerTest.java @@ -21,9 +21,7 @@ package org.onap.so.adapters.msoopenstackadapters; import static org.junit.Assert.assertEquals; - import javax.ws.rs.core.Response; - import org.json.JSONException; import org.junit.Test; import org.onap.so.adapters.vnf.BaseRestTestUtils; @@ -33,15 +31,15 @@ import org.springframework.http.ResponseEntity; public class HealthCheckHandlerTest extends BaseRestTestUtils { - @Test - public void testHealthcheckVnf() throws JSONException { + @Test + public void testHealthcheckVnf() throws JSONException { + + HttpEntity<String> entity = new HttpEntity<String>(null, headers); - HttpEntity<String> entity = new HttpEntity<String>(null, headers); + ResponseEntity<String> response = + restTemplate.exchange(createURLWithPort("/manage/health"), HttpMethod.GET, entity, String.class); - ResponseEntity<String> response = restTemplate.exchange(createURLWithPort("/manage/health"), - HttpMethod.GET, entity, String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } - } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java index be76a9e365..8d1dd8b69a 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/TestRestTemplateFactory.java @@ -22,7 +22,6 @@ package org.onap.so.adapters.msoopenstackadapters; import java.util.ArrayList; import java.util.List; - import org.onap.so.client.policy.JettisonStyleMapperProvider; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.web.client.TestRestTemplate; @@ -34,17 +33,18 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert @Configuration public class TestRestTemplateFactory { - @Autowired - private JettisonStyleMapperProvider objectMapper; + @Autowired + private JettisonStyleMapperProvider objectMapper; - @Bean("JettisonStyle") - public TestRestTemplate createRestTemplate() { - TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); - List<HttpMessageConverter<?>> messageConverters = new ArrayList<>(); - MappingJackson2HttpMessageConverter jsonMessageConverter = new MappingJackson2HttpMessageConverter(); - jsonMessageConverter.setObjectMapper(objectMapper.getMapper()); - restTemplate.getRestTemplate().getMessageConverters().removeIf(m -> m.getClass().getName().equals(MappingJackson2HttpMessageConverter.class.getName())); - restTemplate.getRestTemplate().getMessageConverters().add(jsonMessageConverter); - return restTemplate; - } + @Bean("JettisonStyle") + public TestRestTemplate createRestTemplate() { + TestRestTemplate restTemplate = new TestRestTemplate("test", "test"); + List<HttpMessageConverter<?>> messageConverters = new ArrayList<>(); + MappingJackson2HttpMessageConverter jsonMessageConverter = new MappingJackson2HttpMessageConverter(); + jsonMessageConverter.setObjectMapper(objectMapper.getMapper()); + restTemplate.getRestTemplate().getMessageConverters() + .removeIf(m -> m.getClass().getName().equals(MappingJackson2HttpMessageConverter.class.getName())); + restTemplate.getRestTemplate().getMessageConverters().add(jsonMessageConverter); + return restTemplate; + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java index 46bf21722c..dd59121a39 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefSeqTest.java @@ -21,16 +21,14 @@ package org.onap.so.adapters.network; import static org.junit.Assert.assertTrue; - import org.junit.Test; public class ContrailPolicyRefSeqTest { - @Test - public void ContrailPolicyRefSeqJson_Test() - { - ContrailPolicyRefSeq cprs = new ContrailPolicyRefSeq("majorVersion 1","minorVersion 0.02"); - assertTrue(cprs.toString().contains("majorVersion 1")); - assertTrue(cprs.toString().contains("minorVersion 0.02")); - } - + @Test + public void ContrailPolicyRefSeqJson_Test() { + ContrailPolicyRefSeq cprs = new ContrailPolicyRefSeq("majorVersion 1", "minorVersion 0.02"); + assertTrue(cprs.toString().contains("majorVersion 1")); + assertTrue(cprs.toString().contains("minorVersion 0.02")); + } + } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java index 7a0f3d0551..e8e14417c0 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailPolicyRefTest.java @@ -21,19 +21,17 @@ package org.onap.so.adapters.network; import static org.junit.Assert.assertTrue; - import org.junit.Test; public class ContrailPolicyRefTest { - @Test - public void ContrailPolicyRef_Test() - { - ContrailPolicyRef ref = new ContrailPolicyRef(); - ref.populate("majorVersion 1", "minorVersion 0.02"); - String strJson = ref.toJsonString(); - assertTrue(strJson.contains("majorVersion 1")); - assertTrue(strJson.contains("minorVersion 0.02")); - } - -}
\ No newline at end of file + @Test + public void ContrailPolicyRef_Test() { + ContrailPolicyRef ref = new ContrailPolicyRef(); + ref.populate("majorVersion 1", "minorVersion 0.02"); + String strJson = ref.toJsonString(); + assertTrue(strJson.contains("majorVersion 1")); + assertTrue(strJson.contains("minorVersion 0.02")); + } + +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java index ca8a45e8dc..eb8395cd9b 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRouteTest.java @@ -1,26 +1,20 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.network; import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.onap.so.openstack.beans.HostRoute; @@ -28,6 +22,7 @@ public class ContrailSubnetHostRouteTest { private ContrailSubnetHostRoute cshr = new ContrailSubnetHostRoute(); HostRoute hr = new HostRoute(); + @Test public void testContrailSubnetHostRoute() { diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java index fd17c37e6d..eb8912f56d 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/ContrailSubnetHostRoutesTest.java @@ -1,29 +1,22 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.network; import static org.junit.Assert.*; - import java.util.List; - import org.junit.Test; public class ContrailSubnetHostRoutesTest { @@ -31,6 +24,7 @@ public class ContrailSubnetHostRoutesTest { ContrailSubnetHostRoutes cshr = new ContrailSubnetHostRoutes(); List<ContrailSubnetHostRoute> host_routes; StringBuilder buf = new StringBuilder(); + @Test public void testContrailSubnetHostRoutes() { cshr.setHost_routes(host_routes); diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java index 707af7b6be..4dcb7c8710 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java @@ -27,13 +27,11 @@ import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; import org.springframework.web.util.UriComponentsBuilder; - import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; - import static org.junit.Assert.assertEquals; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteNeutronNetwork; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackDeleteStack_200; @@ -57,419 +55,455 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackPost; public class MSONetworkAdapterImplTest extends BaseRestTestUtils { - public static final String NETWORK_ID = "43173f6a-d699-414b-888f-ab243dda6dfe"; - public static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; + public static final String NETWORK_ID = "43173f6a-d699-414b-888f-ab243dda6dfe"; + public static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; + + @Test + public void createNetworkByModelNameNeutronModeGetNetworkException() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - @Test - public void createNetworkByModelNameNeutronModeGetNetworkException() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); + mockOpenstackGet(wireMockServer, "/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR); - mockOpenstackGet("/mockPublicUrl/v2.0/networks",HttpStatus.SC_INTERNAL_SERVER_ERROR); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameNeutronModeCreateNetworkException() throws IOException { - @Test - public void createNetworkByModelNameNeutronModeCreateNetworkException() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetAllNeutronNetworks_404(wireMockServer); - mockOpenStackGetAllNeutronNetworks_404(); + mockOpenstackPost(wireMockServer, "/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR); - mockOpenstackPost("/mockPublicUrl/v2.0/networks", HttpStatus.SC_INTERNAL_SERVER_ERROR); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameNeutronMode() throws IOException { - @Test - public void createNetworkByModelNameNeutronMode() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetNeutronNetwork_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetAllNeutronNetworks_404(wireMockServer); - mockOpenStackGetAllNeutronNetworks_404(); + mockOpenStackPostNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json"); - mockOpenStackPostNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException { - @Test - public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json"); - mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameAlreadyExistNeutronModeFailIfExistTrue() throws IOException { - @Test - public void createNetworkByModelNameAlreadyExistNeutronModeFailIfExistTrue() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetAllNeutronNetworks_200(wireMockServer, "OpenstackGetNeutronNetworks.json"); - mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_NEUTRON_Mode_Fail_If_Exist_True.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameHeatMode() throws IOException { - @Test - public void createNetworkByModelNameHeatMode() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json"); - mockOpenStackPostStack_200("OpenstackResponse_Stack.json"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "dvspg-VCE_VPE-mtjnj40avbc/stackId"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc/stackId"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameAlreadyExistHeatMode() throws IOException { - @Test - public void createNetworkByModelNameAlreadyExistHeatMode() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json"); - mockOpenStackPostStack_200("OpenstackResponse_Stack.json"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameAlreadyExistHeatModeFailIfExistTrue() throws IOException { - @Test - public void createNetworkByModelNameAlreadyExistHeatModeFailIfExistTrue() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/CreateNetwork_Fail_If_Exist_True.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_Fail_If_Exist_True.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameHeatModeQueryNetworkException() throws IOException { - @Test - public void createNetworkByModelNameHeatModeQueryNetworkException() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenstackGet(wireMockServer, "/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc", + HttpStatus.SC_INTERNAL_SERVER_ERROR); - mockOpenstackGet("/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc",HttpStatus.SC_INTERNAL_SERVER_ERROR); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameHeatModeCreateNetworkException() throws IOException { - @Test - public void createNetworkByModelNameHeatModeCreateNetworkException() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetStack_404(wireMockServer, "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenstackPost(wireMockServer, "/mockPublicUrl/stacks", HttpStatus.SC_INTERNAL_SERVER_ERROR); - mockOpenstackPost("/mockPublicUrl/stacks",HttpStatus.SC_INTERNAL_SERVER_ERROR); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void createNetworkByModelNameCloudSiteNotPresentError() throws IOException { - @Test - public void createNetworkByModelNameCloudSiteNotPresentError() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack.json"); - mockOpenStackPostStack_200("OpenstackResponse_Stack.json"); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/CreateNetwork_InvalidCloudSiteId.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/CreateNetwork_InvalidCloudSiteId.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void deleteNetworkHeatModeSuccess() throws IOException { - @Test - public void deleteNetworkHeatModeSuccess() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json"); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json"); + mockOpenStackDeleteStack_200(wireMockServer); - mockOpenStackDeleteStack_200(); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "43173f6a-d699-414b-888f-ab243dda6dfe"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void deleteNetworkDeleteStackException() throws IOException { - @Test - public void deleteNetworkDeleteStackException() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json"); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json"); + mockOpenStackDeleteStack_500(wireMockServer); - mockOpenStackDeleteStack_500(); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "43173f6a-d699-414b-888f-ab243dda6dfe"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void deleteNetworkError() throws IOException { - @Test - public void deleteNetworkError() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_DeleteComplete.json"); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json"); + mockOpenStackDeleteStack_200(wireMockServer); - mockOpenStackDeleteStack_200(); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "43173f6a-d699-414b-888f-ab243dda6dfe"); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "43173f6a-d699-414b-888f-ab243dda6dfe"); + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("mtn13", ""), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("mtn13",""), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + @Test + public void deleteNetworkNeureonMode() throws IOException { - @Test - public void deleteNetworkNeureonMode() throws IOException{ + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_OK); - mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_OK); - - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), + uri, HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void deleteNetworkNeutronModeDeleteStackException() throws IOException{ + @Test + public void deleteNetworkNeutronModeDeleteStackException() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK); - mockOpenStackDeleteNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackDeleteNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_INTERNAL_SERVER_ERROR); - //mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID); + // mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/DeleteNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), + uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void updateNetworkNeutronModeSuccess() throws IOException{ + @Test + public void updateNetworkNeutronModeSuccess() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); - mockOpenStackPutNeutronNetwork_200("OpenstackCreateNeutronNetworkResponse.json",NETWORK_ID); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK); + mockOpenStackPutNeutronNetwork_200(wireMockServer, "OpenstackCreateNeutronNetworkResponse.json", NETWORK_ID); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), + uri, HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void updateNetworkNeutronUpdateException() throws IOException{ + @Test + public void updateNetworkNeutronUpdateException() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); - mockOpenStackPutNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK); + mockOpenStackPutNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_INTERNAL_SERVER_ERROR); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), + uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void updateNetworkHeatUpdateException() throws IOException{ + @Test + public void updateNetworkHeatUpdateException() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_NAME); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", NETWORK_NAME); - mockOpenStackPutStack(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackPutStack(wireMockServer, NETWORK_ID, HttpStatus.SC_INTERNAL_SERVER_ERROR); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void updateNetworkHeatQueryException() throws IOException{ + @Test + public void updateNetworkHeatQueryException() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_500(NETWORK_NAME); + mockOpenStackGetStack_500(wireMockServer, NETWORK_NAME); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void updateNetworkHeatStackNotFound() throws IOException{ + @Test + public void updateNetworkHeatStackNotFound() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_404(NETWORK_NAME); + mockOpenStackGetStack_404(wireMockServer, NETWORK_NAME); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml"), uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void updateNetworkNeutronQueryException() throws IOException{ + @Test + public void updateNetworkNeutronQueryException() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_INTERNAL_SERVER_ERROR); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), + uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void updateNetworkNeutronStackNotFound() throws IOException{ + @Test + public void updateNetworkNeutronStackNotFound() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_NOT_FOUND); + mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_NOT_FOUND); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/UpdateNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), + uri, HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void queryNetworkHeatModesuccess() throws IOException{ + @Test + public void queryNetworkHeatModesuccess() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", NETWORK_ID); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), uri, + HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void queryNetworkHeatModeQueryException() throws IOException{ + @Test + public void queryNetworkHeatModeQueryException() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetStack_500(NETWORK_ID); + mockOpenStackGetStack_500(wireMockServer, NETWORK_ID); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), uri, + HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void queryNetworkNeutronModeSuccess() throws IOException{ + @Test + public void queryNetworkNeutronModeSuccess() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK); + mockOpenStackGetNeutronNetwork(wireMockServer, "GetNeutronNetwork.json", NETWORK_ID, HttpStatus.SC_OK); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), uri, + HttpMethod.POST); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } - @Test - public void queryNetworkNeutronModeException() throws IOException{ + @Test + public void queryNetworkNeutronModeException() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); - mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR); + mockOpenStackGetNeutronNetwork(wireMockServer, NETWORK_ID, HttpStatus.SC_INTERNAL_SERVER_ERROR); - String uri = "/services/NetworkAdapter"; - headers.set("X-ECOMP-RequestID", "123456789456127"); - ResponseEntity<String> response = sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC","CONTRAIL31_GNDIRECT"), uri, HttpMethod.POST); - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - } + String uri = "/services/NetworkAdapter"; + headers.set("X-ECOMP-RequestID", "123456789456127"); + ResponseEntity<String> response = + sendXMLRequest(inputStream("/QueryNetwork.xml").replace("CONTRAIL30_BASIC", "CONTRAIL31_GNDIRECT"), uri, + HttpMethod.POST); + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + } - public ResponseEntity<String> sendXMLRequest(String requestJson, String uriPath, HttpMethod reqMethod){ - headers.set("Accept", MediaType.APPLICATION_XML); - headers.set("Content-Type", MediaType.APPLICATION_XML); + public ResponseEntity<String> sendXMLRequest(String requestJson, String uriPath, HttpMethod reqMethod) { + headers.set("Accept", MediaType.APPLICATION_XML); + headers.set("Content-Type", MediaType.APPLICATION_XML); - UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath)); + UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath)); - HttpEntity<String> request = new HttpEntity<String>(requestJson, headers); - ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(), - reqMethod, request, String.class); + HttpEntity<String> request = new HttpEntity<String>(requestJson, headers); + ResponseEntity<String> response = + restTemplate.exchange(builder.toUriString(), reqMethod, request, String.class); - return response; - } + return response; + } - public String inputStream(String JsonInput)throws IOException{ - JsonInput = "src/test/resources/" + JsonInput; - String input = new String(Files.readAllBytes(Paths.get(JsonInput))); - return input; - } + public String inputStream(String JsonInput) throws IOException { + JsonInput = "src/test/resources/" + JsonInput; + String input = new String(Files.readAllBytes(Paths.get(JsonInput))); + return input; + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java index f8dcddde04..727f18902a 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java @@ -20,22 +20,9 @@ package org.onap.so.adapters.network; -import org.apache.http.HttpStatus; -import org.junit.Test; -import org.onap.so.adapters.vnf.BaseRestTestUtils; -import org.onap.so.entity.MsoRequest; -import org.onap.so.openstack.beans.NetworkRollback; -import org.onap.so.openstack.beans.Subnet; -import org.springframework.beans.factory.annotation.Autowired; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; - import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.onap.so.bpmn.mock.StubOpenStack.getBodyFromFile; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackCreatedVUSP_200; @@ -44,235 +31,236 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackDeleteOrU import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostStacks_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessQueryNetwork; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import org.apache.http.HttpStatus; +import org.junit.Test; +import org.onap.so.adapters.vnf.BaseRestTestUtils; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.NetworkRollback; +import org.onap.so.openstack.beans.Subnet; +import org.springframework.beans.factory.annotation.Autowired; public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils { - @Autowired - MsoNetworkAdapterAsyncImpl impl; + @Autowired + MsoNetworkAdapterAsyncImpl impl; - @Test - public void healthCheckATest() { - MsoNetworkAdapterAsyncImpl mNAAimpl = new MsoNetworkAdapterAsyncImpl(); - mNAAimpl.healthCheckA(); - } + @Test + public void healthCheckATest() { + MsoNetworkAdapterAsyncImpl mNAAimpl = new MsoNetworkAdapterAsyncImpl(); + mNAAimpl.healthCheckA(); + } - @Test - public void rollbackNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse() - .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + - " <soapenv:Header/>\n" + - " <soapenv:Body>\n" + - " <net:rollbackNetworkNotificationResponse>\n" + - " </net:rollbackNetworkNotificationResponse>\n" + - " </soapenv:Body>\n" + - "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - NetworkRollback nrb = getNetworkRollback("mtn13"); - impl.rollbackNetworkA(nrb, "messageId", "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void rollbackNetworkATest() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) + .withRequestBody(containing("<completed>true</completed>")) + .willReturn(aResponse().withBody( + "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + + " <soapenv:Header/>\n" + " <soapenv:Body>\n" + + " <net:rollbackNetworkNotificationResponse>\n" + + " </net:rollbackNetworkNotificationResponse>\n" + " </soapenv:Body>\n" + + "</soapenv:Envelope>") + .withStatus(HttpStatus.SC_OK))); + NetworkRollback nrb = getNetworkRollback("mtn13"); + impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void rollbackNetworkATest_NotifyException() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse() - .withStatus(HttpStatus.SC_NOT_FOUND))); - NetworkRollback nrb = getNetworkRollback("mtn13"); - impl.rollbackNetworkA(nrb, "messageId", "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void rollbackNetworkATest_NotifyException() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor( + post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>")) + .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); + NetworkRollback nrb = getNetworkRollback("mtn13"); + impl.rollbackNetworkA(nrb, "messageId", "http://localhost:" + wireMockPort + "/notificationUrl"); + } - private NetworkRollback getNetworkRollback(String cloudId) { - NetworkRollback nrb = new NetworkRollback(); - nrb.setCloudId(cloudId); - nrb.setMsoRequest(new MsoRequest()); - nrb.setModelCustomizationUuid("3bdbb104-476c-483e-9f8b-c095b3d3068c"); - nrb.setNetworkCreated(true); - nrb.setNetworkId("networkId"); - nrb.setNetworkName("networkName"); - nrb.setNetworkStackId("networkStackId"); - nrb.setNetworkType("networkType"); - nrb.setNeutronNetworkId("neutronNetworkId"); - nrb.setPhysicalNetwork("physicalNetwork"); - nrb.setTenantId("tenantId"); - nrb.setVlans(new ArrayList<>()); - return nrb; - } + private NetworkRollback getNetworkRollback(String cloudId) { + NetworkRollback nrb = new NetworkRollback(); + nrb.setCloudId(cloudId); + nrb.setMsoRequest(new MsoRequest()); + nrb.setModelCustomizationUuid("3bdbb104-476c-483e-9f8b-c095b3d3068c"); + nrb.setNetworkCreated(true); + nrb.setNetworkId("networkId"); + nrb.setNetworkName("networkName"); + nrb.setNetworkStackId("networkStackId"); + nrb.setNetworkType("networkType"); + nrb.setNeutronNetworkId("neutronNetworkId"); + nrb.setPhysicalNetwork("physicalNetwork"); + nrb.setTenantId("tenantId"); + nrb.setVlans(new ArrayList<>()); + return nrb; + } - @Test - public void rollbackNetworkATestNetworkException() { - NetworkRollback nrb = getNetworkRollback("cloudId"); + @Test + public void rollbackNetworkATestNetworkException() { + NetworkRollback nrb = getNetworkRollback("cloudId"); - impl.rollbackNetworkA(nrb, "messageId", "http://localhost"); - } + impl.rollbackNetworkA(nrb, "messageId", "http://localhost"); + } - @Test - public void noRollbackNetworkATest() { - impl.rollbackNetworkA(null, "messageId", "http://localhost"); - } + @Test + public void noRollbackNetworkATest() { + impl.rollbackNetworkA(null, "messageId", "http://localhost"); + } - @Test - public void deleteNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse() - .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + - " <soapenv:Header/>\n" + - " <soapenv:Body>\n" + - " <net:deleteNetworkNotificationResponse>\n" + - " </net:deleteNetworkNotificationResponse>\n" + - " </soapenv:Body>\n" + - "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", - "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void deleteNetworkATest() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) + .withRequestBody(containing("<completed>true</completed>")) + .willReturn(aResponse().withBody( + "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + + " <soapenv:Header/>\n" + " <soapenv:Body>\n" + + " <net:deleteNetworkNotificationResponse>\n" + + " </net:deleteNetworkNotificationResponse>\n" + " </soapenv:Body>\n" + + "</soapenv:Envelope>") + .withStatus(HttpStatus.SC_OK))); + impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId", + new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void deleteNetworkATest_NotifyException() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("<completed>true</completed>")) - .willReturn(aResponse() - .withStatus(HttpStatus.SC_NOT_FOUND))); - impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", - "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void deleteNetworkATest_NotifyException() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor( + post(urlPathEqualTo("/notificationUrl")).withRequestBody(containing("<completed>true</completed>")) + .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); + impl.deleteNetworkA("mtn13", "tenantId", "networkType", "modelCustomizationUuid", "networkId", "messageId", + new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void deleteNetworkATest_NetworkException() { - impl.deleteNetworkA("cloudSiteId", "tenantId", "networkType", "modelCustomizationUuid", "networkId", - "messageId", new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void deleteNetworkATest_NetworkException() { + impl.deleteNetworkA("cloudSiteId", "tenantId", "networkType", "modelCustomizationUuid", "networkId", + "messageId", new MsoRequest(), "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void updateNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(); - stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("updateNetworkNotification")) - .willReturn(aResponse() - .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + - " <soapenv:Header/>\n" + - " <soapenv:Body>\n" + - " <net:updateNetworkNotificationResponse>\n" + - " </net:updateNetworkNotificationResponse>\n" + - " </soapenv:Body>\n" + - "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - HashMap<String,String> networkParams = new HashMap<String,String>(); - networkParams.put("shared", "true"); - networkParams.put("external", "false"); - impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "dvspg-VCE_VPE-mtjnj40avbc", - "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<Subnet>(), networkParams, "messageId", - new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void updateNetworkATest() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json"); + mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer); + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) + .withRequestBody(containing("updateNetworkNotification")) + .willReturn(aResponse().withBody( + "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + + " <soapenv:Header/>\n" + " <soapenv:Body>\n" + + " <net:updateNetworkNotificationResponse>\n" + + " </net:updateNetworkNotificationResponse>\n" + " </soapenv:Body>\n" + + "</soapenv:Envelope>") + .withStatus(HttpStatus.SC_OK))); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); + impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", + "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), + new ArrayList<Subnet>(), networkParams, "messageId", new MsoRequest(), + "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void updateNetworkATest_NotifyExcpetion() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc"); - mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(); - HashMap<String,String> networkParams = new HashMap<String,String>(); - networkParams.put("shared", "true"); - networkParams.put("external", "false"); - impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "dvspg-VCE_VPE-mtjnj40avbc", - "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), networkParams, "messageId", - new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); } + @Test + public void updateNetworkATest_NotifyExcpetion() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + mockOpenStackGetStackCreated_200(wireMockServer, "OpenstackResponse_Stack_Created.json", + "dvspg-VCE_VPE-mtjnj40avbc"); + mockOpenStackGetStackDeleteOrUpdateComplete_200(wireMockServer, "OpenstackResponse_Stack_UpdateComplete.json"); + mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(wireMockServer); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); + impl.updateNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", + "dvspg-VCE_VPE-mtjnj40avbc", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), + new ArrayList<>(), networkParams, "messageId", new MsoRequest(), + "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void updateNetworkATest_NetworkException() { - impl.updateNetworkA("cloudSiteId", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "networkId", - "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), new HashMap<String,String>(), "messageId", - new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void updateNetworkATest_NetworkException() { + impl.updateNetworkA("cloudSiteId", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", + "networkId", "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), + new HashMap<String, String>(), "messageId", new MsoRequest(), + "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void queryNetworkATest() throws IOException { - mockOpenStackResponseAccessQueryNetwork(wireMockPort); - impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(), - "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void queryNetworkATest() throws IOException { + mockOpenStackResponseAccessQueryNetwork(wireMockServer, wireMockPort); + impl.queryNetworkA("mtn13", "tenantId", "networkId", "messageId", new MsoRequest(), + "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void createNetworkATest() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - stubFor(post(urlPathEqualTo("/notificationUrl")) - .withRequestBody(containing("createNetworkNotification")) - .willReturn(aResponse() - .withBody("<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + - " <soapenv:Header/>\n" + - " <soapenv:Body>\n" + - " <net:createNetworkNotificationResponse>\n" + - " </net:createNetworkNotificationResponse>\n" + - " </soapenv:Body>\n" + - "</soapenv:Envelope>") - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreatedVUSP_200(); - mockOpenStackPostStacks_200(); - mockOpenStackPostStacks_200(); - HashMap<String,String> networkParams = new HashMap<String,String>(); - impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", - "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId", - new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void createNetworkATest() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(post(urlPathEqualTo("/notificationUrl")) + .withRequestBody(containing("createNetworkNotification")) + .willReturn(aResponse().withBody( + "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:net=\"http://org.onap.so/networkNotify\">\n" + + " <soapenv:Header/>\n" + " <soapenv:Body>\n" + + " <net:createNetworkNotificationResponse>\n" + + " </net:createNetworkNotificationResponse>\n" + " </soapenv:Body>\n" + + "</soapenv:Envelope>") + .withStatus(HttpStatus.SC_OK))); + mockOpenStackGetStackCreatedVUSP_200(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); + HashMap<String, String> networkParams = new HashMap<String, String>(); + impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", + "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false, + false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(), + "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void createNetworkATest_NotifyException() throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - mockOpenStackGetStackCreatedVUSP_200(); - mockOpenStackPostStacks_200(); - HashMap<String,String> networkParams = new HashMap<String,String>(); - networkParams.put("shared", "true"); - networkParams.put("external", "false"); - impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", - "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId", - new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void createNetworkATest_NotifyException() throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access.json", wireMockPort, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + mockOpenStackGetStackCreatedVUSP_200(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); + HashMap<String, String> networkParams = new HashMap<String, String>(); + networkParams.put("shared", "true"); + networkParams.put("external", "false"); + impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", + "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false, + false, new ArrayList<>(), networkParams, "messageId", new MsoRequest(), + "http://localhost:" + wireMockPort + "/notificationUrl"); + } - @Test - public void createNetworkATest_NetworkException() { - impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", - "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), new HashMap<String,String>(), "messageId", - new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl"); - } + @Test + public void createNetworkATest_NetworkException() { + impl.createNetworkA("mtn13", "tenantId", "networkType", "3bdbb104-476c-483e-9f8b-c095b3d3068c", + "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0", "physicalNetworkName", new ArrayList<>(), false, + false, new ArrayList<>(), new HashMap<String, String>(), "messageId", new MsoRequest(), + "http://localhost:" + wireMockPort + "/notificationUrl"); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java index 3910d9ec44..1f4c205e7a 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java @@ -36,24 +36,22 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByI import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPublicUrlStackByName_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutPublicUrlStackByNameAndID_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; - import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; - import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - import org.json.JSONException; import org.junit.Test; import org.onap.so.adapters.nwrest.CreateNetworkRequest; import org.onap.so.adapters.nwrest.CreateNetworkResponse; import org.onap.so.adapters.nwrest.DeleteNetworkRequest; import org.onap.so.adapters.nwrest.DeleteNetworkResponse; -import org.onap.so.adapters.nwrest.NetworkTechnology; import org.onap.so.adapters.nwrest.QueryNetworkError; import org.onap.so.adapters.nwrest.QueryNetworkResponse; +import org.onap.so.adapters.nwrest.RollbackNetworkRequest; +import org.onap.so.adapters.nwrest.RollbackNetworkResponse; import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.adapters.vnf.BaseRestTestUtils; @@ -63,268 +61,306 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; - import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; public class NetworkAdapterRestTest extends BaseRestTestUtils { - @Autowired - private JettisonStyleMapperProvider jettisonTypeObjectMapper; - private static final String CLOUDSITE_ID = "mtn13"; - private static final String TENANT_ID = "ba38bc24a2ef4fb2ad2810c894f1938f"; - private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b"; - private static final String NETWORK_TYPE = "CONTRAIL30_BASIC"; - private static final String MODEL_CUSTOMIZATION_UUID = "3bdbb104-476c-483e-9f8b-c095b3d308ac"; - private static final String MSO_SERVICE_INSTANCE_ID = "05869d5f-47df-4b45-bbfc-4f03ce0a50bf"; - private static final String MSO_REQUEST_ID = "requestId"; - private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; - - @Test - public void testCreateNetwork() throws JSONException, JsonParseException, JsonMappingException, IOException { - - CreateNetworkRequest request = new CreateNetworkRequest(); - request.setBackout(true); - request.setSkipAAI(true); - request.setFailIfExists(false); - MsoRequest msoReq = new MsoRequest(); - String networkTechnology = "CONTRAIL"; - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setNetworkId(NETWORK_ID); - request.setNetworkName(NETWORK_NAME); - request.setNetworkType(NETWORK_TYPE); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setNetworkTechnology(networkTechnology); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(); - - mockOpenStackGetStackCreatedVUSP_200(); - - mockOpenStackGetStackVUSP_404(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers); - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testCreateNetwork_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { - - - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(); - - mockOpenStackGetStackCreatedAppC_200(); - - mockOpenStackGetStackAppC_404(); - - headers.add("Content-Type", MediaType.APPLICATION_JSON); - headers.add("Accept", MediaType.APPLICATION_JSON); - - String request = readJsonFileAsString("src/test/resources/CreateNetwork.json"); - HttpEntity<String> entity = new HttpEntity<String>(request, headers); - - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - - - @Test - public void testDeleteNetwork() throws IOException{ - - DeleteNetworkRequest request = new DeleteNetworkRequest(); - - MsoRequest msoReq = new MsoRequest(); - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setNetworkId(NETWORK_ID); - request.setNetworkType(NETWORK_TYPE); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setNetworkStackId(NETWORK_ID); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackPublicUrlStackByID_200(wireMockPort); - - mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockPort); - - mockOpenStackDeletePublicUrlStackByNameAndID_204(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - - HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(request, headers); - - ResponseEntity<DeleteNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.DELETE, entity, DeleteNetworkResponse.class); - - DeleteNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/DeleteNetworkResponse.json"), DeleteNetworkResponse.class); - - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testQueryNetwork_Exception() throws IOException{ - MsoRequest msoReq = new MsoRequest(); - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - headers.add("Accept", MediaType.APPLICATION_JSON); - - HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers); - - ResponseEntity<QueryNetworkError> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.GET, - entity, QueryNetworkError.class); - - assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testQueryNetwork() throws IOException{ - - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers); - - ResponseEntity<QueryNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"+"?cloudSiteId=" + CLOUDSITE_ID + "&tenantId=" + TENANT_ID - + "&aaiNetworkId=aaiNetworkId"), HttpMethod.GET, - entity, QueryNetworkResponse.class); - - assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testUpdateNetwork() throws IOException{ - - UpdateNetworkRequest request = new UpdateNetworkRequest(); - - MsoRequest msoReq = new MsoRequest(); - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setNetworkId(NETWORK_ID); - request.setNetworkName(NETWORK_NAME); - request.setNetworkType(NETWORK_TYPE); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setNetworkStackId(NETWORK_ID); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackPublicUrlStackByName_200(wireMockPort); - - mockOpenStackPublicUrlStackByID_200(wireMockPort); - - mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort); - - mockOpenStackPutPublicUrlStackByNameAndID_200(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - - HttpEntity<UpdateNetworkRequest> entity = new HttpEntity<UpdateNetworkRequest>(request, headers); - - ResponseEntity<UpdateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.PUT, entity, UpdateNetworkResponse.class); - - UpdateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/UpdateNetworkResponse.json"), UpdateNetworkResponse.class); - - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - } - - @Test - public void testCreateNetworkCNRC_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(); - - mockOpenStackGetStackCreatedAppC_200(); - - mockOpenStackGetStackAppC_404(); - - headers.add("Content-Type", MediaType.APPLICATION_JSON); - headers.add("Accept", MediaType.APPLICATION_JSON); - - String request = readJsonFileAsString("src/test/resources/CreateNetwork3.json"); - HttpEntity<String> entity = new HttpEntity<String>(request, headers); - - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse3.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testCreateNetworkNC_Shared_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackPostPublicUrlWithBodyFile_200(); - - mockOpenStackGetStackCreatedAppC_200(); - - mockOpenStackGetStackAppC_404(); - - headers.add("Content-Type", MediaType.APPLICATION_JSON); - headers.add("Accept", MediaType.APPLICATION_JSON); - - String request = readJsonFileAsString("src/test/resources/CreateNetwork4.json"); - HttpEntity<String> entity = new HttpEntity<String>(request, headers); - - ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); - - CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateNetworkResponse4.json"), CreateNetworkResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Override - protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{ - return new String(Files.readAllBytes(Paths.get(fileLocation))); - } + @Autowired + private JettisonStyleMapperProvider jettisonTypeObjectMapper; + private static final String CLOUDSITE_ID = "mtn13"; + private static final String TENANT_ID = "ba38bc24a2ef4fb2ad2810c894f1938f"; + private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b"; + private static final String NETWORK_TYPE = "CONTRAIL30_BASIC"; + private static final String MODEL_CUSTOMIZATION_UUID = "3bdbb104-476c-483e-9f8b-c095b3d308ac"; + private static final String MSO_SERVICE_INSTANCE_ID = "05869d5f-47df-4b45-bbfc-4f03ce0a50bf"; + private static final String MSO_REQUEST_ID = "requestId"; + private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; + + @Test + public void testCreateNetwork() throws JSONException, JsonParseException, JsonMappingException, IOException { + + CreateNetworkRequest request = new CreateNetworkRequest(); + request.setBackout(true); + request.setSkipAAI(true); + request.setFailIfExists(false); + MsoRequest msoReq = new MsoRequest(); + String networkTechnology = "CONTRAIL"; + + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + request.setMsoRequest(msoReq); + request.setCloudSiteId(CLOUDSITE_ID); + request.setTenantId(TENANT_ID); + request.setNetworkId(NETWORK_ID); + request.setNetworkName(NETWORK_NAME); + request.setNetworkType(NETWORK_TYPE); + request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); + request.setNetworkTechnology(networkTechnology); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); + + mockOpenStackGetStackCreatedVUSP_200(wireMockServer); + + mockOpenStackGetStackVUSP_404(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<CreateNetworkRequest> entity = new HttpEntity<CreateNetworkRequest>(request, headers); + ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); + + CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateNetworkResponse.json"), CreateNetworkResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + @Test + public void testCreateNetwork_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException { + + + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); + + mockOpenStackGetStackCreatedAppC_200(wireMockServer); + + mockOpenStackGetStackAppC_404(wireMockServer); + + headers.add("Content-Type", MediaType.APPLICATION_JSON); + headers.add("Accept", MediaType.APPLICATION_JSON); + + String request = readJsonFileAsString("src/test/resources/CreateNetwork.json"); + HttpEntity<String> entity = new HttpEntity<String>(request, headers); + + ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); + + CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateNetworkResponse2.json"), CreateNetworkResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + + + @Test + public void testDeleteNetwork() throws IOException { + + DeleteNetworkRequest request = new DeleteNetworkRequest(); + + MsoRequest msoReq = new MsoRequest(); + + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + request.setMsoRequest(msoReq); + request.setCloudSiteId(CLOUDSITE_ID); + request.setTenantId(TENANT_ID); + request.setNetworkId(NETWORK_ID); + request.setNetworkType(NETWORK_TYPE); + request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); + request.setNetworkStackId(NETWORK_ID); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); + + mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort); + + mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + + HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(request, headers); + + ResponseEntity<DeleteNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.DELETE, + entity, DeleteNetworkResponse.class); + + DeleteNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/DeleteNetworkResponse.json"), DeleteNetworkResponse.class); + + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + } + + @Test + public void testRollbackNetwork() throws IOException { + + RollbackNetworkRequest request = new RollbackNetworkRequest(); + + MsoRequest msoReq = new MsoRequest(); + + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); + + mockOpenStackGetPublicUrlStackByNameAndID_204(wireMockServer, wireMockPort); + + mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + + HttpEntity<RollbackNetworkRequest> entity = new HttpEntity<>(request, headers); + + ResponseEntity<RollbackNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b/rollback"), + HttpMethod.DELETE, entity, RollbackNetworkResponse.class); + + RollbackNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/RollbackNetworkResponse.json"), RollbackNetworkResponse.class); + + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + } + + @Test + public void testQueryNetwork_Exception() throws IOException { + MsoRequest msoReq = new MsoRequest(); + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + headers.add("Accept", MediaType.APPLICATION_JSON); + + HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers); + + ResponseEntity<QueryNetworkError> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.GET, + entity, QueryNetworkError.class); + + assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); + + } + + @Test + public void testQueryNetwork() throws IOException { + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<DeleteNetworkRequest> entity = new HttpEntity<DeleteNetworkRequest>(headers); + + ResponseEntity<QueryNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b" + "?cloudSiteId=" + + CLOUDSITE_ID + "&tenantId=" + TENANT_ID + "&aaiNetworkId=aaiNetworkId"), + HttpMethod.GET, entity, QueryNetworkResponse.class); + + assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); + + } + + @Test + public void testUpdateNetwork() throws IOException { + + UpdateNetworkRequest request = new UpdateNetworkRequest(); + + MsoRequest msoReq = new MsoRequest(); + + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + request.setMsoRequest(msoReq); + request.setCloudSiteId(CLOUDSITE_ID); + request.setTenantId(TENANT_ID); + request.setNetworkId(NETWORK_ID); + request.setNetworkName(NETWORK_NAME); + request.setNetworkType(NETWORK_TYPE); + request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); + request.setNetworkStackId(NETWORK_ID); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPublicUrlStackByName_200(wireMockServer, wireMockPort); + + mockOpenStackPublicUrlStackByID_200(wireMockServer, wireMockPort); + + mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort); + + mockOpenStackPutPublicUrlStackByNameAndID_200(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + + HttpEntity<UpdateNetworkRequest> entity = new HttpEntity<UpdateNetworkRequest>(request, headers); + + ResponseEntity<UpdateNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks/da886914-efb2-4917-b335-c8381528d90b"), HttpMethod.PUT, + entity, UpdateNetworkResponse.class); + + UpdateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/UpdateNetworkResponse.json"), UpdateNetworkResponse.class); + + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + } + + @Test + public void testCreateNetworkCNRC_JSON() + throws JSONException, JsonParseException, JsonMappingException, IOException { + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); + + mockOpenStackGetStackCreatedAppC_200(wireMockServer); + + mockOpenStackGetStackAppC_404(wireMockServer); + + headers.add("Content-Type", MediaType.APPLICATION_JSON); + headers.add("Accept", MediaType.APPLICATION_JSON); + + String request = readJsonFileAsString("src/test/resources/CreateNetwork3.json"); + HttpEntity<String> entity = new HttpEntity<String>(request, headers); + + ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); + + CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateNetworkResponse3.json"), CreateNetworkResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + @Test + public void testCreateNetworkNC_Shared_JSON() + throws JSONException, JsonParseException, JsonMappingException, IOException { + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPostPublicUrlWithBodyFile_200(wireMockServer); + + mockOpenStackGetStackCreatedAppC_200(wireMockServer); + + mockOpenStackGetStackAppC_404(wireMockServer); + + headers.add("Content-Type", MediaType.APPLICATION_JSON); + headers.add("Accept", MediaType.APPLICATION_JSON); + + String request = readJsonFileAsString("src/test/resources/CreateNetwork4.json"); + HttpEntity<String> entity = new HttpEntity<String>(request, headers); + + ResponseEntity<CreateNetworkResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/networks"), HttpMethod.POST, entity, CreateNetworkResponse.class); + + CreateNetworkResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateNetworkResponse4.json"), CreateNetworkResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + @Override + protected String readJsonFileAsString(String fileLocation) + throws JsonParseException, JsonMappingException, IOException { + return new String(Files.readAllBytes(Paths.get(fileLocation))); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java index a1e0a16819..01fbc308b9 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionBeanTest.java @@ -1,41 +1,35 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.network.exceptions; import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.onap.so.openstack.exceptions.MsoExceptionCategory; public class NetworkExceptionBeanTest { - - NetworkExceptionBean neb=new NetworkExceptionBean(); - MsoExceptionCategory msc=MsoExceptionCategory.INTERNAL; - - @Test - public void test() { - neb.setRolledBack(true); - neb.setMessage("message"); - neb.setCategory(msc); - assertEquals("message", neb.getMessage()); - assertEquals(msc, neb.getCategory()); - assertEquals(true, neb.isRolledBack()); - } + + NetworkExceptionBean neb = new NetworkExceptionBean(); + MsoExceptionCategory msc = MsoExceptionCategory.INTERNAL; + + @Test + public void test() { + neb.setRolledBack(true); + neb.setMessage("message"); + neb.setCategory(msc); + assertEquals("message", neb.getMessage()); + assertEquals(msc, neb.getCategory()); + assertEquals(true, neb.isRolledBack()); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java index bd5b07de1f..268d6b4c51 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/exceptions/NetworkExceptionTest.java @@ -1,50 +1,44 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.network.exceptions; import static org.junit.Assert.assertEquals; - import org.junit.Test; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.exceptions.MsoExceptionCategory; -public class NetworkExceptionTest{ - - NetworkException ne=new NetworkException("msg"); - NetworkExceptionBean neb =new NetworkExceptionBean(); - MsoException msoException= new MsoException("msoException") { - private static final long serialVersionUID = 1L; - }; - MsoExceptionCategory msc=MsoExceptionCategory.INTERNAL; - NetworkException ne1=new NetworkException(msoException); - NetworkException ne2=new NetworkException(ne); - NetworkException ne3=new NetworkException("msg", ne); - NetworkException ne4=new NetworkException("msg", msoException); - NetworkException ne5=new NetworkException("msg", msc); - NetworkException ne6=new NetworkException("msg", msc, ne); - - @Test - public void test() { - ne.setFaultInfo(neb); - assertEquals(ne.getFaultInfo(), neb); - } +public class NetworkExceptionTest { + + NetworkException ne = new NetworkException("msg"); + NetworkExceptionBean neb = new NetworkExceptionBean(); + MsoException msoException = new MsoException("msoException") { + private static final long serialVersionUID = 1L; + }; + MsoExceptionCategory msc = MsoExceptionCategory.INTERNAL; + NetworkException ne1 = new NetworkException(msoException); + NetworkException ne2 = new NetworkException(ne); + NetworkException ne3 = new NetworkException("msg", ne); + NetworkException ne4 = new NetworkException("msg", msoException); + NetworkException ne5 = new NetworkException("msg", msc); + NetworkException ne6 = new NetworkException("msg", msc, ne); + + @Test + public void test() { + ne.setFaultInfo(neb); + assertEquals(ne.getFaultInfo(), neb); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java index df7e415724..b695a538bb 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java @@ -20,9 +20,7 @@ package org.onap.so.adapters.tenant; import java.util.HashMap; - import javax.xml.ws.Holder; - import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; @@ -35,10 +33,10 @@ import org.onap.so.entity.MsoRequest; @RunWith(MockitoJUnitRunner.class) public class MsoTenantAdapterImplTest { - + @Mock - private CloudConfig cloudConfig; - + private CloudConfig cloudConfig; + @Spy @InjectMocks private MsoTenantAdapterImpl msoTenantAdapter; @@ -50,14 +48,14 @@ public class MsoTenantAdapterImplTest { @Test(expected = NullPointerException.class) public void createTenant() throws Exception { - msoTenantAdapter.createTenant("site", "tenant", new HashMap<>(), - true, true, new MsoRequest(), new Holder<String>(), new Holder<TenantRollback>()); + msoTenantAdapter.createTenant("site", "tenant", new HashMap<>(), true, true, new MsoRequest(), + new Holder<String>(), new Holder<TenantRollback>()); } @Test(expected = NullPointerException.class) public void queryTenant() throws Exception { - msoTenantAdapter.queryTenant("site", "tenant", new MsoRequest(), - new Holder<>(), new Holder<>(), new Holder<>()); + msoTenantAdapter.queryTenant("site", "tenant", new MsoRequest(), new Holder<>(), new Holder<>(), + new Holder<>()); } @Test(expected = NullPointerException.class) @@ -70,4 +68,4 @@ public class MsoTenantAdapterImplTest { msoTenantAdapter.rollbackTenant(new TenantRollback()); } -}
\ No newline at end of file +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java index 405118cb30..e481f0d03f 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java @@ -36,15 +36,12 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostTenantWithBod import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPostTenant_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutRolesAdmin_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccessAdmin; - import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; - import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; - import org.junit.Ignore; import org.junit.Test; import org.onap.so.adapters.tenantrest.CreateTenantRequest; @@ -58,189 +55,186 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; - import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.JsonMappingException; public class TenantAdapterRestTest extends BaseRestTestUtils { - @Autowired - private JettisonStyleMapperProvider jettisonTypeObjectMapper; - - @Test - public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException { - - CreateTenantRequest request = new CreateTenantRequest(); - String cloudSiteId = "MTN13"; - String requestId = "62265093-277d-4388-9ba6-449838ade586"; - String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; - String tenantName = "testingTenantName"; - boolean failIfExists = true; - boolean backout = true; - Map<String, String> metaData = new HashMap<>(); - metaData.put("key1", "value2"); - MsoRequest msoReq = new MsoRequest(); - msoReq.setRequestId(requestId); - msoReq.setServiceInstanceId(serviceInstanceId); - - request.setCloudSiteId(cloudSiteId); - request.setMsoRequest(msoReq); - request.setTenantName(tenantName); - request.setMetadata(metaData); - request.setBackout(backout); - request.setFailIfExists(failIfExists); - - mockOpenStackResponseAccessAdmin(wireMockPort); - - mockOpenStackGetTenantByName_404(tenantName); - - mockOpenStackPostTenantWithBodyFile_200(); - - mockOpenStackGetUser_200("m93945"); - - mockOpenStackGetRoles_200("OS-KSADM"); - - mockOpenStackPutRolesAdmin_200("OS-KSADM"); - - mockOpenStackPostMetadata_200(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers); - - ResponseEntity<CreateTenantResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/tenants"), HttpMethod.POST, - entity, CreateTenantResponse.class); - - CreateTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateTenantResponse_Created.json"), CreateTenantResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException { - - CreateTenantRequest request = new CreateTenantRequest(); - String cloudSiteId = "MTN13"; - String requestId = "62265093-277d-4388-9ba6-449838ade586"; - String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; - String tenantName = "testingTenantName"; - boolean failIfExists = false; - boolean backout = true; - Map<String, String> metadata = new HashMap<>(); - - MsoRequest msoReq = new MsoRequest(); - msoReq.setRequestId(requestId); - msoReq.setServiceInstanceId(serviceInstanceId); - - request.setCloudSiteId(cloudSiteId); - request.setMsoRequest(msoReq); - request.setTenantName(tenantName); - request.setMetadata(metadata); - request.setBackout(backout); - request.setFailIfExists(failIfExists); - - mockOpenStackResponseAccessAdmin(wireMockPort); - - mockOpenStackGetTenantByName_200(tenantName); - - mockOpenStackPostTenant_200(); - - mockOpenStackGetMetadata_200(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers); - - ResponseEntity<CreateTenantResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/tenants"), HttpMethod.POST, - entity, CreateTenantResponse.class); - - CreateTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateTenantResponse_Exists.json"), CreateTenantResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testDeleteTenant() throws IOException { - - DeleteTenantRequest request = new DeleteTenantRequest(); - String cloudSiteId = "mtn13"; - String tenantId = "tenantId"; - String requestId = "ra1"; - String serviceInstanceId = "sa1"; - - MsoRequest msoReq = new MsoRequest(); - msoReq.setRequestId(requestId); - msoReq.setServiceInstanceId(serviceInstanceId); - - request.setCloudSiteId(cloudSiteId); - request.setTenantId(tenantId); - request.setMsoRequest(msoReq); - - mockOpenStackResponseAccessAdmin(wireMockPort); - - mockOpenStackGetTenantById_200(tenantId); - - mockOpenStackDeleteTenantById_200(tenantId); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers); - - ResponseEntity<DeleteTenantResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/tenants/tenantId"), HttpMethod.DELETE, - entity, DeleteTenantResponse.class); - - DeleteTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/DeleteTenantResponse_Success.json"), DeleteTenantResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - //@Ignore - @Test - public void testDeleteTenantFails() throws IOException { - - DeleteTenantRequest request = new DeleteTenantRequest(); - String cloudSiteId = "mtn13"; - String tenantId = "tenantId"; - String requestId = "ra1"; - String serviceInstanceId = "sa1"; - - MsoRequest msoReq = new MsoRequest(); - msoReq.setRequestId(requestId); - msoReq.setServiceInstanceId(serviceInstanceId); - - request.setCloudSiteId(cloudSiteId); - request.setTenantId(tenantId); - request.setMsoRequest(msoReq); - - mockOpenStackResponseAccessAdmin(wireMockPort); - - mockOpenStackGetTenantById_404(tenantId); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers); - - ResponseEntity<DeleteTenantResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/tenants/tenantId"), HttpMethod.DELETE, - entity, DeleteTenantResponse.class); - - DeleteTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/DeleteTenantResponse_Failed.json"), DeleteTenantResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Ignore - @Test - public void testQuaryTenant() { - - - - } + @Autowired + private JettisonStyleMapperProvider jettisonTypeObjectMapper; + + @Test + public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException { + + CreateTenantRequest request = new CreateTenantRequest(); + String cloudSiteId = "MTN13"; + String requestId = "62265093-277d-4388-9ba6-449838ade586"; + String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; + String tenantName = "testingTenantName"; + boolean failIfExists = true; + boolean backout = true; + Map<String, String> metaData = new HashMap<>(); + metaData.put("key1", "value2"); + MsoRequest msoReq = new MsoRequest(); + msoReq.setRequestId(requestId); + msoReq.setServiceInstanceId(serviceInstanceId); + + request.setCloudSiteId(cloudSiteId); + request.setMsoRequest(msoReq); + request.setTenantName(tenantName); + request.setMetadata(metaData); + request.setBackout(backout); + request.setFailIfExists(failIfExists); + + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); + + mockOpenStackGetTenantByName_404(wireMockServer, tenantName); + + mockOpenStackPostTenantWithBodyFile_200(wireMockServer); + + mockOpenStackGetUser_200(wireMockServer, "m93945"); + + mockOpenStackGetRoles_200(wireMockServer, "OS-KSADM"); + + mockOpenStackPutRolesAdmin_200(wireMockServer, "OS-KSADM"); + + mockOpenStackPostMetadata_200(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers); + + ResponseEntity<CreateTenantResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/tenants"), HttpMethod.POST, entity, CreateTenantResponse.class); + + CreateTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateTenantResponse_Created.json"), CreateTenantResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + @Test + public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException { + + CreateTenantRequest request = new CreateTenantRequest(); + String cloudSiteId = "MTN13"; + String requestId = "62265093-277d-4388-9ba6-449838ade586"; + String serviceInstanceId = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; + String tenantName = "testingTenantName"; + boolean failIfExists = false; + boolean backout = true; + Map<String, String> metadata = new HashMap<>(); + + MsoRequest msoReq = new MsoRequest(); + msoReq.setRequestId(requestId); + msoReq.setServiceInstanceId(serviceInstanceId); + + request.setCloudSiteId(cloudSiteId); + request.setMsoRequest(msoReq); + request.setTenantName(tenantName); + request.setMetadata(metadata); + request.setBackout(backout); + request.setFailIfExists(failIfExists); + + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); + + mockOpenStackGetTenantByName_200(wireMockServer, tenantName); + + mockOpenStackPostTenant_200(wireMockServer); + + mockOpenStackGetMetadata_200(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<CreateTenantRequest> entity = new HttpEntity<CreateTenantRequest>(request, headers); + + ResponseEntity<CreateTenantResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/tenants"), HttpMethod.POST, entity, CreateTenantResponse.class); + + CreateTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateTenantResponse_Exists.json"), CreateTenantResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + @Test + public void testDeleteTenant() throws IOException { + + DeleteTenantRequest request = new DeleteTenantRequest(); + String cloudSiteId = "mtn13"; + String tenantId = "tenantId"; + String requestId = "ra1"; + String serviceInstanceId = "sa1"; + + MsoRequest msoReq = new MsoRequest(); + msoReq.setRequestId(requestId); + msoReq.setServiceInstanceId(serviceInstanceId); + + request.setCloudSiteId(cloudSiteId); + request.setTenantId(tenantId); + request.setMsoRequest(msoReq); + + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); + + mockOpenStackGetTenantById_200(wireMockServer, tenantId); + + mockOpenStackDeleteTenantById_200(wireMockServer, tenantId); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers); + + ResponseEntity<DeleteTenantResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/tenants/tenantId"), HttpMethod.DELETE, + entity, DeleteTenantResponse.class); + + DeleteTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/DeleteTenantResponse_Success.json"), DeleteTenantResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + // @Ignore + @Test + public void testDeleteTenantFails() throws IOException { + + DeleteTenantRequest request = new DeleteTenantRequest(); + String cloudSiteId = "mtn13"; + String tenantId = "tenantId"; + String requestId = "ra1"; + String serviceInstanceId = "sa1"; + + MsoRequest msoReq = new MsoRequest(); + msoReq.setRequestId(requestId); + msoReq.setServiceInstanceId(serviceInstanceId); + + request.setCloudSiteId(cloudSiteId); + request.setTenantId(tenantId); + request.setMsoRequest(msoReq); + + mockOpenStackResponseAccessAdmin(wireMockServer, wireMockPort); + + mockOpenStackGetTenantById_404(wireMockServer, tenantId); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<DeleteTenantRequest> entity = new HttpEntity<DeleteTenantRequest>(request, headers); + + ResponseEntity<DeleteTenantResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/tenants/tenantId"), HttpMethod.DELETE, + entity, DeleteTenantResponse.class); + + DeleteTenantResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/DeleteTenantResponse_Failed.json"), DeleteTenantResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + @Ignore + @Test + public void testQuaryTenant() { + + + + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java index 6288dc9573..6e3312b1d3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantAlreadyExistsTest.java @@ -1,22 +1,17 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.tenant.exceptions; @@ -24,9 +19,9 @@ import org.junit.Test; public class TenantAlreadyExistsTest { - @Test - public void test() { - TenantAlreadyExists tar= new TenantAlreadyExists("name", "cloudId", "tenantId"); - assert(tar!=null); - } + @Test + public void test() { + TenantAlreadyExists tar = new TenantAlreadyExists("name", "cloudId", "tenantId"); + assert (tar != null); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java index 178495105b..7314a9f1e2 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionBeanTest.java @@ -1,22 +1,17 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.tenant.exceptions; @@ -27,21 +22,21 @@ import org.onap.so.openstack.exceptions.MsoExceptionCategory; public class TenantExceptionBeanTest { -@Mock -private MsoExceptionCategory mec; + @Mock + private MsoExceptionCategory mec; -@InjectMocks -private TenantExceptionBean teb; + @InjectMocks + private TenantExceptionBean teb; -@Test - public void test() { - teb =new TenantExceptionBean("message",mec); + @Test + public void test() { + teb = new TenantExceptionBean("message", mec); teb.setMessage("message"); teb.setCategory(MsoExceptionCategory.INTERNAL); teb.setCategory(MsoExceptionCategory.IO); teb.setCategory(MsoExceptionCategory.OPENSTACK); teb.setCategory(MsoExceptionCategory.USERDATA); - assert(teb.getMessage().equals("message")); - assert(teb.getCategory()!=null); - } + assert (teb.getMessage().equals("message")); + assert (teb.getCategory() != null); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java index 73614a3628..83eb1f1bdc 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/exceptions/TenantExceptionTest.java @@ -1,22 +1,17 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.tenant.exceptions; @@ -26,24 +21,24 @@ import org.mockito.Mock; import org.onap.so.openstack.exceptions.MsoExceptionCategory; public class TenantExceptionTest { - - @Mock - private TenantExceptionBean teb; - - @Mock - private MsoExceptionCategory mec; - - @InjectMocks - private TenantException te; - - @Test - public void test() { - teb=new TenantExceptionBean("message"); - teb.setMessage("message"); - teb.setCategory(MsoExceptionCategory.INTERNAL); - te = new TenantException("message", mec); - te.setFaultInfo(teb); - assert(te.getFaultInfo()!=null); - assert(te.getFaultInfo().equals(teb)); - } + + @Mock + private TenantExceptionBean teb; + + @Mock + private MsoExceptionCategory mec; + + @InjectMocks + private TenantException te; + + @Test + public void test() { + teb = new TenantExceptionBean("message"); + teb.setMessage("message"); + teb.setCategory(MsoExceptionCategory.INTERNAL); + te = new TenantException("message", mec); + te.setFaultInfo(teb); + assert (te.getFaultInfo() != null); + assert (te.getFaultInfo().equals(teb)); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java index 141be6bd7c..61d2d08590 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/valet/ValetClientTest.java @@ -27,9 +27,7 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePostResponse_20 import static org.onap.so.bpmn.mock.StubOpenStack.mockValetCreatePutResponse_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockValetDeleteDeleteResponse_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockValetRollbackPutRequest_200; - import java.io.File; - import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -40,77 +38,90 @@ import org.onap.so.adapters.valet.beans.ValetRollbackResponse; import org.onap.so.adapters.valet.beans.ValetUpdateResponse; import org.onap.so.adapters.vnf.BaseRestTestUtils; import org.springframework.beans.factory.annotation.Autowired; - import com.fasterxml.jackson.databind.ObjectMapper; public class ValetClientTest extends BaseRestTestUtils { - @Autowired - protected ValetClient client; - - private ObjectMapper mapper = new ObjectMapper(); - - @Before - public void init() { - client.baseUrl = "http://localhost:" + wireMockPort; - } - - @Test - public void testCallValetCreateRequest() throws Exception { - ValetCreateResponse vcr = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetCreateResponse.class); - GenericValetResponse<ValetCreateResponse> expected = new GenericValetResponse<ValetCreateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr); - - mockValetCreatePostResponse_200("requestId", mapper.writeValueAsString(vcr)); - - GenericValetResponse<ValetCreateResponse> actual = client.callValetCreateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void testCallValetUpdateRequest() throws Exception { - ValetUpdateResponse vur = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), ValetUpdateResponse.class); - GenericValetResponse<ValetUpdateResponse> expected = new GenericValetResponse<ValetUpdateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vur); - - mockValetCreatePutResponse_200("requestId", mapper.writeValueAsString(vur)); - - GenericValetResponse<ValetUpdateResponse> actual = client.callValetUpdateRequest("requestId", "regionId", "tenantId", "serviceInstanceId", "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void testCallValetDeleteRequest() throws Exception { - ValetDeleteResponse vdr = mapper.readValue(new File("src/test/resources/__files/ValetDeleteRequest.json"), ValetDeleteResponse.class); - GenericValetResponse<ValetDeleteResponse> expected = new GenericValetResponse<ValetDeleteResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vdr); - - mockValetDeleteDeleteResponse_200("requestId", mapper.writeValueAsString(vdr)); - - GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", "tenantId", "vfModuleId", "vfModuleName"); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void testCallValetConfirmRequest() throws Exception { - ValetConfirmResponse vcr = new ValetConfirmResponse(); - GenericValetResponse<ValetConfirmResponse> expected = new GenericValetResponse<ValetConfirmResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr); - - mockValetConfirmPutRequest_200("requestId", "{}"); - - GenericValetResponse<ValetConfirmResponse> actual = client.callValetConfirmRequest("requestId", "stackId"); - - assertThat(actual, sameBeanAs(expected)); - } - - @Test - public void testCallValetRollbackRequest() throws Exception { - ValetRollbackResponse vrr = new ValetRollbackResponse(); - GenericValetResponse<ValetRollbackResponse> expected = new GenericValetResponse<ValetRollbackResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vrr); - - mockValetRollbackPutRequest_200("requestId", "{}"); - - GenericValetResponse<ValetRollbackResponse> actual = client.callValetRollbackRequest("requestId", "stackId", true, "error"); - - assertThat(actual, sameBeanAs(expected)); - } + @Autowired + protected ValetClient client; + + private ObjectMapper mapper = new ObjectMapper(); + + @Before + public void init() { + client.baseUrl = "http://localhost:" + wireMockPort; + } + + @Test + public void testCallValetCreateRequest() throws Exception { + ValetCreateResponse vcr = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), + ValetCreateResponse.class); + GenericValetResponse<ValetCreateResponse> expected = + new GenericValetResponse<ValetCreateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr); + + mockValetCreatePostResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vcr)); + + GenericValetResponse<ValetCreateResponse> actual = + client.callValetCreateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", + "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCallValetUpdateRequest() throws Exception { + ValetUpdateResponse vur = mapper.readValue(new File("src/test/resources/__files/ValetCreateRequest.json"), + ValetUpdateResponse.class); + GenericValetResponse<ValetUpdateResponse> expected = + new GenericValetResponse<ValetUpdateResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vur); + + mockValetCreatePutResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vur)); + + GenericValetResponse<ValetUpdateResponse> actual = + client.callValetUpdateRequest("requestId", "regionId", "ownerId", "tenantId", "serviceInstanceId", + "vnfId", "vnfName", "vfModuleId", "vfModuleName", "keystoneUrl", null); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCallValetDeleteRequest() throws Exception { + ValetDeleteResponse vdr = mapper.readValue(new File("src/test/resources/__files/ValetDeleteRequest.json"), + ValetDeleteResponse.class); + GenericValetResponse<ValetDeleteResponse> expected = + new GenericValetResponse<ValetDeleteResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vdr); + + mockValetDeleteDeleteResponse_200(wireMockServer, "requestId", mapper.writeValueAsString(vdr)); + + GenericValetResponse<ValetDeleteResponse> actual = client.callValetDeleteRequest("requestId", "regionId", + "ownerId", "tenantId", "vfModuleId", "vfModuleName"); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCallValetConfirmRequest() throws Exception { + ValetConfirmResponse vcr = new ValetConfirmResponse(); + GenericValetResponse<ValetConfirmResponse> expected = + new GenericValetResponse<ValetConfirmResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vcr); + + mockValetConfirmPutRequest_200(wireMockServer, "requestId", "{}"); + + GenericValetResponse<ValetConfirmResponse> actual = client.callValetConfirmRequest("requestId", "stackId"); + + assertThat(actual, sameBeanAs(expected)); + } + + @Test + public void testCallValetRollbackRequest() throws Exception { + ValetRollbackResponse vrr = new ValetRollbackResponse(); + GenericValetResponse<ValetRollbackResponse> expected = + new GenericValetResponse<ValetRollbackResponse>(HttpStatus.SC_OK, ValetClient.NO_STATUS_RETURNED, vrr); + + mockValetRollbackPutRequest_200(wireMockServer, "requestId", "{}"); + + GenericValetResponse<ValetRollbackResponse> actual = + client.callValetRollbackRequest("requestId", "stackId", true, "error"); + + assertThat(actual, sameBeanAs(expected)); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java index c982f8beb1..a9c57598b0 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java @@ -21,7 +21,6 @@ package org.onap.so.adapters.vdu.mapper; import static org.assertj.core.api.Assertions.assertThat; - import com.google.common.collect.Lists; import java.util.List; import org.junit.Test; @@ -55,14 +54,13 @@ public class VfModuleCustomizationToVduMapperTest { VfModuleCustomization vfModuleCustomization = createVfModuleCustomization(); vfModuleCustomization.setHeatEnvironment(createHeatEnvironment(HEAT_ENV_NAME, HEAT_ENV_CONTENT)); VfModule vfModule = createVfModule(); - vfModule.setModuleHeatTemplate(createHeatTemplate( - MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, - NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); + vfModule.setModuleHeatTemplate(createHeatTemplate(MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, + NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); vfModuleCustomization.setVfModule(vfModule); // WHEN - VduModelInfo vduModelInfo = new VfModuleCustomizationToVduMapper() - .mapVfModuleCustomizationToVdu(vfModuleCustomization); + VduModelInfo vduModelInfo = + new VfModuleCustomizationToVduMapper().mapVfModuleCustomizationToVdu(vfModuleCustomization); // THEN assertThat(vduModelInfo.getModelCustomizationUUID()).isEqualTo(MODEL_CUSTOMIZATION_UUID); @@ -76,14 +74,13 @@ public class VfModuleCustomizationToVduMapperTest { VfModuleCustomization vfModuleCustomization = createVfModuleCustomization(); vfModuleCustomization.setVolumeHeatEnv(createHeatEnvironment(HEAT_ENV_NAME, HEAT_ENV_CONTENT)); VfModule vfModule = createVfModule(); - vfModule.setVolumeHeatTemplate(createHeatTemplate( - MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, - NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); + vfModule.setVolumeHeatTemplate(createHeatTemplate(MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY, + NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY)); vfModuleCustomization.setVfModule(vfModule); // WHEN - VduModelInfo vduModelInfo = new VfModuleCustomizationToVduMapper() - .mapVfModuleCustVolumeToVdu(vfModuleCustomization); + VduModelInfo vduModelInfo = + new VfModuleCustomizationToVduMapper().mapVfModuleCustVolumeToVdu(vfModuleCustomization); // THEN assertThat(vduModelInfo.getModelCustomizationUUID()).isEqualTo(MODEL_CUSTOMIZATION_UUID); @@ -119,7 +116,7 @@ public class VfModuleCustomizationToVduMapperTest { } private HeatTemplate createHeatTemplate(String moduleHeatTemplateName, String moduleHeatTemplateBody, - String childTemplateName, String childTemplateBody) { + String childTemplateName, String childTemplateBody) { HeatTemplate heatTemplate = new HeatTemplate(); heatTemplate.setTemplateName(moduleHeatTemplateName); heatTemplate.setTemplateBody(moduleHeatTemplateBody); @@ -137,10 +134,10 @@ public class VfModuleCustomizationToVduMapperTest { private List<VduArtifact> createExpectedVduArtifacts() { return Lists.newArrayList( - new VduArtifact(MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY.getBytes(), - ArtifactType.MAIN_TEMPLATE), - new VduArtifact(NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY.getBytes(), ArtifactType.NESTED_TEMPLATE), - new VduArtifact(CLOUD_FILE_NAME, CLOUD_FILE_BODY.getBytes(), ArtifactType.TEXT_FILE), - new VduArtifact(HEAT_ENV_NAME, HEAT_ENV_CONTENT.getBytes(), ArtifactType.ENVIRONMENT)); + new VduArtifact(MODULE_HEAT_TEMPLATE_NAME, MODULE_HEAT_TEMPLATE_BODY.getBytes(), + ArtifactType.MAIN_TEMPLATE), + new VduArtifact(NESTED_TEMPLATE_NAME, NESTED_TEMPLATE_BODY.getBytes(), ArtifactType.NESTED_TEMPLATE), + new VduArtifact(CLOUD_FILE_NAME, CLOUD_FILE_BODY.getBytes(), ArtifactType.TEXT_FILE), + new VduArtifact(HEAT_ENV_NAME, HEAT_ENV_CONTENT.getBytes(), ArtifactType.ENVIRONMENT)); } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java new file mode 100644 index 0000000000..a7bddd3ada --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.adapters.vnf; + +import org.junit.runner.RunWith; +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java index 017aa26758..102d748d56 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java @@ -20,10 +20,14 @@ package org.onap.so.adapters.vnf; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import javax.ws.rs.core.MediaType; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Test; @@ -37,125 +41,125 @@ import org.onap.so.db.catalog.beans.ServerType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; import org.springframework.http.HttpHeaders; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; - -import javax.ws.rs.core.MediaType; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.reset; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.github.tomakehurst.wiremock.WireMockServer; @RunWith(SpringRunner.class) -@SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, + webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @AutoConfigureWireMock(port = 0) public abstract class BaseRestTestUtils { - @Value("${wiremock.server.port}") + @Value("${wiremock.server.port}") protected int wireMockPort; - @Autowired - CloudConfig cloudConfig; - - @Autowired - @Qualifier("JettisonStyle") - protected TestRestTemplate restTemplate; - - protected HttpHeaders headers = new HttpHeaders(); - - @LocalServerPort - private int port; - - public ObjectMapper mapper; - - public String orchestrator = "orchestrator"; - public String cloudEndpoint = "/v2.0"; - - - protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{ - ObjectMapper mapper = new ObjectMapper(); - JsonNode jsonNode = mapper.readTree(new File(fileLocation)); - return jsonNode.asText(); - } - - protected String createURLWithPort(String uri) { - return "http://localhost:" + port + uri; - } - - protected String readFile(String fileName) throws IOException { - try (BufferedReader br = new BufferedReader(new FileReader(fileName))) { - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - - while (line != null) { - sb.append(line); - sb.append("\n"); - line = br.readLine(); - } - return sb.toString(); - } - } - - /*** - * Before each test execution, updating IdentityUrl port value to the ramdom wireMockPort - * Since URL will be used as a rest call and required to be mocked in unit tests - */ - @Before - public void setUp() throws Exception { - reset(); - mapper = new ObjectMapper(); - CloudIdentity identity = new CloudIdentity(); - identity.setId("MTN13"); - identity.setMsoId("m93945"); - identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); - identity.setAdminTenant("admin"); - identity.setMemberRole("admin"); - identity.setTenantMetadata(new Boolean(true)); - identity.setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint); - - identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); - - CloudSite cloudSite = new CloudSite(); - cloudSite.setId("MTN13"); - cloudSite.setCloudVersion("3.0"); - cloudSite.setClli("MDT13"); - cloudSite.setRegionId("mtn13"); - cloudSite.setOrchestrator(orchestrator); - identity.setIdentityServerType(ServerType.KEYSTONE); - cloudSite.setIdentityService(identity); - - stubFor(get(urlPathEqualTo("/cloudSite/MTN13")).willReturn(aResponse() - .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) - .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) - .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse() - .withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, "")) - .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) - .withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")).willReturn(aResponse() - .withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, "")) - .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON) - .withStatus(HttpStatus.SC_OK))); - cloudConfig.getCloudSite("MTN13").get().getIdentityService().setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint); - } - - protected static String getBody(String body, int port, String urlPath) throws IOException { - return body.replaceAll("port", "http://localhost:" + port + urlPath); - } - - @Test - public void testNothing(){ - - } + + @Autowired + protected WireMockServer wireMockServer; + + @Autowired + CloudConfig cloudConfig; + + @Autowired + @Qualifier("JettisonStyle") + protected TestRestTemplate restTemplate; + + protected HttpHeaders headers = new HttpHeaders(); + + @LocalServerPort + private int port; + + public ObjectMapper mapper; + + public String orchestrator = "orchestrator"; + public String cloudEndpoint = "/v2.0"; + + + protected String readJsonFileAsString(String fileLocation) + throws JsonParseException, JsonMappingException, IOException { + ObjectMapper mapper = new ObjectMapper(); + JsonNode jsonNode = mapper.readTree(new File(fileLocation)); + return jsonNode.asText(); + } + + protected String createURLWithPort(String uri) { + return "http://localhost:" + port + uri; + } + + protected String readFile(String fileName) throws IOException { + try (BufferedReader br = new BufferedReader(new FileReader(fileName))) { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + return sb.toString(); + } + } + + /*** + * Before each test execution, updating IdentityUrl port value to the ramdom wireMockPort Since URL will be used as + * a rest call and required to be mocked in unit tests + */ + @Before + public void setUp() throws Exception { + wireMockServer.resetAll(); + mapper = new ObjectMapper(); + CloudIdentity identity = new CloudIdentity(); + identity.setId("MTN13"); + identity.setMsoId("m93945"); + identity.setMsoPass("93937EA01B94A10A49279D4572B48369"); + identity.setAdminTenant("admin"); + identity.setMemberRole("admin"); + identity.setTenantMetadata(new Boolean(true)); + identity.setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint); + + identity.setIdentityAuthenticationType(AuthenticationType.USERNAME_PASSWORD); + + CloudSite cloudSite = new CloudSite(); + cloudSite.setId("MTN13"); + cloudSite.setCloudVersion("3.0"); + cloudSite.setClli("MDT13"); + cloudSite.setRegionId("mtn13"); + cloudSite.setOrchestrator(orchestrator); + identity.setIdentityServerType(ServerType.KEYSTONE); + cloudSite.setIdentityService(identity); + + wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/MTN13")) + .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")) + .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(cloudSite), wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/cloudIdentity/MTN13")) + .willReturn(aResponse().withBody(getBody(mapper.writeValueAsString(identity), wireMockPort, "")) + .withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON) + .withStatus(HttpStatus.SC_OK))); + cloudConfig.getCloudSite("MTN13").get().getIdentityService() + .setIdentityUrl("http://localhost:" + wireMockPort + cloudEndpoint); + } + + protected static String getBody(String body, int port, String urlPath) throws IOException { + return body.replaceAll("port", "http://localhost:" + port + urlPath); + } + + @Test + public void testNothing() { + + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java index 4b2fa8138a..883009216f 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java @@ -21,33 +21,31 @@ package org.onap.so.adapters.vnf; import static org.junit.Assert.assertEquals; - import javax.inject.Provider; - import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.boot.web.server.LocalServerPort; -public class BpelRestClientTest extends BaseRestTestUtils{ - - - @LocalServerPort - private int port; - @Autowired - private Provider<BpelRestClient> clientProvider; - - @Test - public void verifyPropertiesRead() { - BpelRestClient client = clientProvider.get(); - - assertEquals(5, client.getRetryCount()); - assertEquals(30, client.getConnectTimeout()); - assertEquals("test:test", client.getCredentials()); - assertEquals(30, client.getSocketTimeout()); - assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList()); - assertEquals(-15, client.getRetryInterval()); - - } +public class BpelRestClientTest extends BaseRestTestUtils { + + + @LocalServerPort + private int port; + @Autowired + private Provider<BpelRestClient> clientProvider; + + @Test + public void verifyPropertiesRead() { + BpelRestClient client = clientProvider.get(); + + assertEquals(5, client.getRetryCount()); + assertEquals(30, client.getConnectTimeout()); + assertEquals("test:test", client.getCredentials()); + assertEquals(30, client.getSocketTimeout()); + assertEquals("408, 429, 500, 502, 503, 504, 900", client.getRetryList()); + assertEquals(-15, client.getRetryInterval()); + + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java index 3ebaea9c2c..46d9f89303 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java @@ -21,138 +21,129 @@ package org.onap.so.adapters.vnf; -import org.apache.http.HttpStatus; -import org.junit.Ignore; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.onap.so.adapters.vnf.exceptions.VnfException; -import org.onap.so.entity.MsoRequest; -import org.onap.so.openstack.beans.VnfRollback; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.SpyBean; - -import java.util.HashMap; -import java.util.Map; - import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.containing; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static com.github.tomakehurst.wiremock.client.WireMock.verify; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doThrow; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; +import java.util.HashMap; +import java.util.Map; +import org.apache.http.HttpStatus; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.VnfRollback; +import org.springframework.beans.factory.annotation.Autowired; public class MsoVnfAdapterAsyncImplTest extends BaseRestTestUtils { - @Autowired - MsoVnfAdapterAsyncImpl instance; - - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Test - public void healthCheckVNFTest() { - instance.healthCheckA(); - } - - @Test - public void createVNFTest() throws Exception { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody - (containing("messageId")) - .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); - - String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; - String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", - msoRequest, notificationUrl); - - verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); - } - - @Test - public void createVNFTest_Exception() throws Exception { - String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.createVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, "messageId", - null, notificationUrl); - - verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); - - } - - @Test - public void updateVnfTest() throws Exception{ - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody - (containing("messageId")) - .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); - String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", map, "messageId", msoRequest, - notificationUrl); - } - - @Test - public void updateVnfTest_Exception() throws Exception{ - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")).withRequestBody - (containing("messageId")) - .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); - String notificationUrl = "http://localhost:"+wireMockPort+"/notify/adapterNotify/updateVnfNotificationRequest"; - instance.updateVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", map, "messageId", msoRequest, - notificationUrl); - verify(1,postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); - } - - @Test - public void queryVnfTest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - instance.queryVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest, - "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); - } - - @Test - public void deleteVnfTest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - instance.deleteVnfA("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest, - "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); - } - - @Test - public void rollbackVnfTest() { - VnfRollback vnfRollBack = new VnfRollback(); - vnfRollBack.setCloudSiteId("mdt1"); - vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e"); - vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff"); - instance.rollbackVnfA(vnfRollBack, "messageId", - "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); - } + @Autowired + MsoVnfAdapterAsyncImpl instance; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Test + public void healthCheckVNFTest() { + instance.healthCheckA(); + } + + @Test + public void createVNFTest() throws Exception { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")) + .withRequestBody(containing("messageId")).willReturn(aResponse().withStatus(HttpStatus.SC_OK))); + + String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; + String notificationUrl = + "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; + instance.createVnfA("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, + "messageId", msoRequest, notificationUrl); + + wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); + } + + @Test + public void createVNFTest_Exception() throws Exception { + String notificationUrl = + "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; + instance.createVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + "volumeGroupHeatStackId|1", new HashMap<String, Object>(), Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, + "messageId", null, notificationUrl); + + wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); + + } + + @Test + public void updateVnfTest() throws Exception { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")) + .withRequestBody(containing("messageId")).willReturn(aResponse().withStatus(HttpStatus.SC_OK))); + String notificationUrl = + "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; + instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + "volumeGroupHeatStackId|1", map, "messageId", msoRequest, notificationUrl); + } + + @Test + public void updateVnfTest_Exception() throws Exception { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + wireMockServer.stubFor(post(urlPathEqualTo("/notify/adapterNotify/updateVnfNotificationRequest")) + .withRequestBody(containing("messageId")).willReturn(aResponse().withStatus(HttpStatus.SC_OK))); + String notificationUrl = + "http://localhost:" + wireMockPort + "/notify/adapterNotify/updateVnfNotificationRequest"; + instance.updateVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + "volumeGroupHeatStackId|1", map, "messageId", msoRequest, notificationUrl); + wireMockServer.verify(1, postRequestedFor(urlEqualTo("/notify/adapterNotify/updateVnfNotificationRequest"))); + } + + @Test + public void queryVnfTest() { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + instance.queryVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", msoRequest, + "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); + } + + @Test + public void deleteVnfTest() { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + instance.deleteVnfA("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", "messageId", + msoRequest, "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); + } + + @Test + public void rollbackVnfTest() { + VnfRollback vnfRollBack = new VnfRollback(); + vnfRollBack.setCloudSiteId("mdt1"); + vnfRollBack.setCloudOwner("CloudOwner"); + vnfRollBack.setTenantId("88a6ca3ee0394ade9403f075db23167e"); + vnfRollBack.setVnfId("ff5256d1-5a33-55df-13ab-12abad84e7ff"); + instance.rollbackVnfA(vnfRollBack, "messageId", + "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest"); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java index be3b54e23f..0c56222558 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java @@ -21,7 +21,20 @@ package org.onap.so.adapters.vnf; -import com.github.tomakehurst.wiremock.client.WireMock; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.mockito.Mockito.when; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import javax.xml.ws.Holder; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Ignore; @@ -38,8 +51,6 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResource; -import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository; -import org.onap.so.db.catalog.data.repository.VnfResourceRepository; import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; @@ -47,517 +58,510 @@ import org.onap.so.openstack.beans.VnfRollback; import org.onap.so.openstack.exceptions.MsoException; import org.onap.so.openstack.utils.MsoHeatUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; - -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.when; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStack; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenstackGetWithResponse; +import com.github.tomakehurst.wiremock.client.WireMock; public class MsoVnfAdapterImplTest extends BaseRestTestUtils { - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Autowired - private MsoHeatUtils heatUtils; - - @Autowired - MsoVnfAdapterImpl instance; - - String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; - - @Before - public void before() throws Exception { - MockitoAnnotations.initMocks(this); - WireMock.reset(); - setUp(); - } - - @Test - @Ignore - public void healthCheckVNFTest() { - MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); - instance.healthCheck(); - } - - @Test - public void createVnfTest() throws Exception { - StackInfo info = new StackInfo(); - info.setStatus(HeatStatus.CREATED); - - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_HeatStatusUpdating() throws Exception { - expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); - - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Updating_VfModule.json") - .withStatus(HttpStatus.SC_OK))); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_HeatStatusUpdated() throws Exception { - expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); - - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_StackId.json") - .withStatus(HttpStatus.SC_OK))); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_HeatStatusFailed() throws Exception { - expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); - - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Failed_VfModule.json") - .withStatus(HttpStatus.SC_OK))); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_HeatStatusCreated() throws Exception { - expectedException.expect(VnfAlreadyExists.class); - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackGetStackVfModule_200(); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - - @Test - public void createVnfTest_ExceptionInGettingHeat() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_NestedHeatStatusNotFound() throws Exception { - expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_ExceptionInGettingNestedHeat() throws Exception { - expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_NestedBaseHeatStatus_NotFound() throws Exception { - expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") - .withStatus(HttpStatus.SC_OK))); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_ExceptionInGettingBaseNestedHeat() throws Exception { - expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_ExceptionInCreateStack() throws Exception { - expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - VfModule vfModule = new VfModule(); - vfModule.setIsBase(false); - - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setTemplateBody(""); - heatTemplate.setTimeoutMinutes(200); - vfModule.setModuleHeatTemplate(heatTemplate); - vfModuleCustomization.setVfModule(vfModule); - - HeatEnvironment heatEnvironment = new HeatEnvironment(); - heatEnvironment.setEnvironment("ist"); - vfModuleCustomization.setHeatEnvironment(heatEnvironment); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_ModelCustUuidIsNull() throws Exception { - expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - VfModule vfModule = new VfModule(); - vfModule.setIsBase(false); - - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setTemplateBody(""); - heatTemplate.setTimeoutMinutes(200); - vfModule.setModuleHeatTemplate(heatTemplate); - vfModuleCustomization.setVfModule(vfModule); - - HeatEnvironment heatEnvironment = new HeatEnvironment(); - heatEnvironment.setEnvironment("ist"); - vfModuleCustomization.setHeatEnvironment(heatEnvironment); - - VnfResource vnfResource = new VnfResource(); - vnfResource.setAicVersionMin("1"); - vnfResource.setAicVersionMin("3"); - - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void createVnfTest_HeatEnvironment_ContainsParameters() throws Exception { - expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); - - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - private MsoRequest getMsoRequest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - return msoRequest; - } - - @Test - public void updateVnfTest_CloudSiteIdNotFound() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest_HeatStackNotFound() throws Exception { - expectedException.expect(VnfNotFound.class); - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest_ExceptionInGettingNestedHeatStack() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest_NestedHeatStackNotFound() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_NOT_FOUND))); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest_ExceptionInGettingNestedBaseHeatStack() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_INTERNAL_SERVER_ERROR,"OpenstackResponse_Stack_Created_VfModule.json"); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest_NestedBaseHeatStackNotFound() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_NOT_FOUND,"OpenstackResponse_Stack_Created_VfModule.json"); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest_MissingParams() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest_UpdateStackException() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - - VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); - vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - public void updateVnfTest() throws Exception { - MsoRequest msoRequest = getMsoRequest(); - mockOpenStackResponseAccess(wireMockPort); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/"+vnfName,HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/volumeGroupHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/baseVfHeatStackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_Created_VfModule.json"); - mockOpenStackPutStack("null/stackId", HttpStatus.SC_OK); - mockOpenstackGetWithResponse("/mockPublicUrl/stacks/null/stackId",HttpStatus.SC_OK,"OpenstackResponse_Stack_UpdateComplete.json"); - - VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); - vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - instance.updateVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", - "b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); - } - - @Test - @Ignore - public void deleteVnfTest() throws MsoException { - - Map<String, Object> outputs = new HashMap<>(); - outputs.put("Key1", "value1"); - when(heatUtils.queryStackForOutputs("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12")).thenReturn(outputs); - - MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); - MsoRequest msoRequest = getMsoRequest(); - try { - instance.deleteVfModule("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, - new Holder<Map<String, String>>()); - } catch (Exception e) { - - } - } - - private VfModuleCustomization getVfModuleCustomization() { - VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); - VfModule vfModule = new VfModule(); - vfModule.setIsBase(false); - - HeatTemplate heatTemplate = new HeatTemplate(); - heatTemplate.setTemplateBody(""); - heatTemplate.setTimeoutMinutes(200); - HeatTemplateParam heatTemplateParam = new HeatTemplateParam(); - heatTemplateParam.setParamAlias("ParamAlias"); - heatTemplateParam.setRequired(true); - heatTemplateParam.setParamName("test"); - Set set = new HashSet(); - set.add(heatTemplateParam); - heatTemplate.setParameters(set); - vfModule.setModuleHeatTemplate(heatTemplate); - vfModuleCustomization.setVfModule(vfModule); - - HeatEnvironment heatEnvironment = new HeatEnvironment(); - heatEnvironment.setEnvironment("parameters:ist"); - vfModuleCustomization.setHeatEnvironment(heatEnvironment); - return vfModuleCustomization; - } + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Autowired + private MsoHeatUtils heatUtils; + + @Autowired + MsoVnfAdapterImpl instance; + + String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"; + + @Test + @Ignore + public void healthCheckVNFTest() { + MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); + instance.healthCheck(); + } + + @Test + public void createVnfTest() throws Exception { + StackInfo info = new StackInfo(); + info.setStatus(HeatStatus.CREATED); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_HeatStatusUpdating() throws Exception { + expectedException.expect(VnfAlreadyExists.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + wireMockServer.stubFor(get( + urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Stack_Updating_VfModule.json") + .withStatus(HttpStatus.SC_OK))); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_HeatStatusUpdated() throws Exception { + expectedException.expect(VnfAlreadyExists.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + wireMockServer.stubFor(get( + urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK))); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_HeatStatusFailed() throws Exception { + expectedException.expect(VnfAlreadyExists.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + wireMockServer.stubFor(get( + urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Stack_Failed_VfModule.json") + .withStatus(HttpStatus.SC_OK))); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_HeatStatusCreated() throws Exception { + expectedException.expect(VnfAlreadyExists.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackGetStackVfModule_200(wireMockServer); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + + @Test + public void createVnfTest_ExceptionInGettingHeat() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_NestedHeatStatusNotFound() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_ExceptionInGettingNestedHeat() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_NestedBaseHeatStatus_NotFound() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_ExceptionInGettingBaseNestedHeat() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer + .stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse() + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")) + .willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_ExceptionInCreateStack() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer + .stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse() + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse() + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + VfModule vfModule = new VfModule(); + vfModule.setIsBase(false); + + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateBody(""); + heatTemplate.setTimeoutMinutes(200); + vfModule.setModuleHeatTemplate(heatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setEnvironment("ist"); + vfModuleCustomization.setHeatEnvironment(heatEnvironment); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_ModelCustUuidIsNull() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer + .stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse() + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse() + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + VfModule vfModule = new VfModule(); + vfModule.setIsBase(false); + + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateBody(""); + heatTemplate.setTimeoutMinutes(200); + vfModule.setModuleHeatTemplate(heatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setEnvironment("ist"); + vfModuleCustomization.setHeatEnvironment(heatEnvironment); + + VnfResource vnfResource = new VnfResource(); + vnfResource.setAicVersionMin("1"); + vnfResource.setAicVersionMin("3"); + + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "XVFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, + Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), + new Holder<VnfRollback>()); + } + + @Test + public void createVnfTest_HeatEnvironment_ContainsParameters() throws Exception { + expectedException.expect(VnfException.class); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer + .stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse() + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse() + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", + "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + private MsoRequest getMsoRequest() { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + return msoRequest; + } + + @Test + public void updateVnfTest_CloudSiteIdNotFound() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", + "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "vfModuleStackId", + "88a6ca3ee0394ade9403f075db23167e", map, msoRequest, new Holder<Map<String, String>>(), + new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest_HeatStackNotFound() throws Exception { + expectedException.expect(VnfNotFound.class); + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", + map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest_ExceptionInGettingNestedHeatStack() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", + map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest_NestedHeatStackNotFound() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", + map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest_ExceptionInGettingNestedBaseHeatStack() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId", + HttpStatus.SC_INTERNAL_SERVER_ERROR, "OpenstackResponse_Stack_Created_VfModule.json"); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", + map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest_NestedBaseHeatStackNotFound() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId", HttpStatus.SC_NOT_FOUND, + "OpenstackResponse_Stack_Created_VfModule.json"); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", + map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest_MissingParams() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", + map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest_UpdateStackException() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + + VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); + vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", "88a6ca3ee0394ade9403f075db23167e", + map, msoRequest, new Holder<Map<String, String>>(), new Holder<VnfRollback>()); + } + + @Test + public void updateVnfTest() throws Exception { + MsoRequest msoRequest = getMsoRequest(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/" + vnfName, HttpStatus.SC_OK, + "OpenstackResponse_Stack_UpdateComplete.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/volumeGroupHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/baseVfHeatStackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_Created_VfModule.json"); + mockOpenStackPutStack(wireMockServer, "null/stackId", HttpStatus.SC_OK); + mockOpenstackGetWithResponse(wireMockServer, "/mockPublicUrl/stacks/null/stackId", HttpStatus.SC_OK, + "OpenstackResponse_Stack_UpdateComplete.json"); + + VfModuleCustomization vfModuleCustomization = getVfModuleCustomization(); + vfModuleCustomization.getVfModule().getModuleHeatTemplate().setParameters(new HashSet<>()); + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + instance.updateVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", vnfName, "VFMOD", + "volumeGroupHeatStackId", "baseVfHeatStackId", "vfModuleStackId", + "b4ea86b4-253f-11e7-93ae-92361f002671", map, msoRequest, new Holder<Map<String, String>>(), + new Holder<VnfRollback>()); + } + + @Test + @Ignore + public void deleteVnfTest() throws MsoException { + + Map<String, Object> outputs = new HashMap<>(); + outputs.put("Key1", "value1"); + when(heatUtils.queryStackForOutputs("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12")) + .thenReturn(outputs); + + MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl(); + MsoRequest msoRequest = getMsoRequest(); + try { + instance.deleteVfModule("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, + new Holder<Map<String, String>>()); + } catch (Exception e) { + + } + } + + private VfModuleCustomization getVfModuleCustomization() { + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + VfModule vfModule = new VfModule(); + vfModule.setIsBase(false); + + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateBody(""); + heatTemplate.setTimeoutMinutes(200); + HeatTemplateParam heatTemplateParam = new HeatTemplateParam(); + heatTemplateParam.setParamAlias("ParamAlias"); + heatTemplateParam.setRequired(true); + heatTemplateParam.setParamName("test"); + Set set = new HashSet(); + set.add(heatTemplateParam); + heatTemplate.setParameters(set); + vfModule.setModuleHeatTemplate(heatTemplate); + vfModuleCustomization.setVfModule(vfModule); + + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setEnvironment("parameters:ist"); + vfModuleCustomization.setHeatEnvironment(heatEnvironment); + return vfModuleCustomization; + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java index 44843900fc..3e5d4ad29a 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImplTest.java @@ -21,6 +21,14 @@ package org.onap.so.adapters.vnf; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertTrue; +import java.util.HashMap; +import java.util.Map; +import javax.xml.ws.Holder; import org.apache.http.HttpStatus; import org.junit.Before; import org.junit.Rule; @@ -33,277 +41,269 @@ import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; import org.springframework.beans.factory.annotation.Autowired; -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.Map; +public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { -import static com.github.tomakehurst.wiremock.client.WireMock.*; + @Rule + public ExpectedException expectedException = ExpectedException.none(); -public class MsoVnfCloudifyAdapterImplTest extends BaseRestTestUtils { + @Autowired + private MsoVnfCloudifyAdapterImpl instance; - @Rule - public ExpectedException expectedException = ExpectedException.none(); - - @Autowired - private MsoVnfCloudifyAdapterImpl instance; - - @Autowired - private CloudConfig cloudConfig; - - @Before - public void before() throws Exception { - super.setUp(); - CloudifyManager cloudifyManager = new CloudifyManager(); - cloudifyManager.setId("mtn13"); - cloudifyManager.setCloudifyUrl("http://localhost:"+wireMockPort+"/v2.0"); - cloudifyManager.setUsername("m93945"); - cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369"); - } - - @Test + @Autowired + private CloudConfig cloudConfig; + + @Before + public void before() throws Exception { + super.setUp(); + CloudifyManager cloudifyManager = new CloudifyManager(); + cloudifyManager.setId("mtn13"); + cloudifyManager.setCloudifyUrl("http://localhost:" + wireMockPort + "/v2.0"); + cloudifyManager.setUsername("m93945"); + cloudifyManager.setPassword("93937EA01B94A10A49279D4572B48369"); + } + + @Test public void queryVnfExceptionTest() throws Exception { - reset(); - expectedException.expect(VnfException.class); MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); + Holder<Map<String, String>> outputs = new Holder<>(); + instance.queryVnf("siteid", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), + new Holder<>(), outputs); - instance.queryVnf("siteid", "1234", "vfname", - msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), - new Holder<>()); + assertTrue(outputs.value.isEmpty()); } - @Test - public void queryVnfTest() throws Exception { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() - .withBody("{ \"id\": \"123\" }") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() - .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() - .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() - .withBodyFile("OpenstackResponse_Access.json") - .withStatus(HttpStatus.SC_OK))); - - instance.queryVnf("mtn13", "1234", "vfname", - msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), - new Holder<>()); - } - - @Test - public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>()); - } - - @Test - public void deleteVfModuleTest_ExceptionWhileDeleteDeployment() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() - .withBody("{ \"id\": \"123\" }") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() - .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() - .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() - .withBodyFile("OpenstackResponse_Access.json") - .withStatus(HttpStatus.SC_OK))); - - instance.deleteVfModule("mtn13", "1234", "vfname", msoRequest, new Holder<>()); - } - - @Test + @Test + public void queryVnfTest() throws Exception { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")) + .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")) + .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") + .withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() + .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") + .withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")) + .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK))); + + instance.queryVnf("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>(), new Holder<>(), + new Holder<>(), new Holder<>()); + } + + @Test + public void deleteVfModuleTest_ExceptionWhileQueryDeployment() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>()); + } + + @Test + public void deleteVfModuleTest_ExceptionWhileDeleteDeployment() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")) + .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")) + .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") + .withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() + .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") + .withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")) + .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK))); + + instance.deleteVfModule("mtn13", "CloudOwner", "1234", "vfname", msoRequest, new Holder<>()); + } + + @Test public void deleteVnfVnfExceptionTest() throws Exception { - expectedException.expect(VnfException.class); + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + instance.deleteVnf("12344", "CloudOwner", "234", "vnfname", msoRequest); + + } + + @Test + public void rollbackVnf() throws Exception { MsoRequest msoRequest = new MsoRequest(); msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - instance.deleteVnf("12344", "234", "vnfname", msoRequest); + VnfRollback vnfRollback = new VnfRollback(); + vnfRollback.setModelCustomizationUuid("1234"); + vnfRollback.setVfModuleStackId("2134"); + vnfRollback.setVnfId("123"); + vnfRollback.setModelCustomizationUuid("1234"); + instance.rollbackVnf(vnfRollback); } - @Test - public void rollbackVnf() throws Exception { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); + @Test + public void rollbackVnf_Created() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); VnfRollback vnfRollback = new VnfRollback(); vnfRollback.setModelCustomizationUuid("1234"); vnfRollback.setVfModuleStackId("2134"); vnfRollback.setVnfId("123"); vnfRollback.setModelCustomizationUuid("1234"); + vnfRollback.setVnfCreated(true); instance.rollbackVnf(vnfRollback); - } - - @Test - public void rollbackVnf_Created() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - VnfRollback vnfRollback = new VnfRollback(); - vnfRollback.setModelCustomizationUuid("1234"); - vnfRollback.setVfModuleStackId("2134"); - vnfRollback.setVnfId("123"); - vnfRollback.setModelCustomizationUuid("1234"); - vnfRollback.setVnfCreated(true); - - instance.rollbackVnf(vnfRollback); - } - - @Test - public void createVfModuleVnfException() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); - } - - @Test - public void createVfModule_ModelCustUuidIsNull() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", null, new - HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); - } - - @Test - public void createVfModule_CloudSiteIdNotFound() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - instance.createVfModule("123", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); - } - - @Test - public void createVfModule_MsoCloudifyManagerNotFound() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - instance.createVfModule("mtn13", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); - } - - @Test - public void createVfModule() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")).willReturn(aResponse() - .withBody("{ \"id\": \"123\" }") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")).willReturn(aResponse() - .withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() - .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") - .withStatus(HttpStatus.SC_OK))); - - stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")).willReturn(aResponse() - .withBodyFile("OpenstackResponse_Access.json") - .withStatus(HttpStatus.SC_OK))); - - instance.createVfModule("mtn13", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); - } - - @Test - public void updateVfModuleVnfException() throws Exception { - expectedException.expect(VnfException.class); - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - instance.updateVfModule("123", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", new HashMap<>(), msoRequest, new Holder<>(), new Holder<>()); - } - - @Test - public void healthCheckVNFTest() { - instance.healthCheck(); - } - - @Test - public void createVnfTest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - Map<String, Object> map = new HashMap<>(); - map.put("key1", "value1"); - try { - instance.createVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", map, - Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, msoRequest, new Holder<>(), new Holder<>(), - new Holder<>()); - } catch (Exception e) { - } - } - - @Test - public void updateVnfTest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - - Map<String, Object> map = new HashMap<>(); - - map.put("key1", "value1"); - try { - instance.updateVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", - "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(), - new Holder<>()); - } catch (Exception e) { - - } - } - - @Test - public void deleteVnfTest() { - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId("12345"); - msoRequest.setServiceInstanceId("12345"); - try { - instance.deleteVnf("mdt1", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest); - } catch (Exception e) { - - } - } + } + + @Test + public void createVfModuleVnfException() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", + "123", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + } + + @Test + public void createVfModule_ModelCustUuidIsNull() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", + null, new HashMap<>(), true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + } + + @Test + public void createVfModule_CloudSiteIdNotFound() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + instance.createVfModule("123", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", + "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), + new Holder<>(), new Holder<>()); + } + + @Test + public void createVfModule_MsoCloudifyManagerNotFound() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "module-005", "", "create", "3245", "234", + "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), + new Holder<>(), new Holder<>()); + } + + @Test + public void createVfModule() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname")) + .willReturn(aResponse().withBody("{ \"id\": \"123\" }").withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/deployments/vfname/outputs")) + .willReturn(aResponse().withBody("{ \"deployment_id\": \"123\",\"outputs\":{\"abc\":\"abc\"} }") + .withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlMatching("/v2.0/api/v3/executions?.*")).willReturn(aResponse() + .withBody("{ \"items\": {\"id\": \"123\",\"workflow_id\":\"install\",\"status\":\"terminated\" } } ") + .withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo("/v2.0/api/v3/tokens")) + .willReturn(aResponse().withBodyFile("OpenstackResponse_Access.json").withStatus(HttpStatus.SC_OK))); + + instance.createVfModule("mtn13", "CloudOwner", "123", "vf", "v1", "", "vfname", "", "create", "3245", "234", + "9b339a61-69ca-465f-86b8-1c72c582b8e8", new HashMap<>(), true, true, true, msoRequest, new Holder<>(), + new Holder<>(), new Holder<>()); + } + + @Test + public void updateVfModuleVnfException() throws Exception { + expectedException.expect(VnfException.class); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + instance.updateVfModule("123", "CloudOwner", "1234", "fw", "v2", "vnf1", "create", "123", "12", "233", "234", + new HashMap<>(), msoRequest, new Holder<>(), new Holder<>()); + } + + @Test + public void healthCheckVNFTest() { + instance.healthCheck(); + } + + @Test + public void createVnfTest() { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + Map<String, Object> map = new HashMap<>(); + map.put("key1", "value1"); + try { + instance.createVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + "volumeGroupHeatStackId|1", map, Boolean.FALSE, Boolean.TRUE, Boolean.TRUE, msoRequest, + new Holder<>(), new Holder<>(), new Holder<>()); + } catch (Exception e) { + } + } + + @Test + public void updateVnfTest() { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + + Map<String, Object> map = new HashMap<>(); + + map.put("key1", "value1"); + try { + instance.updateVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "vSAMP12", "VFMOD", + "volumeGroupHeatStackId|1", map, msoRequest, new Holder<>(), new Holder<>()); + } catch (Exception e) { + + } + } + + @Test + public void deleteVnfTest() { + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); + try { + instance.deleteVnf("mdt1", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest); + } catch (Exception e) { + + } + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java index 376076a0a0..9d13cc10a3 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java @@ -20,33 +20,31 @@ package org.onap.so.adapters.vnf; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import java.util.HashMap; +import java.util.Map; +import javax.xml.ws.Holder; import org.apache.http.HttpStatus; -import org.junit.Assert; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication; +import org.onap.so.adapters.vdu.VduModelInfo; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.cloud.CloudConfig; -import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.entity.MsoRequest; +import org.onap.so.openstack.beans.StackInfo; +import org.onap.so.openstack.exceptions.MsoException; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.web.server.LocalServerPort; - -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.Map; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ +public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils { @Rule public ExpectedException expectedException = ExpectedException.none(); @@ -56,19 +54,37 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ @Autowired private CloudConfig cloudConfig; + private static final String CREATE_STACK_RESPONSE = "{\"template_type\": \"TEST-template\", \"workload_id\": " + + "\"workload-id\", \"template_response\": {\"stack\": {\"id\": \"TEST-stack\", \"links\": []}}}"; + private static final String UPDATE_STACK_RESPONSE = + "{\"template_type\": \"heat\", \"workload_id\": " + "\"workload-id\"}"; + private static final String GET_CREATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": " + + "\"workload-id\", \"workload_status\": \"CREATE_COMPLETE\"}"; + private static final String GET_UPDATE_STACK_RESPONSE = "{\"template_type\": \"heat\", \"workload_id\": " + + "\"workload-id\", \"workload_status\": \"UPDATE_COMPLETE\"}"; + + private static final String MULTICLOUD_CREATE_PATH = "/api/multicloud/v1/CloudOwner/MTN13/infra_workload"; + private static final String MULTICLOUD_UPDATE_PATH = + "/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id"; + private static final String MULTICLOUD_GET_PATH_BY_NAME = + "/api/multicloud/v1/CloudOwner/MTN13/infra_workload/vfname"; + private static final String MULTICLOUD_GET_PATH_BY_ID = + "/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id"; + @Before public void before() throws Exception { super.orchestrator = "multicloud"; - super.cloudEndpoint = "/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload"; + super.cloudEndpoint = "/api/multicloud/v1/CloudOwner/MTN13/infra_workload"; super.setUp(); } @Test public void createVfModule() throws Exception { - + Map<String, Object> stackInputs = new HashMap<>(); stackInputs.put("oof_directives", "{}"); stackInputs.put("sdnc_directives", "{}"); + stackInputs.put("user_directives", "{}"); stackInputs.put("generic_vnf_id", "genVNFID"); stackInputs.put("vf_module_id", "vfMODULEID"); @@ -76,23 +92,66 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname")).willReturn(aResponse() - //.withHeader() - .withStatus(HttpStatus.SC_NOT_FOUND))); + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_NAME)).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE") + .whenScenarioStateIs("CREATING").willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(GET_CREATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(get(urlPathEqualTo(MULTICLOUD_GET_PATH_BY_ID)).inScenario("CREATE") + .whenScenarioStateIs("UPDATING").willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(GET_UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_OK))); + + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).inScenario("CREATE") + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("MulticloudResponse_Stack_Create.json").withStatus(HttpStatus.SC_CREATED)) + .willSetStateTo("CREATING")); + + wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_UPDATE_PATH)) + .inScenario("CREATE").willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(UPDATE_STACK_RESPONSE).withStatus(HttpStatus.SC_ACCEPTED)) + .willSetStateTo("UPDATING")); + + try { + instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", + "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, + msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + } catch (VnfException e) { + fail("createVfModule success expected, failed with exception: " + e.toString()); + } + wireMockServer.resetScenarios(); + } - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() - //.withHeader() - .withBodyFile("MulticloudResponse_Stack.json") - .withStatus(HttpStatus.SC_OK))); + @Test + public void createVfModuleAlreadyExists() throws Exception { - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/vfname/outputs")).willReturn(aResponse() - .withStatus(HttpStatus.SC_NOT_FOUND))); + Map<String, Object> stackInputs = new HashMap<>(); + stackInputs.put("oof_directives", "{}"); + stackInputs.put("sdnc_directives", "{}"); + stackInputs.put("user_directives", "{}"); + stackInputs.put("generic_vnf_id", "genVNFID"); + stackInputs.put("vf_module_id", "vfMODULEID"); - stubFor(post(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload")).willReturn(aResponse() - .withBodyFile("MulticloudResponse_Stack_Create.json") - .withStatus(HttpStatus.SC_CREATED))); + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId("12345"); + msoRequest.setServiceInstanceId("12345"); - instance.createVfModule("MTN13", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + wireMockServer.stubFor( + get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/vfname")).willReturn(aResponse() + // .withHeader() + .withBodyFile("MulticloudResponse_Stack.json").withStatus(HttpStatus.SC_OK))); + + try { + instance.createVfModule("MTN13", "CloudOwner", "123", "vf", "v1", "genericVnfId", "vfname", "vfModuleId", + "create", null, "234", "9b339a61-69ca-465f-86b8-1c72c582b8e8", stackInputs, true, true, true, + msoRequest, new Holder<>(), new Holder<>(), new Holder<>()); + } catch (VnfException e) { + assertTrue(e.toString().contains( + "Resource vfname already exists in owner/cloud/tenant CloudOwner/MTN13/123 with ID vfname/vfname")); + return; + } + fail("VnfAlreadyExists Exception expected!"); } @Test @@ -101,14 +160,13 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() - .withBodyFile("MulticloudResponse_Stack.json") - .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id")) + .willReturn(aResponse().withBodyFile("MulticloudResponse_Stack.json").withStatus(HttpStatus.SC_OK))); - stubFor(delete(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() - .withStatus(HttpStatus.SC_NO_CONTENT))); + wireMockServer.stubFor(delete(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id")) + .willReturn(aResponse().withStatus(HttpStatus.SC_NO_CONTENT))); - instance.deleteVfModule("MTN13", "123", "workload-id", msoRequest, new Holder<>()); + instance.deleteVfModule("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>()); } @Test @@ -117,11 +175,11 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{ msoRequest.setRequestId("12345"); msoRequest.setServiceInstanceId("12345"); - stubFor(get(urlPathEqualTo("/api/multicloud/v1/cloud_owner/cloud_region_id/infra_workload/workload-id")).willReturn(aResponse() - .withBodyFile("MulticloudResponse_Stack.json") - .withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(get(urlPathEqualTo("/api/multicloud/v1/CloudOwner/MTN13/infra_workload/workload-id")) + .willReturn(aResponse().withBodyFile("MulticloudResponse_Stack.json").withStatus(HttpStatus.SC_OK))); - instance.queryVnf("MTN13", "123", "workload-id", msoRequest, new Holder<>(), new Holder<>(), new Holder<>(), new Holder<>()); + instance.queryVnf("MTN13", "CloudOwner", "123", "workload-id", msoRequest, new Holder<>(), new Holder<>(), + new Holder<>(), new Holder<>()); } // TODO Error Tests diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java index 0cd3d1a61d..be565deb9e 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImplTest.java @@ -20,6 +20,16 @@ package org.onap.so.adapters.vnf; +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.delete; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; +import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; +import java.util.HashMap; +import java.util.Map; +import javax.xml.ws.Holder; import org.apache.http.HttpStatus; import org.junit.Rule; import org.junit.Test; @@ -29,19 +39,6 @@ import org.onap.so.entity.MsoRequest; import org.onap.so.openstack.beans.VnfRollback; import org.springframework.beans.factory.annotation.Autowired; -import javax.xml.ws.Holder; -import java.util.HashMap; -import java.util.Map; - -import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; -import static com.github.tomakehurst.wiremock.client.WireMock.delete; -import static com.github.tomakehurst.wiremock.client.WireMock.get; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; -import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_404; -import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; - public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { @Rule @@ -58,9 +55,9 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", + vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", null, map, Boolean.FALSE, + Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); } @@ -70,10 +67,10 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", + vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", + "88a6ca3ee0394ade9403f075db23167e", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, + new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); } @Test @@ -82,80 +79,79 @@ public class MsoVnfPluginAdapterImplTest extends BaseRestTestUtils { MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", + vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", + "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, + new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); } @Test public void createVfModule_INSTANTIATED() throws Exception { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("MTN13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + msoVnfPluginAdapter.createVfModule("MTN13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", + vnfName, "", "VFMOD", null, "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, + Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), + new Holder<Map<String, String>>(), new Holder<VnfRollback>()); } @Test public void createVfModule_queryVduNotFoundWithVolumeGroupId() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId|1", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", + vnfName, "", "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", + "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, + new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); } @Test public void createVfModule_CreateVduException() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") - .withStatus(HttpStatus.SC_OK))); + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); MsoRequest msoRequest = getMsoRequest(); Map<String, Object> map = new HashMap<>(); map.put("key1", "value1"); - msoVnfPluginAdapter.createVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", - "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, - Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(), - new Holder<VnfRollback>()); + msoVnfPluginAdapter.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", + vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", + "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, + new Holder<>(), new Holder<Map<String, String>>(), new Holder<VnfRollback>()); } @Test public void deleteVfModule_QueryVduException() throws Exception { expectedException.expect(VnfException.class); MsoRequest msoRequest = getMsoRequest(); - msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, - new Holder<Map<String, String>>()); + msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", + msoRequest, new Holder<Map<String, String>>()); } @Test public void deleteVfModule_DeleteVduException() throws Exception { expectedException.expect(VnfException.class); - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_200(); - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") - .withStatus(HttpStatus.SC_OK))); - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_200(wireMockServer); + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vSAMP12")) .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK))); + wireMockServer.stubFor(delete( + urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); MsoRequest msoRequest = getMsoRequest(); - msoVnfPluginAdapter.deleteVfModule("mtn13", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", msoRequest, - new Holder<Map<String, String>>()); + msoVnfPluginAdapter.deleteVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vSAMP12", + msoRequest, new Holder<Map<String, String>>()); } private MsoRequest getMsoRequest() { diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java index 2740e254e1..7e7c130e33 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java @@ -25,11 +25,8 @@ import static org.hamcrest.Matchers.hasProperty; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.when; - import java.util.Map; - import javax.xml.ws.Holder; - import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -48,61 +45,66 @@ import org.onap.so.openstack.utils.MsoHeatUtils; @RunWith(MockitoJUnitRunner.class) public class QueryTest { - - @Mock - private MsoHeatUtils heat; - @InjectMocks - private MsoVnfAdapterImpl vnfAdapter = new MsoVnfAdapterImpl(); - - @Rule - public ExpectedException thrown = ExpectedException.none(); - @Test - public void testQueryCreatedVnf() throws VnfException, MsoException { - StackInfo info = new StackInfo("stackName", HeatStatus.CREATED); - when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); - String cloudId = "MT"; - String tenantId = "MSO_Test"; - String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<>(); - Holder<String> vnfId = new Holder<>(); - Holder<VnfStatus> status = new Holder<>(); - Holder<Map<String, String>> outputs = new Holder<>(); - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); + @Mock + private MsoHeatUtils heat; + @InjectMocks + private MsoVnfAdapterImpl vnfAdapter = new MsoVnfAdapterImpl(); + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public void testQueryCreatedVnf() throws VnfException, MsoException { + StackInfo info = new StackInfo("stackName", HeatStatus.CREATED); + when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); + String cloudId = "MT"; + String cloudOwner = "CloudOwner"; + String tenantId = "MSO_Test"; + String vnfName = "VNF_TEST1"; + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); + + vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); - assertTrue(vnfExists.value); - } + assertTrue(vnfExists.value); + } - @Test - public void testQueryNotFoundVnf() throws VnfException, MsoException { - StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND); - when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); - String cloudId = "MT"; - String tenantId = "MSO_Test"; - String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<>(); - Holder<String> vnfId = new Holder<>(); - Holder<VnfStatus> status = new Holder<>(); - Holder<Map<String, String>> outputs = new Holder<>(); + @Test + public void testQueryNotFoundVnf() throws VnfException, MsoException { + StackInfo info = new StackInfo("stackName", HeatStatus.NOTFOUND); + when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(info); + String cloudId = "MT"; + String cloudOwner = "CloudOwner"; + String tenantId = "MSO_Test"; + String vnfName = "VNF_TEST1"; + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); + vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); - assertFalse(vnfExists.value); - } + assertFalse(vnfExists.value); + } - @Test() - // @Ignore // 1802 merge - public void testQueryVnfWithException() throws VnfException, MsoException { - String cloudId = "MT"; - String tenantId = "MSO_Test"; - String vnfName = "VNF_TEST1"; - Holder<Boolean> vnfExists = new Holder<>(); - Holder<String> vnfId = new Holder<>(); - Holder<VnfStatus> status = new Holder<>(); - Holder<Map<String, String>> outputs = new Holder<>(); - thrown.expect(VnfException.class); - thrown.expectCause(hasProperty("context", is("QueryVNF"))); - when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any())).thenThrow(new MsoOpenstackException(1, "test messsage", "test detail")); - vnfAdapter.queryVnf(cloudId, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); - } + @Test() + // @Ignore // 1802 merge + public void testQueryVnfWithException() throws VnfException, MsoException { + String cloudId = "MT"; + String cloudOwner = "CloudOwner"; + String tenantId = "MSO_Test"; + String vnfName = "VNF_TEST1"; + Holder<Boolean> vnfExists = new Holder<>(); + Holder<String> vnfId = new Holder<>(); + Holder<VnfStatus> status = new Holder<>(); + Holder<Map<String, String>> outputs = new Holder<>(); + thrown.expect(VnfException.class); + thrown.expectCause(hasProperty("context", is("QueryVNF"))); + when(heat.queryStack(Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any())) + .thenThrow(new MsoOpenstackException(1, "test messsage", "test detail")); + vnfAdapter.queryVnf(cloudId, cloudOwner, tenantId, vnfName, null, vnfExists, vnfId, status, outputs); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java index a59de7695c..df2d798cda 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VfRollbackTest.java @@ -1,70 +1,66 @@ /* -* ============LICENSE_START======================================================= - * ONAP : SO - * ================================================================================ - * Copyright (C) 2018 TechMahindra - * ================================================================================ - * 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 + * ============LICENSE_START======================================================= ONAP : SO + * ================================================================================ Copyright (C) 2018 TechMahindra + * ================================================================================ 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 + * 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. + * 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.adapters.vnf; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertEquals; import org.junit.Test; + public class VfRollbackTest { - private VfRollback vfRollback = new VfRollback(); + private VfRollback vfRollback = new VfRollback(); + + @Test + public void test() { + vfRollback.setVnfId("vnfId"); + vfRollback.setTenantId("tenantId"); + vfRollback.setCloudSiteId("cloudId"); + vfRollback.setTenantCreated(true); + vfRollback.setVnfCreated(true); + vfRollback.setMsoRequest(null); + vfRollback.setVolumeGroupName("volumeGroupName"); + vfRollback.setVolumeGroupId("volumeGroupId"); + vfRollback.setRequestType("requestType"); + vfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId"); + vfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId"); + vfRollback.setIsBase(true); + vfRollback.setVfModuleStackId("vfModuleStackId"); + assert (vfRollback.getVnfId() != null); + assert (vfRollback.getTenantId() != null); + assert (vfRollback.getCloudSiteId() != null); + assert (vfRollback.getVolumeGroupName() != null); + assert (vfRollback.getVolumeGroupId() != null); + assert (vfRollback.getRequestType() != null); + assert (vfRollback.getVolumeGroupHeatStackId() != null); + assert (vfRollback.getBaseGroupHeatStackId() != null); + assert (vfRollback.getVfModuleStackId() != null); + assertEquals("vnfId", vfRollback.getVnfId()); + assertEquals("tenantId", vfRollback.getTenantId()); + assertEquals("cloudId", vfRollback.getCloudSiteId()); + assertEquals(true, vfRollback.getTenantCreated()); + assertEquals(true, vfRollback.getVnfCreated()); + assertEquals(null, vfRollback.getMsoRequest()); + assertEquals("volumeGroupName", vfRollback.getVolumeGroupName()); + assertEquals("volumeGroupId", vfRollback.getVolumeGroupId()); + assertEquals("requestType", vfRollback.getRequestType()); + assertEquals("volumeGroupHeatStackId", vfRollback.getVolumeGroupHeatStackId()); + assertEquals("baseGroupHeatStackId", vfRollback.getBaseGroupHeatStackId()); + assertEquals(true, vfRollback.isBase()); + assertEquals("vfModuleStackId", vfRollback.getVfModuleStackId()); + } - @Test - public void test() { - vfRollback.setVnfId("vnfId"); - vfRollback.setTenantId("tenantId"); - vfRollback.setCloudSiteId("cloudId"); - vfRollback.setTenantCreated(true); - vfRollback.setVnfCreated(true); - vfRollback.setMsoRequest(null); - vfRollback.setVolumeGroupName("volumeGroupName"); - vfRollback.setVolumeGroupId("volumeGroupId"); - vfRollback.setRequestType("requestType"); - vfRollback.setVolumeGroupHeatStackId("volumeGroupHeatStackId"); - vfRollback.setBaseGroupHeatStackId("baseGroupHeatStackId"); - vfRollback.setIsBase(true); - vfRollback.setVfModuleStackId("vfModuleStackId"); - assert(vfRollback.getVnfId() != null); - assert(vfRollback.getTenantId() != null); - assert(vfRollback.getCloudSiteId() != null); - assert(vfRollback.getVolumeGroupName() != null); - assert(vfRollback.getVolumeGroupId() != null); - assert(vfRollback.getRequestType() != null); - assert(vfRollback.getVolumeGroupHeatStackId() != null); - assert(vfRollback.getBaseGroupHeatStackId() != null); - assert(vfRollback.getVfModuleStackId() != null); - assertEquals("vnfId", vfRollback.getVnfId()); - assertEquals("tenantId", vfRollback.getTenantId()); - assertEquals("cloudId", vfRollback.getCloudSiteId()); - assertEquals(true, vfRollback.getTenantCreated()); - assertEquals(true, vfRollback.getVnfCreated()); - assertEquals(null, vfRollback.getMsoRequest()); - assertEquals("volumeGroupName", vfRollback.getVolumeGroupName()); - assertEquals("volumeGroupId", vfRollback.getVolumeGroupId()); - assertEquals("requestType", vfRollback.getRequestType()); - assertEquals("volumeGroupHeatStackId", vfRollback.getVolumeGroupHeatStackId()); - assertEquals("baseGroupHeatStackId", vfRollback.getBaseGroupHeatStackId()); - assertEquals(true, vfRollback.isBase()); - assertEquals("vfModuleStackId", vfRollback.getVfModuleStackId()); - } - - @Test - public void testtoString() { - assert(vfRollback.toString() != null); - } + @Test + public void testtoString() { + assert (vfRollback.toString() != null); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java index 343b6245e6..89adafd280 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java @@ -42,7 +42,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; import org.springframework.http.ResponseEntity; - import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; @@ -50,7 +49,6 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; - import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; @@ -73,479 +71,477 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackPutStacks_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; public class VnfAdapterRestTest extends BaseRestTestUtils { - - - @Autowired - private JettisonStyleMapperProvider jettisonTypeObjectMapper; - private static final String MESSAGE_ID = "62265093-277d-4388-9ba6-449838ade586-1517252396874"; - private static final String AAI_VNF_ID = "c93e0d34-5b63-45de-bbae-b0fe49dd3bd9"; - private static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586"; - private static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; - private static final String CLOUDSITE_ID = "mtn13"; - private static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8"; - private static final String VNF_TYPE = "MSOTADevInfra_vSAMP10a_Service/vSAMP10a 1"; - private static final String VNF_NAME = "MSO-DEV-VNF-1802-it3-pwt3-vSAMP10a-1XXX-Replace"; - private static final String VNF_VERSION = "1.0"; - private static final String VF_MODULE_ID = "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c"; - private static final String VF_MODULE_NAME = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"; - private static final String VF_MODULE_TYPE = "vSAMP10aDEV::PCM::module-2"; - private static final String MODEL_CUSTOMIZATION_UUID = "cb82ffd8-252a-11e7-93ae-92361f002671"; - private static final String BASE_VF_MODULE_ID = "3d7ff7b4-720b-4604-be0a-1974fc58ed96"; - // vfModuleParams specific variables - private static final String NETWORK_NAME = "Dev-vSAMP10a-ntwk-1802-pwt3-v6-Replace-1001"; - private static final String SERVER_NAME = "Dev-vSAMP10a-addon2-1802-pwt3-v6-Replace-1001"; - private static final String IMAGE = "ubuntu_14.04_IPv6"; - private static final String EXN_DIRECT_NET_FQDN = "direct"; - private static final String EXN_HSL_NET_FQDN = "hsl"; - private static final String AVAILABILITY_ZONE_0 = "nova"; - private static final String VF_MODULE_INDEX = "0"; - private static final String REQUEST_TYPE = ""; - - @Test - public void testCreateVfModule() throws JSONException, JsonParseException, JsonMappingException, IOException { - - CreateVfModuleRequest request = populateCreateVfModuleRequest(); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackGetStackVfModule_404(); - - mockOpenStackPostStacks_200(); - - mockOpenStackGetStackVfModule_200(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); - - ResponseEntity<CreateVfModuleResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, CreateVfModuleResponse.class); - - ResponseEntity<CreateVfModuleResponse> responseV2 = restTemplate.exchange( - createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, CreateVfModuleResponse.class); - - CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - - assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value()); - assertThat(responseV2.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testCreateVfModuleAsyncCall() throws Exception { - CreateVfModuleRequest request = populateCreateVfModuleRequest(); - request.setNotificationUrl( createURLWithPort("/mso/WorkflowMesssage")); - - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStackVfModule_404(); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); - - ResponseEntity<CreateVfModuleResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, CreateVfModuleResponse.class); - - CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class); - - assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); - } - - @Test - public void testCreateVfModuleWithEnableBridgeNull() - throws JSONException, JsonParseException, JsonMappingException, IOException { - - CreateVfModuleRequest request = new CreateVfModuleRequest(); - request.setBackout(true); - request.setSkipAAI(true); - request.setFailIfExists(false); - MsoRequest msoReq = new MsoRequest(); - boolean failIfExists = true; - Boolean enableBridge = null; - Map<String, Object> vfModuleParams = new HashMap<>(); - - - vfModuleParams.put("vf_module_id", VF_MODULE_ID); - vfModuleParams.put("vnf_id", AAI_VNF_ID); - vfModuleParams.put("network_name", NETWORK_NAME); - vfModuleParams.put("vnf_name", VNF_NAME); - vfModuleParams.put("environment_context", ""); - vfModuleParams.put("server_name", SERVER_NAME); - vfModuleParams.put("image", IMAGE); - vfModuleParams.put("workload_context", ""); - vfModuleParams.put("vf_module_index", VF_MODULE_INDEX); - vfModuleParams.put("vf_module_name", VF_MODULE_NAME); - vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0); - vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); - vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setRequestType(REQUEST_TYPE); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setVnfId(AAI_VNF_ID); - request.setVnfVersion(VNF_VERSION); - request.setVfModuleId(VF_MODULE_ID); - request.setVfModuleName(VF_MODULE_NAME); - request.setBaseVfModuleId(BASE_VF_MODULE_ID); - request.setFailIfExists(failIfExists); - request.setEnableBridge(enableBridge); - request.setVfModuleParams(vfModuleParams); - request.setMessageId(MESSAGE_ID); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackGetStackVfModule_404(); - - mockOpenStackPostStacks_200(); - - mockOpenStackGetStackVfModule_200(); - - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); - - ResponseEntity<CreateVfModuleResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, CreateVfModuleResponse.class); - - CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testCreateVfModuleFail() throws IOException{ - - CreateVfModuleRequest request = new CreateVfModuleRequest(); - request.setBackout(true); - request.setSkipAAI(true); - request.setFailIfExists(false); - MsoRequest msoReq = new MsoRequest(); - boolean failIfExists = true; - boolean enableBridge = false; - Map<String, Object> vfModuleParams = new HashMap<>(); - - vfModuleParams.put("vf_module_id", VF_MODULE_ID); - vfModuleParams.put("vnf_id", AAI_VNF_ID); - vfModuleParams.put("network_name", NETWORK_NAME); - vfModuleParams.put("vnf_name", VNF_NAME); - vfModuleParams.put("environment_context", ""); - vfModuleParams.put("server_name", SERVER_NAME); - vfModuleParams.put("image", IMAGE); - vfModuleParams.put("workload_context", ""); - vfModuleParams.put("vf_module_index", VF_MODULE_INDEX); - vfModuleParams.put("vf_module_name", VF_MODULE_NAME); - vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0); - vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); - vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setRequestType(REQUEST_TYPE); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setVnfId(AAI_VNF_ID); - request.setVnfType(VNF_TYPE); - request.setVnfVersion(VNF_VERSION); - request.setVfModuleId(VF_MODULE_ID); - request.setVfModuleName(VF_MODULE_NAME); - request.setVfModuleType(VF_MODULE_TYPE); - request.setBaseVfModuleStackId(BASE_VF_MODULE_ID); - request.setFailIfExists(failIfExists); - request.setEnableBridge(enableBridge); - request.setVfModuleParams(vfModuleParams); - request.setMessageId(MESSAGE_ID); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackGetStackVfModule_404(); - - mockOpenStackGetStacks_404(); - - mockOpenStackPostStacks_200(); - - mockOpenStackGetStackVfModule_200(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); - - ResponseEntity<VfModuleExceptionResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, VfModuleExceptionResponse.class); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - - mockOpenStackGetStacksWithBody_200("DELETE_IN_PROGRESS"); - - response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, VfModuleExceptionResponse.class); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - - mockOpenStackGetStacksWithBody_200("DELETE_FAILED"); - - response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, VfModuleExceptionResponse.class); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); - - response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, VfModuleExceptionResponse.class); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - - mockOpenStackGetStacksWithBody_404(); - - response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), HttpMethod.POST, - entity, VfModuleExceptionResponse.class); - - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); - - } - - @Test - public void testDeleteVfModule() throws IOException{ - - DeleteVfModuleRequest request = new DeleteVfModuleRequest(); - MsoRequest msoRequest = new MsoRequest(); - String vfModuleStackId = "stackId"; - - msoRequest.setRequestId(MSO_REQUEST_ID); - msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setVfModuleId(VF_MODULE_ID); - request.setVfModuleStackId(vfModuleStackId); - request.setVnfId(AAI_VNF_ID); - request.setMsoRequest(msoRequest); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackPostStacks_200(); - - mockOpenStackGetStacksStackId_404(); - - mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockPort); - - mockOpenStackDeletePublicUrlStackByNameAndID_204(); - - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<DeleteVfModuleRequest> entity = new HttpEntity<DeleteVfModuleRequest>(request, headers); - - ResponseEntity<DeleteVfModuleResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID), HttpMethod.DELETE, - entity, DeleteVfModuleResponse.class); - - ResponseEntity<DeleteVfModuleResponse> responseV2 = restTemplate.exchange( - createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID), HttpMethod.DELETE, - entity, DeleteVfModuleResponse.class); - - - DeleteVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/DeleteVfModuleResponse.json"), DeleteVfModuleResponse.class); - - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - - assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value()); - assertThat(responseV2.getBody(), sameBeanAs(expectedResponse)); - } - - @Test - public void testUpdateVfModule() throws IOException{ - - UpdateVfModuleRequest request = new UpdateVfModuleRequest(); - MsoRequest msoRequest = new MsoRequest(); - String vfModuleStackId = "vfModuleStackId"; - Boolean failIfExists = false; - Boolean backout = false; - msoRequest.setRequestId(MSO_REQUEST_ID); - msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - - Map<String, Object> vfModuleParams = new HashMap<>(); - - vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); - vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); - - Map<String, String> vfModuleOutputs = new HashMap<String, String>(); - - vfModuleOutputs.put("output name", "output value"); - - request.setBackout(backout); - request.setCloudSiteId(CLOUDSITE_ID); - request.setFailIfExists(failIfExists); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setMsoRequest(msoRequest); - request.setRequestType(REQUEST_TYPE); - request.setTenantId(TENANT_ID); - request.setVfModuleId(VF_MODULE_ID); - request.setVfModuleName(VF_MODULE_NAME); - request.setVfModuleStackId(vfModuleStackId); - request.setBackout(backout); - request.setVfModuleParams(vfModuleParams); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockPort); - - mockOpenStackGetStacksVfModule_200(wireMockPort); - - mockOpenStackGetStacksBaseStack_200(wireMockPort); - - mockOpenStackPutStacks_200(); - - UpdateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/UpdateVfModuleResponse.json"), UpdateVfModuleResponse.class); - expectedResponse.setVfModuleOutputs(vfModuleOutputs); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<UpdateVfModuleRequest> entity = new HttpEntity<UpdateVfModuleRequest>(request, headers); - - ResponseEntity<UpdateVfModuleResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE), HttpMethod.PUT, - entity, UpdateVfModuleResponse.class); - - ResponseEntity<UpdateVfModuleResponse> responseV2 = restTemplate.exchange( - createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE), HttpMethod.PUT, - entity, UpdateVfModuleResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - - assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value()); - assertThat(responseV2.getBody(), sameBeanAs(expectedResponse)); - - } - - @Test - public void testRollbackVfModule() throws IOException { - - - MsoRequest msoRequest = new MsoRequest(); - msoRequest.setRequestId(MSO_REQUEST_ID); - msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - - VfModuleRollback vfModuleRollback = new VfModuleRollback(AAI_VNF_ID, VF_MODULE_ID, - "StackId", false, TENANT_ID, CLOUDSITE_ID, msoRequest, "messageId"); - - RollbackVfModuleRequest request = new RollbackVfModuleRequest(); - request.setVfModuleRollback(vfModuleRollback); - - mockOpenStackResponseAccess(wireMockPort); - - mockOpenStackGetStacksStackId_200(wireMockPort); - - mockOpenStackDeleteStacks(); - - mockOpenStackGetStacksVUSP_404(); - - headers.add("Accept", MediaType.APPLICATION_JSON); - HttpEntity<RollbackVfModuleRequest> entity = new HttpEntity<RollbackVfModuleRequest>(request, headers); - - ResponseEntity<RollbackVfModuleResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID + "/rollback"), HttpMethod.DELETE, - entity, RollbackVfModuleResponse.class); - - RollbackVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/RollbackVfModuleResponse.json"),RollbackVfModuleResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - - } - - @Ignore - @Test - public void testQueryVfModule() throws IOException{ - - String testUrl = createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID); - String testUri = UriBuilder.fromPath("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID ) - .host("localhost").port(wireMockPort).scheme("http") - //.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID) - .build().toString(); - System.out.println(testUri); - - mockOpenStackResponseAccess(wireMockPort); - - - headers.add("Accept", MediaType.APPLICATION_JSON); - //HttpEntity entity = new HttpEntity(null, headers); - ResponseEntity<QueryVfModuleResponse> response = restTemplate.getForEntity(testUri, QueryVfModuleResponse.class); - //System.out.println(response); - - QueryVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( - new File("src/test/resources/__files/QueryVfModuleResponse.json"),QueryVfModuleResponse.class); - - assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); - assertThat(response.getBody(), sameBeanAs(expectedResponse)); - } - - private CreateVfModuleRequest populateCreateVfModuleRequest(){ - CreateVfModuleRequest request = new CreateVfModuleRequest(); - request.setBackout(true); - request.setSkipAAI(true); - request.setFailIfExists(false); - MsoRequest msoReq = new MsoRequest(); - boolean failIfExists = true; - boolean enableBridge = false; - Map<String, Object> vfModuleParams = new HashMap<>(); - - vfModuleParams.put("vf_module_id", VF_MODULE_ID); - vfModuleParams.put("vnf_id", AAI_VNF_ID); - vfModuleParams.put("network_name", NETWORK_NAME); - vfModuleParams.put("vnf_name", VNF_NAME); - vfModuleParams.put("environment_context", ""); - vfModuleParams.put("server_name", SERVER_NAME); - vfModuleParams.put("image", IMAGE); - vfModuleParams.put("workload_context", ""); - vfModuleParams.put("vf_module_index", VF_MODULE_INDEX); - vfModuleParams.put("vf_module_name", VF_MODULE_NAME); - vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0); - vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); - vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); - - msoReq.setRequestId(MSO_REQUEST_ID); - msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); - request.setMsoRequest(msoReq); - request.setRequestType(REQUEST_TYPE); - request.setCloudSiteId(CLOUDSITE_ID); - request.setTenantId(TENANT_ID); - request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); - request.setVnfId(AAI_VNF_ID); - request.setVnfType(VNF_TYPE); - request.setVnfVersion(VNF_VERSION); - request.setVfModuleId(VF_MODULE_ID); - request.setVfModuleName(VF_MODULE_NAME); - request.setVfModuleType(VF_MODULE_TYPE); - request.setBaseVfModuleId(BASE_VF_MODULE_ID); - request.setFailIfExists(failIfExists); - request.setEnableBridge(enableBridge); - request.setVfModuleParams(vfModuleParams); - request.setMessageId(MESSAGE_ID); - - return request; - } + + + @Autowired + private JettisonStyleMapperProvider jettisonTypeObjectMapper; + private static final String MESSAGE_ID = "62265093-277d-4388-9ba6-449838ade586-1517252396874"; + private static final String AAI_VNF_ID = "c93e0d34-5b63-45de-bbae-b0fe49dd3bd9"; + private static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586"; + private static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a"; + private static final String CLOUDSITE_ID = "mtn13"; + private static final String CLOUD_OWNER = "CloudOwner"; + private static final String TENANT_ID = "0422ffb57ba042c0800a29dc85ca70f8"; + private static final String VNF_TYPE = "MSOTADevInfra_vSAMP10a_Service/vSAMP10a 1"; + private static final String VNF_NAME = "MSO-DEV-VNF-1802-it3-pwt3-vSAMP10a-1XXX-Replace"; + private static final String VNF_VERSION = "1.0"; + private static final String VF_MODULE_ID = "1d48aaec-b7f3-4c24-ba4a-4e798ed3223c"; + private static final String VF_MODULE_NAME = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001"; + private static final String VF_MODULE_TYPE = "vSAMP10aDEV::PCM::module-2"; + private static final String MODEL_CUSTOMIZATION_UUID = "cb82ffd8-252a-11e7-93ae-92361f002671"; + private static final String BASE_VF_MODULE_ID = "3d7ff7b4-720b-4604-be0a-1974fc58ed96"; + // vfModuleParams specific variables + private static final String NETWORK_NAME = "Dev-vSAMP10a-ntwk-1802-pwt3-v6-Replace-1001"; + private static final String SERVER_NAME = "Dev-vSAMP10a-addon2-1802-pwt3-v6-Replace-1001"; + private static final String IMAGE = "ubuntu_14.04_IPv6"; + private static final String EXN_DIRECT_NET_FQDN = "direct"; + private static final String EXN_HSL_NET_FQDN = "hsl"; + private static final String AVAILABILITY_ZONE_0 = "nova"; + private static final String VF_MODULE_INDEX = "0"; + private static final String REQUEST_TYPE = ""; + + @Test + public void testCreateVfModule() throws JSONException, JsonParseException, JsonMappingException, IOException { + + CreateVfModuleRequest request = populateCreateVfModuleRequest(); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackGetStackVfModule_404(wireMockServer); + + mockOpenStackPostStacks_200(wireMockServer); + + mockOpenStackGetStackVfModule_200(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); + + ResponseEntity<CreateVfModuleResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, CreateVfModuleResponse.class); + + ResponseEntity<CreateVfModuleResponse> responseV2 = + restTemplate.exchange(createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, CreateVfModuleResponse.class); + + CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + + assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value()); + assertThat(responseV2.getBody(), sameBeanAs(expectedResponse)); + } + + @Test + public void testCreateVfModuleAsyncCall() throws Exception { + CreateVfModuleRequest request = populateCreateVfModuleRequest(); + request.setNotificationUrl(createURLWithPort("/mso/WorkflowMesssage")); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStackVfModule_404(wireMockServer); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); + + ResponseEntity<CreateVfModuleResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, CreateVfModuleResponse.class); + + CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class); + + assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); + } + + @Test + public void testCreateVfModuleWithEnableBridgeNull() + throws JSONException, JsonParseException, JsonMappingException, IOException { + + CreateVfModuleRequest request = new CreateVfModuleRequest(); + request.setBackout(true); + request.setSkipAAI(true); + request.setFailIfExists(false); + MsoRequest msoReq = new MsoRequest(); + boolean failIfExists = true; + Boolean enableBridge = null; + Map<String, Object> vfModuleParams = new HashMap<>(); + + + vfModuleParams.put("vf_module_id", VF_MODULE_ID); + vfModuleParams.put("vnf_id", AAI_VNF_ID); + vfModuleParams.put("network_name", NETWORK_NAME); + vfModuleParams.put("vnf_name", VNF_NAME); + vfModuleParams.put("environment_context", ""); + vfModuleParams.put("server_name", SERVER_NAME); + vfModuleParams.put("image", IMAGE); + vfModuleParams.put("workload_context", ""); + vfModuleParams.put("vf_module_index", VF_MODULE_INDEX); + vfModuleParams.put("vf_module_name", VF_MODULE_NAME); + vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0); + vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); + vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); + + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + request.setMsoRequest(msoReq); + request.setRequestType(REQUEST_TYPE); + request.setCloudSiteId(CLOUDSITE_ID); + request.setTenantId(TENANT_ID); + request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); + request.setVnfId(AAI_VNF_ID); + request.setVnfVersion(VNF_VERSION); + request.setVfModuleId(VF_MODULE_ID); + request.setVfModuleName(VF_MODULE_NAME); + request.setBaseVfModuleId(BASE_VF_MODULE_ID); + request.setFailIfExists(failIfExists); + request.setEnableBridge(enableBridge); + request.setVfModuleParams(vfModuleParams); + request.setMessageId(MESSAGE_ID); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackGetStackVfModule_404(wireMockServer); + + mockOpenStackPostStacks_200(wireMockServer); + + mockOpenStackGetStackVfModule_200(wireMockServer); + + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); + + ResponseEntity<CreateVfModuleResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, CreateVfModuleResponse.class); + + CreateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/CreateVfModuleResponse.json"), CreateVfModuleResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + @Test + public void testCreateVfModuleFail() throws IOException { + + CreateVfModuleRequest request = new CreateVfModuleRequest(); + request.setBackout(true); + request.setSkipAAI(true); + request.setFailIfExists(false); + MsoRequest msoReq = new MsoRequest(); + boolean failIfExists = true; + boolean enableBridge = false; + Map<String, Object> vfModuleParams = new HashMap<>(); + + vfModuleParams.put("vf_module_id", VF_MODULE_ID); + vfModuleParams.put("vnf_id", AAI_VNF_ID); + vfModuleParams.put("network_name", NETWORK_NAME); + vfModuleParams.put("vnf_name", VNF_NAME); + vfModuleParams.put("environment_context", ""); + vfModuleParams.put("server_name", SERVER_NAME); + vfModuleParams.put("image", IMAGE); + vfModuleParams.put("workload_context", ""); + vfModuleParams.put("vf_module_index", VF_MODULE_INDEX); + vfModuleParams.put("vf_module_name", VF_MODULE_NAME); + vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0); + vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); + vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); + + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + request.setMsoRequest(msoReq); + request.setRequestType(REQUEST_TYPE); + request.setCloudSiteId(CLOUDSITE_ID); + request.setTenantId(TENANT_ID); + request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); + request.setVnfId(AAI_VNF_ID); + request.setVnfType(VNF_TYPE); + request.setVnfVersion(VNF_VERSION); + request.setVfModuleId(VF_MODULE_ID); + request.setVfModuleName(VF_MODULE_NAME); + request.setVfModuleType(VF_MODULE_TYPE); + request.setBaseVfModuleStackId(BASE_VF_MODULE_ID); + request.setFailIfExists(failIfExists); + request.setEnableBridge(enableBridge); + request.setVfModuleParams(vfModuleParams); + request.setMessageId(MESSAGE_ID); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackGetStackVfModule_404(wireMockServer); + + mockOpenStackGetStacks_404(wireMockServer); + + mockOpenStackPostStacks_200(wireMockServer); + + mockOpenStackGetStackVfModule_200(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<CreateVfModuleRequest> entity = new HttpEntity<CreateVfModuleRequest>(request, headers); + + ResponseEntity<VfModuleExceptionResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, VfModuleExceptionResponse.class); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + + mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_IN_PROGRESS"); + + response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, VfModuleExceptionResponse.class); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + + mockOpenStackGetStacksWithBody_200(wireMockServer, "DELETE_FAILED"); + + response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, VfModuleExceptionResponse.class); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); + + response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, VfModuleExceptionResponse.class); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + + mockOpenStackGetStacksWithBody_404(wireMockServer); + + response = restTemplate.exchange(createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules"), + HttpMethod.POST, entity, VfModuleExceptionResponse.class); + + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value()); + + } + + @Test + public void testDeleteVfModule() throws IOException { + + DeleteVfModuleRequest request = new DeleteVfModuleRequest(); + MsoRequest msoRequest = new MsoRequest(); + String vfModuleStackId = "stackId"; + + msoRequest.setRequestId(MSO_REQUEST_ID); + msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + request.setCloudSiteId(CLOUDSITE_ID); + request.setTenantId(TENANT_ID); + request.setVfModuleId(VF_MODULE_ID); + request.setVfModuleStackId(vfModuleStackId); + request.setVnfId(AAI_VNF_ID); + request.setMsoRequest(msoRequest); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackPostStacks_200(wireMockServer); + + mockOpenStackGetStacksStackId_404(wireMockServer); + + mockOpenStackGetPublicUrlStackByNameAndID_200(wireMockServer, wireMockPort); + + mockOpenStackDeletePublicUrlStackByNameAndID_204(wireMockServer); + + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<DeleteVfModuleRequest> entity = new HttpEntity<DeleteVfModuleRequest>(request, headers); + + ResponseEntity<DeleteVfModuleResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID), + HttpMethod.DELETE, entity, DeleteVfModuleResponse.class); + + ResponseEntity<DeleteVfModuleResponse> responseV2 = restTemplate.exchange( + createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID), + HttpMethod.DELETE, entity, DeleteVfModuleResponse.class); + + + DeleteVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/DeleteVfModuleResponse.json"), DeleteVfModuleResponse.class); + + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + + assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value()); + assertThat(responseV2.getBody(), sameBeanAs(expectedResponse)); + } + + @Test + public void testUpdateVfModule() throws IOException { + + UpdateVfModuleRequest request = new UpdateVfModuleRequest(); + MsoRequest msoRequest = new MsoRequest(); + String vfModuleStackId = "vfModuleStackId"; + Boolean failIfExists = false; + Boolean backout = false; + msoRequest.setRequestId(MSO_REQUEST_ID); + msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + + Map<String, Object> vfModuleParams = new HashMap<>(); + + vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); + vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); + + Map<String, String> vfModuleOutputs = new HashMap<String, String>(); + + vfModuleOutputs.put("output name", "output value"); + + request.setBackout(backout); + request.setCloudSiteId(CLOUDSITE_ID); + request.setFailIfExists(failIfExists); + request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); + request.setMsoRequest(msoRequest); + request.setRequestType(REQUEST_TYPE); + request.setTenantId(TENANT_ID); + request.setVfModuleId(VF_MODULE_ID); + request.setVfModuleName(VF_MODULE_NAME); + request.setVfModuleStackId(vfModuleStackId); + request.setBackout(backout); + request.setVfModuleParams(vfModuleParams); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackGetStacksVfModuleWithLocationHeader_200(wireMockServer, wireMockPort); + + mockOpenStackGetStacksVfModule_200(wireMockServer, wireMockPort); + + mockOpenStackGetStacksBaseStack_200(wireMockServer, wireMockPort); + + mockOpenStackPutStacks_200(wireMockServer); + + UpdateVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/UpdateVfModuleResponse.json"), UpdateVfModuleResponse.class); + expectedResponse.setVfModuleOutputs(vfModuleOutputs); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<UpdateVfModuleRequest> entity = new HttpEntity<UpdateVfModuleRequest>(request, headers); + + ResponseEntity<UpdateVfModuleResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE), + HttpMethod.PUT, entity, UpdateVfModuleResponse.class); + + ResponseEntity<UpdateVfModuleResponse> responseV2 = restTemplate.exchange( + createURLWithPort("/services/rest/v2/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_TYPE), + HttpMethod.PUT, entity, UpdateVfModuleResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + + assertEquals(Response.Status.OK.getStatusCode(), responseV2.getStatusCode().value()); + assertThat(responseV2.getBody(), sameBeanAs(expectedResponse)); + + } + + @Test + public void testRollbackVfModule() throws IOException { + + + MsoRequest msoRequest = new MsoRequest(); + msoRequest.setRequestId(MSO_REQUEST_ID); + msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + + VfModuleRollback vfModuleRollback = new VfModuleRollback(AAI_VNF_ID, VF_MODULE_ID, "StackId", false, TENANT_ID, + CLOUD_OWNER, CLOUDSITE_ID, msoRequest, "messageId"); + + RollbackVfModuleRequest request = new RollbackVfModuleRequest(); + request.setVfModuleRollback(vfModuleRollback); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + mockOpenStackGetStacksStackId_200(wireMockServer, wireMockPort); + + mockOpenStackDeleteStacks(wireMockServer); + + mockOpenStackGetStacksVUSP_404(wireMockServer); + + headers.add("Accept", MediaType.APPLICATION_JSON); + HttpEntity<RollbackVfModuleRequest> entity = new HttpEntity<RollbackVfModuleRequest>(request, headers); + + ResponseEntity<RollbackVfModuleResponse> response = restTemplate.exchange( + createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID + "/rollback"), + HttpMethod.DELETE, entity, RollbackVfModuleResponse.class); + + RollbackVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/RollbackVfModuleResponse.json"), RollbackVfModuleResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + + } + + @Ignore + @Test + public void testQueryVfModule() throws IOException { + + String testUrl = createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID); + String testUri = UriBuilder.fromPath("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID) + .host("localhost").port(wireMockPort).scheme("http") + // .queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID) + .build().toString(); + System.out.println(testUri); + + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + + + headers.add("Accept", MediaType.APPLICATION_JSON); + // HttpEntity entity = new HttpEntity(null, headers); + ResponseEntity<QueryVfModuleResponse> response = + restTemplate.getForEntity(testUri, QueryVfModuleResponse.class); + // System.out.println(response); + + QueryVfModuleResponse expectedResponse = jettisonTypeObjectMapper.getMapper().readValue( + new File("src/test/resources/__files/QueryVfModuleResponse.json"), QueryVfModuleResponse.class); + + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + assertThat(response.getBody(), sameBeanAs(expectedResponse)); + } + + private CreateVfModuleRequest populateCreateVfModuleRequest() { + CreateVfModuleRequest request = new CreateVfModuleRequest(); + request.setBackout(true); + request.setSkipAAI(true); + request.setFailIfExists(false); + MsoRequest msoReq = new MsoRequest(); + boolean failIfExists = true; + boolean enableBridge = false; + Map<String, Object> vfModuleParams = new HashMap<>(); + + vfModuleParams.put("vf_module_id", VF_MODULE_ID); + vfModuleParams.put("vnf_id", AAI_VNF_ID); + vfModuleParams.put("network_name", NETWORK_NAME); + vfModuleParams.put("vnf_name", VNF_NAME); + vfModuleParams.put("environment_context", ""); + vfModuleParams.put("server_name", SERVER_NAME); + vfModuleParams.put("image", IMAGE); + vfModuleParams.put("workload_context", ""); + vfModuleParams.put("vf_module_index", VF_MODULE_INDEX); + vfModuleParams.put("vf_module_name", VF_MODULE_NAME); + vfModuleParams.put("availability_zone_0", AVAILABILITY_ZONE_0); + vfModuleParams.put("exn_direct_net_fqdn", EXN_DIRECT_NET_FQDN); + vfModuleParams.put("exn_hsl_net_fqdn", EXN_HSL_NET_FQDN); + + msoReq.setRequestId(MSO_REQUEST_ID); + msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID); + request.setMsoRequest(msoReq); + request.setRequestType(REQUEST_TYPE); + request.setCloudSiteId(CLOUDSITE_ID); + request.setTenantId(TENANT_ID); + request.setModelCustomizationUuid(MODEL_CUSTOMIZATION_UUID); + request.setVnfId(AAI_VNF_ID); + request.setVnfType(VNF_TYPE); + request.setVnfVersion(VNF_VERSION); + request.setVfModuleId(VF_MODULE_ID); + request.setVfModuleName(VF_MODULE_NAME); + request.setVfModuleType(VF_MODULE_TYPE); + request.setBaseVfModuleId(BASE_VF_MODULE_ID); + request.setFailIfExists(failIfExists); + request.setEnableBridge(enableBridge); + request.setVfModuleParams(vfModuleParams); + request.setMessageId(MESSAGE_ID); + + return request; + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java index f602690a10..523a6903cc 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestTest.java @@ -50,84 +50,84 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { @Test public void testCreateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST, - entity, CreateVolumeGroupResponse.class); + ResponseEntity<CreateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST, entity, + CreateVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test public void testCreateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST, - entity, CreateVolumeGroupResponse.class); + ResponseEntity<CreateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups"), HttpMethod.POST, entity, + CreateVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } @Test - public void testDeleteVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + public void testDeleteVNFVolumes() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE, - entity, DeleteVolumeGroupResponse.class); + ResponseEntity<DeleteVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test - public void testDeleteVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + public void testDeleteVNFVolumesAsync() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE, - entity, DeleteVolumeGroupResponse.class); + ResponseEntity<DeleteVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } @Test - public void testRollbackVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + public void testRollbackVNFVolumes() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE, - entity, RollbackVolumeGroupResponse.class); + createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID + "/rollback"), + HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test public void testRollbackVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE, - entity, RollbackVolumeGroupResponse.class); + createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID + "/rollback"), + HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } @Test - public void testQueryVNFVolumes() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + public void testQueryVNFVolumes() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID); builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID) .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) @@ -135,53 +135,51 @@ public class VolumeAdapterRestTest extends VolumeGroupAdapterCommon { .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID); ResponseEntity<QueryVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort(builder.build().toString()), HttpMethod.GET, - null,QueryVolumeGroupResponse.class); + createURLWithPort(builder.build().toString()), HttpMethod.GET, null, QueryVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test - public void testQueryVNFVolumesError() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + public void testQueryVNFVolumesError() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID); - builder.queryParam("tenantId", TENANT_ID) - .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) - .queryParam("msoRequest.requestId", MSO_REQUEST_ID) + builder.queryParam("tenantId", TENANT_ID).queryParam("volumeGroupStackId", VOUME_GROUP_NAME) + .queryParam("skipAAI", true).queryParam("msoRequest.requestId", MSO_REQUEST_ID) .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID); - ResponseEntity<VolumeGroupExceptionResponse> response = restTemplate.exchange( - createURLWithPort(builder.build().toString()), HttpMethod.GET, - null,VolumeGroupExceptionResponse.class); + ResponseEntity<VolumeGroupExceptionResponse> response = + restTemplate.exchange(createURLWithPort(builder.build().toString()), HttpMethod.GET, null, + VolumeGroupExceptionResponse.class); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); } @Test public void testUpdateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT, - entity,UpdateVolumeGroupResponse.class); + ResponseEntity<UpdateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test public void testUpdateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v1/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT, - entity,UpdateVolumeGroupResponse.class); + ResponseEntity<UpdateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v1/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java index dba169c311..fb4bec69ed 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2Test.java @@ -49,83 +49,83 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { @Test public void testCreateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST, - entity, CreateVolumeGroupResponse.class); + ResponseEntity<CreateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST, entity, + CreateVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test public void testCreateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackPostStacks_200(); - mockOpenStackGetStackVfModule_200(); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackPostStacks_200(wireMockServer); + mockOpenStackGetStackVfModule_200(wireMockServer); CreateVolumeGroupRequest request = buildCreateVfModuleRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<CreateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<CreateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST, - entity, CreateVolumeGroupResponse.class); + ResponseEntity<CreateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups"), HttpMethod.POST, entity, + CreateVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } @Test - public void testDeleteVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + public void testDeleteVNFVolumes() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE, - entity, DeleteVolumeGroupResponse.class); + ResponseEntity<DeleteVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test - public void testDeleteVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + public void testDeleteVNFVolumesAsync() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); DeleteVolumeGroupRequest request = buildDeleteVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<DeleteVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<DeleteVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.DELETE, - entity, DeleteVolumeGroupResponse.class); + ResponseEntity<DeleteVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.DELETE, entity, DeleteVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } @Test - public void testRollbackVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + public void testRollbackVNFVolumes() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE, - entity, RollbackVolumeGroupResponse.class); + createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID + "/rollback"), + HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test - public void testRollbackVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); + public void testRollbackVNFVolumesAsync() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); RollbackVolumeGroupRequest request = buildRollbackVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<RollbackVolumeGroupRequest> entity = new HttpEntity<>(request, headers); ResponseEntity<RollbackVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID+"/rollback"), HttpMethod.DELETE, - entity, RollbackVolumeGroupResponse.class); + createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID + "/rollback"), + HttpMethod.DELETE, entity, RollbackVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } @Test - public void testQueryVNFVolumes() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + public void testQueryVNFVolumes() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID); builder.queryParam("cloudSiteId", CLOUDSITE_ID).queryParam("tenantId", TENANT_ID) .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) @@ -133,52 +133,51 @@ public class VolumeAdapterRestV2Test extends VolumeGroupAdapterCommon { .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID); ResponseEntity<QueryVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort(builder.build().toString()), HttpMethod.GET, - null,QueryVolumeGroupResponse.class); + createURLWithPort(builder.build().toString()), HttpMethod.GET, null, QueryVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test - public void testQueryVNFVolumesError() throws IOException{ - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("UPDATE_COMPLETE"); + public void testQueryVNFVolumesError() throws IOException { + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "UPDATE_COMPLETE"); javax.ws.rs.core.UriBuilder builder = UriBuilder.fromPath("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID); - builder.queryParam("tenantId", TENANT_ID) - .queryParam("volumeGroupStackId", VOUME_GROUP_NAME).queryParam("skipAAI", true) - .queryParam("msoRequest.requestId", MSO_REQUEST_ID) + builder.queryParam("tenantId", TENANT_ID).queryParam("volumeGroupStackId", VOUME_GROUP_NAME) + .queryParam("skipAAI", true).queryParam("msoRequest.requestId", MSO_REQUEST_ID) .queryParam("msoRequest.serviceInstanceId", MSO_SERVICE_INSTANCE_ID); - ResponseEntity<VolumeGroupExceptionResponse> response = restTemplate.exchange( - createURLWithPort(builder.build().toString()), HttpMethod.GET, - null,VolumeGroupExceptionResponse.class); + ResponseEntity<VolumeGroupExceptionResponse> response = + restTemplate.exchange(createURLWithPort(builder.build().toString()), HttpMethod.GET, null, + VolumeGroupExceptionResponse.class); assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value()); } + @Test public void testUpdateVNFVolumes() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT, - entity,UpdateVolumeGroupResponse.class); + ResponseEntity<UpdateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class); assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); } @Test public void testUpdateVNFVolumesAsync() throws IOException { - mockOpenStackResponseAccess(wireMockPort); - mockOpenStackGetStacksWithBody_200("CREATE_COMPLETE"); - mockOpenStackPutStack(VOUME_GROUP_NAME+"/stackId",200); - mockOpenStackGetStackWithBody_200("UPDATE_COMPLETE"); + mockOpenStackResponseAccess(wireMockServer, wireMockPort); + mockOpenStackGetStacksWithBody_200(wireMockServer, "CREATE_COMPLETE"); + mockOpenStackPutStack(wireMockServer, VOUME_GROUP_NAME + "/stackId", 200); + mockOpenStackGetStackWithBody_200(wireMockServer, "UPDATE_COMPLETE"); UpdateVolumeGroupRequest request = buildUpdateVolumeGroupRequest(); request.setNotificationUrl("http://localhost:8080"); HttpEntity<UpdateVolumeGroupRequest> entity = new HttpEntity<>(request, headers); - ResponseEntity<UpdateVolumeGroupResponse> response = restTemplate.exchange( - createURLWithPort("/services/rest/v2/volume-groups/"+VOLUME_GROUP_ID), HttpMethod.PUT, - entity,UpdateVolumeGroupResponse.class); + ResponseEntity<UpdateVolumeGroupResponse> response = + restTemplate.exchange(createURLWithPort("/services/rest/v2/volume-groups/" + VOLUME_GROUP_ID), + HttpMethod.PUT, entity, UpdateVolumeGroupResponse.class); assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java index d0d06aed6c..14fa1df6c9 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java @@ -26,7 +26,6 @@ import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest; import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest; import org.onap.so.adapters.vnfrest.VolumeGroupRollback; import org.onap.so.entity.MsoRequest; - import java.util.HashMap; import java.util.Map; @@ -113,11 +112,11 @@ public class VolumeGroupAdapterCommon extends BaseRestTestUtils { } private Map<String, Object> getVolumeGroupParamsMap() { - Map<String, Object> volumeGroupParams = new HashMap<>(); - volumeGroupParams.put("fsb_volume_type_0","volume_type"); - volumeGroupParams.put("fsb_volume_image_name_1","vol_img_1"); - volumeGroupParams.put("fsb_volume_image_name_0","vol_img_0"); - volumeGroupParams.put("fsb_volume_size_0","100"); + Map<String, Object> volumeGroupParams = new HashMap<>(); + volumeGroupParams.put("fsb_volume_type_0", "volume_type"); + volumeGroupParams.put("fsb_volume_image_name_1", "vol_img_1"); + volumeGroupParams.put("fsb_volume_image_name_0", "vol_img_0"); + volumeGroupParams.put("fsb_volume_size_0", "100"); return volumeGroupParams; } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java index 569a845caa..bb00700b60 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/bpmn/mock/StubOpenStack.java @@ -27,465 +27,486 @@ import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson; import static com.github.tomakehurst.wiremock.client.WireMock.get; import static com.github.tomakehurst.wiremock.client.WireMock.post; import static com.github.tomakehurst.wiremock.client.WireMock.put; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; - import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; - import org.apache.http.HttpStatus; +import com.github.tomakehurst.wiremock.WireMockServer; public class StubOpenStack { - private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; - private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b"; - private static final String NETWORK_NAME_2 = "stackname"; - private static final String NETWORK_ID_2 = "stackId"; - - public static void mockOpenStackResponseAccess(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackResponseAccessMulticloud(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_AccessMulticloud.json", port, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackResponseAccessQueryNetwork(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")) - .withRequestBody(containing("tenantId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access_queryNetwork.json", port, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackResponseAccessAdmin(int port) throws IOException { - stubFor(post(urlPathEqualTo("/v2.0/tokens")).willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFile("OpenstackResponse_Access_Admin.json", port, "/mockPublicUrl")) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPublicUrlStackByName_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME)).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME) - .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPublicUrlStackByID_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_ID)).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME) - .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetPublicUrlStackByNameAndID_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME) - .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetPublicUrlStackByNameAndID_204(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID) - .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/" + NETWORK_NAME)) - .withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackPutPublicUrlStackByNameAndID_200() { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200() { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME_2+"/"+NETWORK_ID_2)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackDeletePublicUrlStackByNameAndID_204() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/"+NETWORK_NAME+"/"+NETWORK_ID)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NO_CONTENT))); - } - - public static void mockOpenStackPostPublicUrlWithBodyFile_200() { - stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStackCreatedAppC_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3/stackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStackAppC_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3")) - .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetStackCreatedVUSP_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/stackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStackVUSP_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0")) - .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackPostStack_200(String filename) { - stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPostNeutronNetwork_200(String filename) { - stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPutNeutronNetwork_200(String filename,String networkId) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPutNeutronNetwork(String networkId, int responseCode) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkId)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withStatus(responseCode))); - } - - public static void mockOpenStackGetAllNeutronNetworks_200(String filename){ - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetNeutronNetwork_404(String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+networkName)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetAllNeutronNetworks_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenstackGetWithResponse(String url,int responseCode, String responseFile) { - stubFor(get(urlPathEqualTo(url)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile) - .withStatus(responseCode))); - } - - public static void mockOpenstackPostWithResponse(String url,int responseCode, String responseFile) { - stubFor(post(urlPathEqualTo(url)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile(responseFile) - .withStatus(responseCode))); - } - - public static void mockOpenstackGet(String url,int responseCode) { - stubFor(get(urlPathEqualTo(url)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withStatus(responseCode))); - } - - public static void mockOpenstackPost(String url,int responseCode) { - stubFor(post(urlPathEqualTo(url)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withStatus(responseCode))); - } - - public static void mockOpenStackGetStackVfModule_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStackVfModule_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackPostStacks_200() { - stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStacks_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/3d7ff7b4-720b-4604-be0a-1974fc58ed96")) - .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetStacksWithBody_200(String replaceWith) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFileVnfAdapter(replaceWith)) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStackWithBody_200(String replaceWith) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFileVnfAdapter(replaceWith)) - .withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStacksWithBody_404() throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(getBodyFromFileVnfAdapter(null)) - .withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetStacksStackId_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackId")) - .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetStacksVfModule_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStacksVfModuleWithLocationHeader_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001") - .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStacksBaseStack_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfModuleStackId")).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/baseVfModuleStackId") - .withBody(getBodyFromFile("OpenstackResponse_VnfBaseStackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPutStacks_200() { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPutStack(String networkId,int responseCode) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/"+networkId)) - .willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withStatus(responseCode))); - } - - public static void mockOpenStackGetStacksStackId_200(int port) throws IOException { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/StackId")).willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/stackId") - .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/stackId")).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackDeleteStacks() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) - .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest"))); - } - - public static void mockOpenStackGetStacksVUSP_404() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) - .willReturn(aResponse() - .withHeader("X-Openstack-Request-Id", "openstackRquest") - .withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetStackCreated_200(String filename, String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetStack_404(String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetStack_500(String networkName) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - } - - public static void mockOpenStackGetStackDeleteOrUpdateComplete_200(String filename) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile(filename).withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetNeutronNetwork(String filename,String networkId,int status) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBodyFile(filename).withStatus(status))); - } - - public static void mockOpenStackGetNeutronNetwork(String networkId,int status) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/"+ networkId)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withStatus(status))); - } - - public static void mockOpenStackDeleteStack_200() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) - .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackDeleteStack_500() { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) - .willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); - } - - public static void mockOpenStackDeleteNeutronNetwork(String networkId,int responseCode) { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) - .willReturn(aResponse().withStatus(responseCode))); - } - - public static void mockOpenStackPostMetadata_200() { - stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetMetadata_200() { - stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPostTenantWithBodyFile_200() throws IOException { - stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) - .withRequestBody(equalToJson(readFile("src/test/resources/__files/OpenstackRequest_Tenant.json"))).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPostTenant_200() throws IOException { - stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetTenantByName_200(String tenantName) { - stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetTenantByName_404(String tenantName) { - stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackGetTenantById_200(String tenantId) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetTenantById_404(String tenantId) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); - } - - public static void mockOpenStackDeleteTenantById_200(String tenantId) { - stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn(aResponse() - .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetUser_200(String user) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackGetRoles_200(String roleFor) { - stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK))); - } - - public static void mockOpenStackPutRolesAdmin_200(String roleFor) { - stubFor(put(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/users/msoId/roles/" + roleFor + "/admin")).willReturn(aResponse() - .withHeader("Content-Type", "application/json") - .withBody("").withStatus(HttpStatus.SC_OK))); - } - - public static void mockValetCreatePostResponse_200(String requestId, String body) { - stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) + private static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0"; + private static final String NETWORK_ID = "da886914-efb2-4917-b335-c8381528d90b"; + private static final String NETWORK_NAME_2 = "stackname"; + private static final String NETWORK_ID_2 = "stackId"; + + public static void mockOpenStackResponseAccess(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(body).withStatus(HttpStatus.SC_OK))); - } - - public static void mockValetCreatePutResponse_200(String requestId, String body) { - stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) - .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(body).withStatus(HttpStatus.SC_OK))); - } - - public static void mockValetDeleteDeleteResponse_200(String requestId, String body) { - stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)) + .withBody(getBodyFromFile("OpenstackResponse_Access.json", port, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackResponseAccessMulticloud(WireMockServer wireMockServer, int port) + throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_AccessMulticloud.json", port, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackResponseAccessQueryNetwork(WireMockServer wireMockServer, int port) + throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")).withRequestBody(containing("tenantId")) .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(body).withStatus(HttpStatus.SC_OK))); - } - - public static void mockValetConfirmPutRequest_200(String requestId, String body) { - stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/")) + .withBody(getBodyFromFile("OpenstackResponse_Access_queryNetwork.json", port, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackResponseAccessAdmin(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/v2.0/tokens")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFile("OpenstackResponse_Access_Admin.json", port, "/mockPublicUrl")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPublicUrlStackByName_200(WireMockServer wireMockServer, int port) + throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME)) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest") + .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/" + NETWORK_NAME) + .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, + "/mockPublicUrl/stacks/" + NETWORK_NAME)) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPublicUrlStackByID_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_ID)) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest") + .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/" + NETWORK_NAME) + .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, + "/mockPublicUrl/stacks/" + NETWORK_NAME)) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetPublicUrlStackByNameAndID_200(WireMockServer wireMockServer, int port) + throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME + "/" + NETWORK_ID)) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest") + .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/" + NETWORK_NAME) + .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, + "/mockPublicUrl/stacks/" + NETWORK_NAME)) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetPublicUrlStackByNameAndID_204(WireMockServer wireMockServer, int port) + throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME + "/" + NETWORK_ID)) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest") + .withHeader("location", + "http://localhost:" + port + "/mockPublicUrl/stacks/" + NETWORK_NAME + "/" + NETWORK_ID) + .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, + "/mockPublicUrl/stacks/" + NETWORK_NAME)) + .withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackPutPublicUrlStackByNameAndID_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME + "/" + NETWORK_ID)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPutPublicUrlStackByNameAndID_NETWORK2_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackDeletePublicUrlStackByNameAndID_204(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME + "/" + NETWORK_ID)) .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(body).withStatus(HttpStatus.SC_OK))); - } - - public static void mockValetRollbackPutRequest_200(String requestId, String body) { - stubFor(put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/")) + .withStatus(HttpStatus.SC_NO_CONTENT))); + } + + public static void mockOpenStackPostPublicUrlWithBodyFile_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) .willReturn(aResponse().withHeader("Content-Type", "application/json") - .withBody(body).withStatus(HttpStatus.SC_OK))); - } - - private static String getBodyFromFileVnfAdapter(String replaceWith) throws IOException { - String temp = readFile("src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json"); - if (replaceWith == null) { - return temp; - } - return temp.replaceAll("CREATE_COMPLETE", replaceWith); - } - - private static String readFile(String fileName) throws IOException { - try (BufferedReader br = new BufferedReader(new FileReader(fileName))) { - StringBuilder sb = new StringBuilder(); - String line = br.readLine(); - - while (line != null) { - sb.append(line); - sb.append("\n"); - line = br.readLine(); - } - return sb.toString(); - } - } - - public static String getBodyFromFile(String fileName, int port, String urlPath) throws IOException { - return readFile("src/test/resources/__files/" + fileName).replaceAll("port", "http://localhost:" + port + urlPath); - } + .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStackCreatedAppC_200(WireMockServer wireMockServer) { + wireMockServer.stubFor( + get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStackAppC_404(WireMockServer wireMockServer) { + wireMockServer + .stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3")) + .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetStackCreatedVUSP_200(WireMockServer wireMockServer) { + wireMockServer.stubFor( + get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Stack_Created.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStackVUSP_404(WireMockServer wireMockServer) { + wireMockServer + .stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0")) + .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackPostStack_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile(filename).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPostNeutronNetwork_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile(filename).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPutNeutronNetwork_200(WireMockServer wireMockServer, String filename, + String networkId) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile(filename).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPutNeutronNetwork(WireMockServer wireMockServer, String networkId, + int responseCode) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(responseCode))); + } + + public static void mockOpenStackGetAllNeutronNetworks_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile(filename).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetNeutronNetwork_404(WireMockServer wireMockServer, String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkName)).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetAllNeutronNetworks_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks")).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenstackGetWithResponse(WireMockServer wireMockServer, String url, int responseCode, + String responseFile) { + wireMockServer.stubFor(get(urlPathEqualTo(url)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile(responseFile).withStatus(responseCode))); + } + + public static void mockOpenstackPostWithResponse(WireMockServer wireMockServer, String url, int responseCode, + String responseFile) { + wireMockServer.stubFor(post(urlPathEqualTo(url)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile(responseFile).withStatus(responseCode))); + } + + public static void mockOpenstackGet(WireMockServer wireMockServer, String url, int responseCode) { + wireMockServer.stubFor(get(urlPathEqualTo(url)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(responseCode))); + } + + public static void mockOpenstackPost(WireMockServer wireMockServer, String url, int responseCode) { + wireMockServer.stubFor(post(urlPathEqualTo(url)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(responseCode))); + } + + public static void mockOpenStackGetStackVfModule_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(get( + urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json") + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStackVfModule_404(WireMockServer wireMockServer) { + wireMockServer.stubFor( + get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackPostStacks_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/stacks")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Stack.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStacks_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/3d7ff7b4-720b-4604-be0a-1974fc58ed96")) + .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetStacksWithBody_200(WireMockServer wireMockServer, String replaceWith) + throws IOException { + wireMockServer.stubFor( + get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFileVnfAdapter(replaceWith)).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStackWithBody_200(WireMockServer wireMockServer, String replaceWith) + throws IOException { + wireMockServer.stubFor(get( + urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFileVnfAdapter(replaceWith)).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStacksWithBody_404(WireMockServer wireMockServer) throws IOException { + wireMockServer.stubFor( + get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBody(getBodyFromFileVnfAdapter(null)).withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetStacksStackId_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/stackId")) + .willReturn(aResponse().withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetStacksVfModule_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo( + "/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest") + .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, + "/mockPublicUrl/stacks/stackId")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStacksVfModuleWithLocationHeader_200(WireMockServer wireMockServer, int port) + throws IOException { + wireMockServer.stubFor( + get(urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest") + .withHeader("location", "http://localhost:" + port + + "/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001") + .withBody(getBodyFromFile("OpenstackResponse_VnfStackId.json", port, + "/mockPublicUrl/stacks/stackId")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStacksBaseStack_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfModuleStackId")).willReturn(aResponse() + .withHeader("X-Openstack-Request-Id", "openstackRquest") + .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/baseVfModuleStackId") + .withBody( + getBodyFromFile("OpenstackResponse_VnfBaseStackId.json", port, "/mockPublicUrl/stacks/stackId")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPutStacks_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(put(urlPathEqualTo( + "/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPutStack(WireMockServer wireMockServer, String networkId, int responseCode) { + wireMockServer.stubFor(put(urlPathEqualTo("/mockPublicUrl/stacks/" + networkId)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(responseCode))); + } + + public static void mockOpenStackGetStacksStackId_200(WireMockServer wireMockServer, int port) throws IOException { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/StackId")).willReturn(aResponse() + .withHeader("X-Openstack-Request-Id", "openstackRquest") + .withHeader("location", "http://localhost:" + port + "/mockPublicUrl/stacks/stackId") + .withBody(getBodyFromFile("OpenstackResponse_StackId.json", port, "/mockPublicUrl/stacks/stackId")) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackDeleteStacks(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo( + "/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest"))); + } + + public static void mockOpenStackGetStacksVUSP_404(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo( + "/mockPublicUrl/stacks/vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0/da886914-efb2-4917-b335-c8381528d90b")) + .willReturn(aResponse().withHeader("X-Openstack-Request-Id", "openstackRquest") + .withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetStackCreated_200(WireMockServer wireMockServer, String filename, + String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBodyFile(filename).withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetStack_404(WireMockServer wireMockServer, String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetStack_500(WireMockServer wireMockServer, String networkName) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + networkName)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + } + + public static void mockOpenStackGetStackDeleteOrUpdateComplete_200(WireMockServer wireMockServer, String filename) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile(filename) + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String filename, String networkId, + int status) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)).willReturn( + aResponse().withHeader("Content-Type", "application/json").withBodyFile(filename).withStatus(status))); + } + + public static void mockOpenStackGetNeutronNetwork(WireMockServer wireMockServer, String networkId, int status) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(status))); + } + + public static void mockOpenStackDeleteStack_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) + .willReturn(aResponse().withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackDeleteStack_500(WireMockServer wireMockServer) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/stacks/" + NETWORK_NAME_2 + "/" + NETWORK_ID_2)) + .willReturn(aResponse().withStatus(HttpStatus.SC_INTERNAL_SERVER_ERROR))); + } + + public static void mockOpenStackDeleteNeutronNetwork(WireMockServer wireMockServer, String networkId, + int responseCode) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/v2.0/networks/" + networkId)) + .willReturn(aResponse().withStatus(responseCode))); + } + + public static void mockOpenStackPostMetadata_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetMetadata_200(WireMockServer wireMockServer) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/metadata")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Metadata.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPostTenantWithBodyFile_200(WireMockServer wireMockServer) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) + .withRequestBody(equalToJson(readFile("src/test/resources/__files/OpenstackRequest_Tenant.json"))) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPostTenant_200(WireMockServer wireMockServer) throws IOException { + wireMockServer.stubFor(post(urlPathEqualTo("/mockPublicUrl/tenants")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetTenantByName_200(WireMockServer wireMockServer, String tenantName) { + wireMockServer.stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetTenantByName_404(WireMockServer wireMockServer, String tenantName) { + wireMockServer.stubFor(get(urlEqualTo("/mockPublicUrl/tenants/?name=" + tenantName)).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackGetTenantById_200(WireMockServer wireMockServer, String tenantId) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Tenant.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetTenantById_404(WireMockServer wireMockServer, String tenantId) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)).willReturn( + aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_NOT_FOUND))); + } + + public static void mockOpenStackDeleteTenantById_200(WireMockServer wireMockServer, String tenantId) { + wireMockServer.stubFor(delete(urlPathEqualTo("/mockPublicUrl/tenants/" + tenantId)) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetUser_200(WireMockServer wireMockServer, String user) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/users/" + user)) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_User.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackGetRoles_200(WireMockServer wireMockServer, String roleFor) { + wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/" + roleFor + "/roles")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withBodyFile("OpenstackResponse_Roles.json").withStatus(HttpStatus.SC_OK))); + } + + public static void mockOpenStackPutRolesAdmin_200(WireMockServer wireMockServer, String roleFor) { + wireMockServer + .stubFor(put(urlPathEqualTo("/mockPublicUrl/tenants/tenantId/users/msoId/roles/" + roleFor + "/admin")) + .willReturn(aResponse().withHeader("Content-Type", "application/json").withBody("") + .withStatus(HttpStatus.SC_OK))); + } + + public static void mockValetCreatePostResponse_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer + .stubFor(post(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK))); + } + + public static void mockValetCreatePutResponse_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor(put(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK))); + } + + public static void mockValetDeleteDeleteResponse_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer + .stubFor(delete(urlEqualTo("/api/valet/placement/v1/?requestId=" + requestId)).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK))); + } + + public static void mockValetConfirmPutRequest_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor( + put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/confirm/")).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK))); + } + + public static void mockValetRollbackPutRequest_200(WireMockServer wireMockServer, String requestId, String body) { + wireMockServer.stubFor( + put(urlPathEqualTo("/api/valet/placement/v1/" + requestId + "/rollback/")).willReturn(aResponse() + .withHeader("Content-Type", "application/json").withBody(body).withStatus(HttpStatus.SC_OK))); + } + + private static String getBodyFromFileVnfAdapter(String replaceWith) throws IOException { + String temp = readFile("src/test/resources/__files/OpenstackResponse_Stack_Created_VfModule.json"); + if (replaceWith == null) { + return temp; + } + return temp.replaceAll("CREATE_COMPLETE", replaceWith); + } + + private static String readFile(String fileName) throws IOException { + try (BufferedReader br = new BufferedReader(new FileReader(fileName))) { + StringBuilder sb = new StringBuilder(); + String line = br.readLine(); + + while (line != null) { + sb.append(line); + sb.append("\n"); + line = br.readLine(); + } + return sb.toString(); + } + } + + public static String getBodyFromFile(String fileName, int port, String urlPath) throws IOException { + return readFile("src/test/resources/__files/" + fileName).replaceAll("port", + "http://localhost:" + port + urlPath); + } } diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java new file mode 100644 index 0000000000..0787cef75d --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java @@ -0,0 +1,367 @@ +/* + * Copyright (C) 2018 Bell Canada. 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. + */ +package org.onap.so.heatbridge; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyString; +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.when; +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.Optional; +import org.apache.commons.io.FileUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.junit.MockitoJUnitRunner; +import org.onap.aai.domain.yang.LInterface; +import org.onap.aai.domain.yang.PInterface; +import org.onap.aai.domain.yang.SriovPf; +import org.onap.aai.domain.yang.Vserver; +import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.AAISingleTransactionClient; +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.BulkProcessFailed; +import org.onap.so.db.catalog.beans.CloudIdentity; +import org.onap.so.heatbridge.constants.HeatBridgeConstants; +import org.onap.so.heatbridge.openstack.api.OpenstackClient; +import org.onap.so.heatbridge.openstack.api.OpenstackClientException; +import org.openstack4j.model.compute.Flavor; +import org.openstack4j.model.compute.Image; +import org.openstack4j.model.compute.Server; +import org.openstack4j.model.compute.Server.Status; +import org.openstack4j.model.heat.Resource; +import org.openstack4j.model.network.Network; +import org.openstack4j.model.network.NetworkType; +import org.openstack4j.model.network.Port; +import org.openstack4j.openstack.heat.domain.HeatResource; +import org.openstack4j.openstack.heat.domain.HeatResource.Resources; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableMap; + + +@RunWith(MockitoJUnitRunner.class) +public class HeatBridgeImplTest { + + private static final String CLOUD_OWNER = "CloudOwner"; + private static final String REGION_ID = "RegionOne"; + private static final String TENANT_ID = "7320ec4a5b9d4589ba7c4412ccfd290f"; + private static final ObjectMapper MAPPER = new ObjectMapper(); + + @Mock + private OpenstackClient osClient; + + private CloudIdentity cloudIdentity = new CloudIdentity(); + + @Mock + private AAIResourcesClient resourcesClient; + @Mock + private AAISingleTransactionClient transaction; + + private HeatBridgeImpl heatbridge; + + @Before + public void setUp() throws HeatBridgeException, OpenstackClientException, BulkProcessFailed { + + when(resourcesClient.beginSingleTransaction()).thenReturn(transaction); + heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, TENANT_ID); + } + + @Ignore + @Test + public void testQueryNestedHeatStackResources() throws HeatBridgeException { + // Arrange + String heatStackId = "1234567"; + List<Resource> expectedResourceList = (List<Resource>) extractTestStackResources(); + when(osClient.getStackBasedResources(heatStackId, HeatBridgeConstants.OS_DEFAULT_HEAT_NESTING)) + .thenReturn(expectedResourceList); + + // Act + List<Resource> resourceList = heatbridge.queryNestedHeatStackResources(heatStackId); + + // Assert + verify(osClient).getStackBasedResources(heatStackId, HeatBridgeConstants.OS_DEFAULT_HEAT_NESTING); + assertEquals(resourceList, expectedResourceList); + } + + @Test + public void testExtractStackResourceIdsByResourceType() throws HeatBridgeException { + // Arrange + List<Resource> expectedResourceList = (List<Resource>) extractTestStackResources(); + List<String> expectedServerIds = + Arrays.asList("43c2159b-2c04-46ac-bda5-594110cae2d3", "7cff109a-b2b7-4933-97b4-ec44a8365568"); + + // Act + List<String> serverIds = heatbridge.extractStackResourceIdsByResourceType(expectedResourceList, + HeatBridgeConstants.OS_SERVER_RESOURCE_TYPE); + + // Assert + assertEquals(expectedServerIds, serverIds); + } + + @Ignore + @Test + public void testGetAllOpenstackServers() { + // Arrange + List<Resource> stackResources = (List<Resource>) extractTestStackResources(); + + Server server1 = mock(Server.class); + Server server2 = mock(Server.class); + List<Server> expectedServers = Arrays.asList(server1, server2); + + when(osClient.getServerById("43c2159b-2c04-46ac-bda5-594110cae2d3")).thenReturn(server1); + when(osClient.getServerById("7cff109a-b2b7-4933-97b4-ec44a8365568")).thenReturn(server2); + + // Act + List<Server> servers = heatbridge.getAllOpenstackServers(stackResources); + + // Assert + assertEquals(expectedServers, servers); + } + + @Ignore + @Test + public void testExtractOpenstackImagesFromServers() { + // Arrange + Server server1 = mock(Server.class); + Server server2 = mock(Server.class); + List<Server> servers = Arrays.asList(server1, server2); + + Image image1 = mock(Image.class); + Image image2 = mock(Image.class); + when(image1.getId()).thenReturn("1"); + when(image2.getId()).thenReturn("1"); + List<Image> expectedDistinctImages = Collections.singletonList(image1); + + when(server1.getImage()).thenReturn(image1); + when(server2.getImage()).thenReturn(image2); + + // Act + List<Image> images = heatbridge.extractOpenstackImagesFromServers(servers); + + // Assert + assertEquals(expectedDistinctImages, images); + } + + @Ignore + @Test + public void testExtractOpenstackFlavorsFromServers() { + // Arrange + Server server1 = mock(Server.class); + Server server2 = mock(Server.class); + List<Server> servers = Arrays.asList(server1, server2); + + Flavor flavor1 = mock(Flavor.class); + Flavor flavor2 = mock(Flavor.class); + when(flavor1.getId()).thenReturn("1"); + when(flavor2.getId()).thenReturn("2"); + List<Flavor> expectedFlavors = Arrays.asList(flavor1, flavor2); + + when(server1.getFlavor()).thenReturn(flavor1); + when(server2.getFlavor()).thenReturn(flavor2); + + // Act + List<Flavor> flavors = heatbridge.extractOpenstackFlavorsFromServers(servers); + + // Assert + assertEquals(expectedFlavors, flavors); + } + + @Test + public void testUpdateVserversToAai() throws HeatBridgeException { + // Arrange + Server server1 = mock(Server.class); + + when(server1.getId()).thenReturn("test-server1-id"); + when(server1.getHypervisorHostname()).thenReturn("test-hypervisor"); + when(server1.getName()).thenReturn("test-server1-name"); + when(server1.getStatus()).thenReturn(Status.ACTIVE); + when(server1.getLinks()).thenReturn(new ArrayList<>()); + + Server server2 = mock(Server.class); + when(server2.getId()).thenReturn("test-server2-id"); + when(server2.getHypervisorHostname()).thenReturn("test-hypervisor"); + when(server2.getName()).thenReturn("test-server2-name"); + when(server2.getStatus()).thenReturn(Status.ACTIVE); + when(server2.getLinks()).thenReturn(new ArrayList<>()); + + List<Server> servers = Arrays.asList(server1, server2); + + Image image = mock(Image.class); + when(server1.getImage()).thenReturn(image); + when(server2.getImage()).thenReturn(image); + when(image.getId()).thenReturn("test-image-id"); + + Flavor flavor = mock(Flavor.class); + when(server1.getFlavor()).thenReturn(flavor); + when(server2.getFlavor()).thenReturn(flavor); + when(flavor.getId()).thenReturn("test-flavor-id"); + + + // Act + heatbridge.buildAddVserversToAaiAction("test-genericVnf-id", "test-vfModule-id", servers); + + // Assert + ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class); + verify(transaction, times(2)).create(captor.capture(), any(Vserver.class)); + + List<AAIResourceUri> uris = captor.getAllValues(); + assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID, + server1.getId()), uris.get(0)); + assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID, + server2.getId()), uris.get(1)); + + } + + @Test + public void testUpdateImagesToAai() throws HeatBridgeException { + // Arrange + Image image1 = mock(Image.class); + when(image1.getId()).thenReturn("test-image1-id"); + when(image1.getName()).thenReturn("test-image1-name"); + when(image1.getLinks()).thenReturn(new ArrayList<>()); + + Image image2 = mock(Image.class); + when(image2.getId()).thenReturn("test-image2-id"); + when(image2.getName()).thenReturn("test-image2-name"); + when(image2.getLinks()).thenReturn(new ArrayList<>()); + + List<Image> images = Arrays.asList(image1, image2); + + // Act #1 + heatbridge.buildAddImagesToAaiAction(images); + + // Assert #1 + verify(transaction, times(2)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Image.class)); + + // Act #2 + heatbridge.buildAddImagesToAaiAction(images); + + // Assert #2 + verify(transaction, times(4)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Image.class)); + } + + @Test + public void testUpdateFlavorsToAai() throws HeatBridgeException { + // Arrange + Flavor flavor1 = mock(Flavor.class); + when(flavor1.getId()).thenReturn("test-flavor1-id"); + when(flavor1.getName()).thenReturn("test-flavor1-name"); + when(flavor1.getLinks()).thenReturn(new ArrayList<>()); + + Flavor flavor2 = mock(Flavor.class); + when(flavor2.getId()).thenReturn("test-flavor2-id"); + when(flavor2.getName()).thenReturn("test-flavor2-name"); + when(flavor2.getLinks()).thenReturn(new ArrayList<>()); + + List<Flavor> flavors = Arrays.asList(flavor1, flavor2); + + // Act #1 + heatbridge.buildAddFlavorsToAaiAction(flavors); + + // Assert #1 + verify(transaction, times(2)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class)); + + // Act #2 + heatbridge.buildAddFlavorsToAaiAction(flavors); + + // Assert #2 + verify(transaction, times(4)).create(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Flavor.class)); + } + + @Ignore + @Test + public void testUpdateVserverLInterfacesToAai() throws HeatBridgeException { + // Arrange + List<Resource> stackResources = (List<Resource>) extractTestStackResources(); + Port port = mock(Port.class); + when(port.getId()).thenReturn("test-port-id"); + when(port.getName()).thenReturn("test-port-name"); + when(port.getvNicType()).thenReturn(HeatBridgeConstants.OS_SRIOV_PORT_TYPE); + when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78"); + when(port.getNetworkId()).thenReturn("890a203a-23gg-56jh-df67-731656a8f13a"); + when(port.getDeviceId()).thenReturn("test-device-id"); + when(port.getVifDetails()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_VLAN_NETWORK_KEY, "2345")); + String pfPciId = "0000:08:00.0"; + when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId, + HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id")); + + Network network = mock(Network.class); + when(network.getId()).thenReturn("test-network-id"); + when(network.getNetworkType()).thenReturn(NetworkType.VLAN); + when(network.getProviderSegID()).thenReturn("2345"); + + when(osClient.getPortById("212a203a-9764-4f42-84ea-731536a8f13a")).thenReturn(port); + when(osClient.getPortById("387e3904-8948-43d1-8635-b6c2042b54da")).thenReturn(port); + when(osClient.getPortById("70a09dfd-f1c5-4bc8-bd8f-dc539b8d662a")).thenReturn(port); + when(osClient.getPortById("12f88b4d-c8a4-4fbd-bcb4-7e36af02430b")).thenReturn(port); + when(osClient.getPortById("c54b9f45-b413-4937-bbe4-3c8a5689cfc9")).thenReturn(port); + when(osClient.getNetworkById(anyString())).thenReturn(network); + + SriovPf sriovPf = new SriovPf(); + sriovPf.setPfPciId(pfPciId); + PInterface pIf = mock(PInterface.class); + when(pIf.getInterfaceName()).thenReturn("test-port-id"); + when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf)); + + // Act + heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2")); + + // Assert + verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class)); + verify(osClient, times(5)).getPortById(anyString()); + verify(osClient, times(5)).getNetworkById(anyString()); + } + + private List<? extends Resource> extractTestStackResources() { + List<HeatResource> stackResources = null; + try { + stackResources = MAPPER.readValue(readTestResourceFile("stack-resources.json"), Resources.class).getList(); + assertNotNull(stackResources); + assertFalse(stackResources.isEmpty()); + } catch (IOException e) { + Assert.fail("Failed to extract test stack resources."); + } + return stackResources; + } + + private String readTestResourceFile(String filePath) { + String content = null; + String pathname = Objects.requireNonNull(getClass().getClassLoader().getResource(filePath)).getFile(); + File file = new File(pathname); + try { + content = Objects.requireNonNull(FileUtils.readFileToString(file, Charset.defaultCharset())); + } catch (IOException e) { + Assert.fail(String.format("Failed to read test resource file (%s)", filePath)); + } + return content; + } +} diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java index b382b6bcf8..796d122505 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduBlueprintTest.java @@ -22,7 +22,6 @@ package org.onap.so.vdu.utils; import java.util.HashMap; import java.util.Map; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java index 6331563362..7041c7e949 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/vdu/utils/VduInfoTest.java @@ -22,7 +22,6 @@ package org.onap.so.vdu.utils; import java.util.HashMap; import java.util.Map; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; diff --git a/adapters/mso-openstack-adapters/src/test/resources/AuditResultsMissSub.json b/adapters/mso-openstack-adapters/src/test/resources/AuditResultsMissSub.json new file mode 100644 index 0000000000..13b0d6ae43 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/AuditResultsMissSub.json @@ -0,0 +1,604 @@ +{ + "auditList": [ + { + "aaiObject": { + "inMaint": null, + "isClosedLoopDisabled": null, + "linterfaces": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "volumes": null, + "vserverId": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "vserverName": null, + "vserverName2": null, + "vserverSelflink": null + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": null, + "interfaceDescription": null, + "interfaceId": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b", + "interfaceName": "tsbc0005v_tsbc0005vm002_trusted_port", + "interfaceRole": null, + "isIpUnnumbered": null, + "isPortMirrored": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": null, + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": null + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_trusted_port" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": null, + "interfaceDescription": null, + "interfaceId": "27391d94-33af-474a-927d-d409249e8fd3", + "interfaceName": "tsbc0005v_tsbc0005vm002_svc2_port_0", + "interfaceRole": null, + "isIpUnnumbered": null, + "isPortMirrored": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "d54dfd09-75c6-4e04-b204-909455b8f933", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:27:39:1d:94:33", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 101, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "vpnKey": null + } + ] + } + }, + { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "f7a998c0-8939-4b07-bf4a-0862e9c325e1", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:27:39:1d:94:33", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 101, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "vpnKey": null + } + ] + } + }, + { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "621c1fea-60b8-44ee-aede-c01b8b1aaa70", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:27:39:1d:94:33", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 103, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103", + "vpnKey": null + } + ] + } + } + ] + }, + "macaddr": null, + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": null + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "d54dfd09-75c6-4e04-b204-909455b8f933", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:27:39:1d:94:33", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 101, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "vpnKey": null + } + ] + } + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "f7a998c0-8939-4b07-bf4a-0862e9c325e1", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:27:39:1d:94:33", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 101, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101", + "vpnKey": null + } + ] + } + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_101" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "621c1fea-60b8-44ee-aede-c01b8b1aaa70", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:27:39:1d:94:33", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 103, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103", + "vpnKey": null + } + ] + } + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc2_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc2_103" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": null, + "interfaceDescription": null, + "interfaceId": "07f5b14c-147a-4d14-8c94-a9e94dbc097b", + "interfaceName": "tsbc0005v_tsbc0005vm002_mgmt_port_1", + "interfaceRole": null, + "isIpUnnumbered": null, + "isPortMirrored": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": null, + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": null + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_mgmt_port_1" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": null, + "interfaceDescription": null, + "interfaceId": "8d93f63e-e972-48c7-ad98-b2122da47315", + "interfaceName": "tsbc0005v_tsbc0005vm002_mgmt_port_0", + "interfaceRole": null, + "isIpUnnumbered": null, + "isPortMirrored": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": null, + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": null + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_mgmt_port_0" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": null, + "interfaceDescription": null, + "interfaceId": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "interfaceName": "tsbc0005v_tsbc0005vm002_svc1_port_0", + "interfaceRole": null, + "isIpUnnumbered": null, + "isPortMirrored": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "2bbfa345-33bb-495a-94b2-fb514ee1cffc", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:05:94:a2:f2:7e", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 81, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81", + "vpnKey": null + } + ] + } + } + ] + }, + "macaddr": null, + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": null + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc1_port_0" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": false, + "interfaceDescription": null, + "interfaceId": "2bbfa345-33bb-495a-94b2-fb514ee1cffc", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81", + "interfaceRole": null, + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": "02:05:94:a2:f2:7e", + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": { + "vlan": [ + { + "backdoorConnection": null, + "inMaint": false, + "isIpUnnumbered": false, + "isPrivate": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "orchestrationStatus": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "speedUnits": null, + "speedValue": null, + "vlanDescription": null, + "vlanIdInner": 81, + "vlanIdOuter": null, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81", + "vpnKey": null + } + ] + } + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_svc1_port_0/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_subint_untrusted_svc1_81" + }, + { + "aaiObject": { + "adminStatus": null, + "allowedAddressPairs": null, + "inMaint": null, + "interfaceDescription": null, + "interfaceId": "00bb8407-650e-48b5-b919-33b88d6f8fe3", + "interfaceName": "tsbc0005v_tsbc0005vm002_int_ha_port_0", + "interfaceRole": null, + "isIpUnnumbered": null, + "isPortMirrored": null, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": null, + "macaddr": null, + "managementOption": null, + "networkName": null, + "priority": null, + "provStatus": null, + "relationshipList": null, + "resourceVersion": null, + "selflink": null, + "sriovVfs": null, + "v6WanLinkIp": null, + "vlans": null + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/regionOne/tenants/tenant/0422ffb57ba042c0800a29dc85ca70f8/vservers/vserver/92272b67-d23f-42ca-87fa-7b06a9ec81f3/l-interfaces/l-interface/tsbc0005v_tsbc0005vm002_int_ha_port_0" + } + ] +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/ExpectedVServerFound.json b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVServerFound.json new file mode 100644 index 0000000000..1f8e58ab5b --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVServerFound.json @@ -0,0 +1,167 @@ +{ + "auditList": [ + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1", + "interfaceName": "test_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2", + "interfaceName": "test_port_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2" + }, + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + { + "aaiObject": { + "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c", + "interfaceName": "ssc_1_trusted_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0" + }, + { + "aaiObject": { + "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56", + "interfaceName": "ssc_1_service1_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0" + }, + { + "aaiObject": { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2" + }, + { + "aaiObject": { + "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b", + "interfaceName": "ssc_1_mgmt_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1" + }, + { + "aaiObject": { + "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff", + "interfaceName": "ssc_1_mgmt_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0" + }, + { + "aaiObject": { + "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4", + "interfaceName": "ssc_1_service2_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0" + }, + { + "aaiObject": { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8", + "interfaceName": "ssc_1_int_ha_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0" + } + ] +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/ExpectedVserversToAudit.json b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVserversToAudit.json new file mode 100644 index 0000000000..96fe500cc2 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/ExpectedVserversToAudit.json @@ -0,0 +1,135 @@ +[ + { + "linterfaces": { + "linterface": [ + { + "interfaceId": "7ee06d9d-3d18-411c-9d3e-aec930f70413", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "27391d94-33af-474a-927d-d409249e8fd3", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "inMaint": false, + "interfaceId": "d54dfd09-75c6-4e04-b204-909455b8f933", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101", + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "macaddr": "02:27:39:1d:94:33", + "vlans": { + "vlan": [ + { + "inMaint": false, + "isIpUnnumbered": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "vlanIdInner": 101, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101" + } + ] + } + }, + { + "inMaint": false, + "interfaceId": "f7a998c0-8939-4b07-bf4a-0862e9c325e1", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101", + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "macaddr": "02:27:39:1d:94:33", + "vlans": { + "vlan": [ + { + "inMaint": false, + "isIpUnnumbered": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "vlanIdInner": 101, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101" + } + ] + } + }, + { + "inMaint": false, + "interfaceId": "621c1fea-60b8-44ee-aede-c01b8b1aaa70", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_103", + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "macaddr": "02:27:39:1d:94:33", + "vlans": { + "vlan": [ + { + "inMaint": false, + "isIpUnnumbered": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "vlanIdInner": 103, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_103" + } + ] + } + } + ] + } + }, + { + "interfaceId": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "8d93f63e-e972-48c7-ad98-b2122da47315", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "inMaint": false, + "interfaceId": "2bbfa345-33bb-495a-94b2-fb514ee1cffc", + "interfaceName": "tsbc0005v_tsbc0005vm002_subint_untrusted_service2_81", + "isIpUnnumbered": false, + "isPortMirrored": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "macaddr": "02:05:94:a2:f2:7e", + "vlans": { + "vlan": [ + { + "inMaint": false, + "isIpUnnumbered": false, + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "vlanIdInner": 81, + "vlanInterface": "tsbc0005v_tsbc0005vm002_subint_untrusted_service2_81" + } + ] + } + } + ] + } + }, + { + "interfaceId": "00bb8407-650e-48b5-b919-33b88d6f8fe3", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + }, + "vserverId": "92272b67-d23f-42ca-87fa-7b06a9ec81f3" + } +] diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetNestedResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetNestedResources.json new file mode 100644 index 0000000000..73769d745d --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/GetNestedResources.json @@ -0,0 +1,277 @@ +{ + "resources": [ + { + "resource_name": "rar_keypair", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module/9b93aecf-fe05-4047-ba36-d5eb7bc7354e/resources/rar_keypair", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module/9b93aecf-fe05-4047-ba36-d5eb7bc7354e", + "rel": "stack" + } + ], + "logical_resource_id": "rar_keypair", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:49Z", + "required_by": [ + "rar_node_0" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "rdm6ararf8001v-key_pair", + "resource_type": "OS::Nova::KeyPair" + }, + { + "resource_name": "rar_node_0", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module/9b93aecf-fe05-4047-ba36-d5eb7bc7354e/resources/rar_node_0", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module/9b93aecf-fe05-4047-ba36-d5eb7bc7354e", + "rel": "stack" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "nested" + } + ], + "logical_resource_id": "rar_node_0", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:49Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "c4876377-22bb-45d2-9fc3-f36a32207fa5", + "resource_type": "nest_rareport_server.yaml" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_volumeattachment_0", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_volumeattachment_0", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_volumeattachment_0", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "a27b9151-f439-437e-b7b0-94068cc856fa", + "resource_type": "OS::Cinder::VolumeAttachment" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_volume_0", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_volume_0", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_volume_0", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_volumeattachment_0" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "a27b9151-f439-437e-b7b0-94068cc856fa", + "resource_type": "OS::Cinder::Volume" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_RMM", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_RMM", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_RMM", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_server_0" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "dd23e047-d169-4cc3-a90a-6bc81b1ea17a", + "resource_type": "OS::Heat::MultipartMime" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_server_0", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_server_0", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_server_0", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_volumeattachment_0" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "03a31a65-91ed-4563-9d5d-4f7223df9767", + "resource_type": "OS::Nova::Server" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_RSC", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_RSC", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_RSC", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_RMM" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "7cea5faf-f5a8-4182-a686-05964f51ad95", + "resource_type": "OS::Heat::SoftwareConfig" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_0_oam_port_0", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_0_oam_port_0", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_0_oam_port_0", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_server_0" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "d2bc253c-96a5-47df-a00f-5b9f3eebe684", + "resource_type": "OS::Neutron::Port" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_RCC_2", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_RCC_2", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_RCC_2", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_RMM" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "15d092ab-4702-4635-8da9-24fff85c175b", + "resource_type": "OS::Heat::CloudConfig" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_RCC_0", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_RCC_0", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_RCC_0", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_RMM" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "9420ad4c-49da-4f23-89fc-109f9d5a4505", + "resource_type": "OS::Heat::CloudConfig" + }, + { + "parent_resource": "rar_node_0", + "resource_name": "rar_RCC_1", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5/resources/rar_RCC_1", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module-rar_node_0-4pkqvamx52u6/c4876377-22bb-45d2-9fc3-f36a32207fa5", + "rel": "stack" + } + ], + "logical_resource_id": "rar_RCC_1", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:56Z", + "required_by": [ + "rar_RMM" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "321b91fb-f265-4e56-8025-3c3e88da320a", + "resource_type": "OS::Heat::CloudConfig" + }, + { + "resource_name": "rar_Sec_Grp", + "links": [ + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module/9b93aecf-fe05-4047-ba36-d5eb7bc7354e/resources/rar_Sec_Grp", + "rel": "self" + }, + { + "href": "https://test.com:8004/v1/326799122bd4451c801153f5db7f8509/stacks/rdm6ararf8001v_base_module/9b93aecf-fe05-4047-ba36-d5eb7bc7354e", + "rel": "stack" + } + ], + "logical_resource_id": "rar_Sec_Grp", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2019-04-02T20:13:49Z", + "required_by": [ + "rar_node_0" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "99fc77c6-019b-441c-ad99-b48dd1059f71", + "resource_type": "OS::Neutron::SecurityGroup" + } + ] +}
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json index 22e66d41bb..0d403a62b5 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json +++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json @@ -1,6 +1,6 @@ { - "resources": [ - { + "resources": [ + { "links": [ { "href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732/resources/vlbagent_eph_aff_id", @@ -22,207 +22,576 @@ "resource_type": "OS::Heat::RandomString", "updated_time": "2019-02-07T22:56:12Z" }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_trusted_port_0", + "physical_resource_id": "7ee06d9d-3d18-411c-9d3e-aec930f70413", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_trusted_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_service1_port_0", + "physical_resource_id": "36551a08-592c-4329-ab75-6c594420754c", + "required_by": [ + "ssc_1_subint_service1_port_0_subinterfaces", + "ssc_server_1" + ], + "resource_name": "ssc_1_service1_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c", + "rel": "nested" + } + ], + "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces", + "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c", + "required_by": [], + "resource_name": "ssc_1_subint_service2_port_0_subinterfaces", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Heat::ResourceGroup", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_mgmt_port_1", + "physical_resource_id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_mgmt_port_1", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_mgmt_port_0", + "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_mgmt_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ { - "resource_name": "ssc_1_trusted_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_trusted_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_service1_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_service1_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_1_subint_service1_port_0_subinterfaces", - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "27391d94-33af-474a-927d-d409249e8fd3", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_subint_service2_port_0_subinterfaces", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c", - "rel": "nested" - } - ], - "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [], - "resource_status_reason": "state changed", - "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c", - "resource_type": "OS::Heat::ResourceGroup" - }, - { - "resource_name": "ssc_1_mgmt_port_1", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_mgmt_port_1", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "07f5b14c-147a-4d14-8c94-a9e94dbc097b", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_mgmt_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_mgmt_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_service2_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_service2_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_1_subint_service2_port_0_subinterfaces", - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_int_ha_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_int_ha_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_server_1", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_server_1", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [], - "resource_status_reason": "state changed", - "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", - "resource_type": "OS::Nova::Server" - }, - { - "resource_name": "ssc_1_subint_service1_port_0_subinterfaces", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672", - "rel": "nested" - } - ], - "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [], - "resource_status_reason": "state changed", - "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672", - "resource_type": "OS::Heat::ResourceGroup" - } - ] + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_service2_port_0", + "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "required_by": [ + "ssc_1_subint_service2_port_0_subinterfaces", + "ssc_server_1" + ], + "resource_name": "ssc_1_service2_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_int_ha_port_0", + "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_int_ha_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_server_1", + "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "required_by": [], + "resource_name": "ssc_server_1", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Nova::Server", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672", + "rel": "nested" + } + ], + "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces", + "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672", + "required_by": [], + "resource_name": "ssc_1_subint_service1_port_0_subinterfaces", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Heat::ResourceGroup", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "resources": [ + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/1", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-1-fmn5laetg5cs/0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "rel": "nested" + } + ], + "logical_resource_id": "1", + "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces", + "physical_resource_id": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "required_by": [], + "resource_name": "1", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "vlan_subinterface_ssc_service1.yaml", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m/b7019dd0-2ee9-4447-bdef-ac25676b205a", + "rel": "nested" + } + ], + "logical_resource_id": "0", + "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces", + "physical_resource_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "required_by": [], + "resource_name": "0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "vlan_subinterface_ssc_service1.yaml", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672/resources/2", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c", + "rel": "nested" + } + ], + "logical_resource_id": "2", + "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces", + "physical_resource_id": "bd0fc728-cbde-4301-a581-db56f494675c", + "required_by": [], + "resource_name": "2", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "vlan_subinterface_ssc_service1.yaml", + "updated_time": "2019-01-23T19:34:56Z" + } + ] + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0", + "parent_resource": "0", + "physical_resource_id": "d54dfd09-75c6-4e04-b204-909455b8f933", + "required_by": [ + "ssc_subint_service_1_vmi_0_v6_ip_0", + "ssc_subint_service_1_vmi_0_ip_0" + ], + "resource_name": "ssc_subint_service_1_vmi_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::VirtualMachineInterface", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0_v6_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0_v6_ip_0", + "parent_resource": "0", + "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f", + "required_by": [], + "resource_name": "ssc_subint_service_1_vmi_0_v6_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0_ip_0", + "parent_resource": "0", + "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506", + "required_by": [], + "resource_name": "ssc_subint_service_1_vmi_0_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0", + "parent_resource": "0", + "physical_resource_id": "f7a998c0-8939-4b07-bf4a-0862e9c325e1", + "required_by": [ + "ssc_subint_service_1_vmi_0_v6_ip_0", + "ssc_subint_service_1_vmi_0_ip_0" + ], + "resource_name": "ssc_subint_service_1_vmi_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::VirtualMachineInterface", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0_v6_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0_v6_ip_0", + "parent_resource": "0", + "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f", + "required_by": [], + "resource_name": "ssc_subint_service_1_vmi_0_v6_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0_ip_0", + "parent_resource": "0", + "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506", + "required_by": [], + "resource_name": "ssc_subint_service_1_vmi_0_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0", + "parent_resource": "0", + "physical_resource_id": "621c1fea-60b8-44ee-aede-c01b8b1aaa70", + "required_by": [ + "ssc_subint_service_1_vmi_0_v6_ip_0", + "ssc_subint_service_1_vmi_0_ip_0" + ], + "resource_name": "ssc_subint_service_1_vmi_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::VirtualMachineInterface", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0_v6_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0_v6_ip_0", + "parent_resource": "0", + "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f", + "required_by": [], + "resource_name": "ssc_subint_service_1_vmi_0_v6_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service_1_vmi_0_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service_1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service_1_vmi_0_ip_0", + "parent_resource": "0", + "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506", + "required_by": [], + "resource_name": "ssc_subint_service_1_vmi_0_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c/resources/0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "nested" + } + ], + "logical_resource_id": "0", + "parent_resource": "ssc_1_subint_service2_port_0_subinterfaces", + "physical_resource_id": "f711be16-2654-4a09-b89d-0511fda20e81", + "required_by": [], + "resource_name": "0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "vlan_subinterface_ssc_service2.yaml", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service2_vmi_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service2_vmi_0", + "parent_resource": "0", + "physical_resource_id": "2bbfa345-33bb-495a-94b2-fb514ee1cffc", + "required_by": [ + "ssc_subint_service2_vmi_0_v6_ip_0", + "ssc_subint_service2_vmi_0_ip_0" + ], + "resource_name": "ssc_subint_service2_vmi_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::VirtualMachineInterface", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service2_vmi_0_v6_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service2_vmi_0_v6_ip_0", + "parent_resource": "0", + "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f", + "required_by": [], + "resource_name": "ssc_subint_service2_vmi_0_v6_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_service2_vmi_0_ip_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_subint_service2_vmi_0_ip_0", + "parent_resource": "0", + "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506", + "required_by": [], + "resource_name": "ssc_subint_service2_vmi_0_ip_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::ContrailV2::InstanceIp", + "updated_time": "2019-01-23T19:34:56Z" + } + ] } + diff --git a/adapters/mso-openstack-adapters/src/test/resources/NestedExpectedValue.json b/adapters/mso-openstack-adapters/src/test/resources/NestedExpectedValue.json new file mode 100644 index 0000000000..337f3ce853 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NestedExpectedValue.json @@ -0,0 +1 @@ +[{"vserverId":"03a31a65-91ed-4563-9d5d-4f7223df9767","linterfaces":{"linterface":[]}}]
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json new file mode 100644 index 0000000000..e4bd83c21d --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "7ee06d9d-3d18-411c-9d3e-aec930f70413", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json new file mode 100644 index 0000000000..376a526133 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "27391d94-33af-474a-927d-d409249e8fd3", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json new file mode 100644 index 0000000000..f0549216be --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json new file mode 100644 index 0000000000..fa10b0c864 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "8d93f63e-e972-48c7-ad98-b2122da47315", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json new file mode 100644 index 0000000000..54a9ee8404 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json new file mode 100644 index 0000000000..c47dfd755b --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "00bb8407-650e-48b5-b919-33b88d6f8fe3", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json index 0f3f35418e..d4745bec9f 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json +++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json @@ -4,23 +4,23 @@ "resources": [ { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0", + "resource_name": "ssc_subint_svc1_vmi_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [ - "ssc_subint_mis_vmi_0_v6_ip_0", - "ssc_subint_mis_vmi_0_ip_0" + "ssc_subint_svc1_vmi_0_v6_ip_0", + "ssc_subint_svc1_vmi_0_ip_0" ], "resource_status_reason": "state changed", "physical_resource_id": "d54dfd09-75c6-4e04-b204-909455b8f933", @@ -28,18 +28,18 @@ }, { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0_v6_ip_0", + "resource_name": "ssc_subint_svc1_vmi_0_v6_ip_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_v6_ip_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0_v6_ip_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [], @@ -49,18 +49,18 @@ }, { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0_ip_0", + "resource_name": "ssc_subint_svc1_vmi_0_ip_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_ip_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0_ip_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [], diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json index cfc4d7fed6..68d3e0f880 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json +++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json @@ -4,23 +4,23 @@ "resources": [ { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0", + "resource_name": "ssc_subint_svc1_vmi_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [ - "ssc_subint_mis_vmi_0_v6_ip_0", - "ssc_subint_mis_vmi_0_ip_0" + "ssc_subint_svc1_vmi_0_v6_ip_0", + "ssc_subint_svc1_vmi_0_ip_0" ], "resource_status_reason": "state changed", "physical_resource_id": "f7a998c0-8939-4b07-bf4a-0862e9c325e1", @@ -28,18 +28,18 @@ }, { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0_v6_ip_0", + "resource_name": "ssc_subint_svc1_vmi_0_v6_ip_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_v6_ip_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0_v6_ip_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [], @@ -49,18 +49,18 @@ }, { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0_ip_0", + "resource_name": "ssc_subint_svc1_vmi_0_ip_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_ip_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0_ip_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [], diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json index e8aa80eb6f..4f4d25d96b 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json +++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json @@ -4,23 +4,23 @@ "resources": [ { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0", + "resource_name": "ssc_subint_svc1_vmi_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [ - "ssc_subint_mis_vmi_0_v6_ip_0", - "ssc_subint_mis_vmi_0_ip_0" + "ssc_subint_svc1_vmi_0_v6_ip_0", + "ssc_subint_svc1_vmi_0_ip_0" ], "resource_status_reason": "state changed", "physical_resource_id": "621c1fea-60b8-44ee-aede-c01b8b1aaa70", @@ -28,18 +28,18 @@ }, { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0_v6_ip_0", + "resource_name": "ssc_subint_svc1_vmi_0_v6_ip_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_v6_ip_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_v6_ip_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0_v6_ip_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [], @@ -49,18 +49,18 @@ }, { "parent_resource": "0", - "resource_name": "ssc_subint_mis_vmi_0_ip_0", + "resource_name": "ssc_subint_svc1_vmi_0_ip_0", "links": [ { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_mis_vmi_0_ip_0", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81/resources/ssc_subint_svc1_vmi_0_ip_0", "rel": "self" }, { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_mis_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_svc1_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y/f711be16-2654-4a09-b89d-0511fda20e81", "rel": "stack" } ], - "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0", + "logical_resource_id": "ssc_subint_svc1_vmi_0_ip_0", "resource_status": "CREATE_COMPLETE", "updated_time": "2019-01-23T19:34:56Z", "required_by": [], diff --git a/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Network_Sec_Server_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Network_Sec_Server_Not_Found.json new file mode 100644 index 0000000000..d13b4b7672 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Network_Sec_Server_Not_Found.json @@ -0,0 +1,167 @@ +{ + "auditList": [ + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + { + "aaiObject": { + "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c", + "interfaceName": "ssc_1_trusted_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0" + }, + { + "aaiObject": { + "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56", + "interfaceName": "ssc_1_service1_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0" + }, + { + "aaiObject": { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2" + }, + { + "aaiObject": { + "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b", + "interfaceName": "ssc_1_mgmt_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1" + }, + { + "aaiObject": { + "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff", + "interfaceName": "ssc_1_mgmt_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0" + }, + { + "aaiObject": { + "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4", + "interfaceName": "ssc_1_service2_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0" + }, + { + "aaiObject": { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8", + "interfaceName": "ssc_1_int_ha_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0" + }, + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1", + "interfaceName": "test_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2", + "interfaceName": "test_port_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2" + } + ] +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Sec_Server_Not_Found2.json b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Sec_Server_Not_Found2.json new file mode 100644 index 0000000000..eb0fb7ca76 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_Sec_Server_Not_Found2.json @@ -0,0 +1,167 @@ +{ + "auditList": [ + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + { + "aaiObject": { + "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c", + "interfaceName": "ssc_1_trusted_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0" + }, + { + "aaiObject": { + "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56", + "interfaceName": "ssc_1_service1_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0" + }, + { + "aaiObject": { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2" + }, + { + "aaiObject": { + "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b", + "interfaceName": "ssc_1_mgmt_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1" + }, + { + "aaiObject": { + "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff", + "interfaceName": "ssc_1_mgmt_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0" + }, + { + "aaiObject": { + "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4", + "interfaceName": "ssc_1_service2_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0" + }, + { + "aaiObject": { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8", + "interfaceName": "ssc_1_int_ha_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0" + }, + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + "aaiObjectType": "vserver", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1", + "interfaceName": "test_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2", + "interfaceName": "test_port_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2" + } + ] +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_network_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_network_Not_Found.json new file mode 100644 index 0000000000..0cb47dcb5e --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/VServer_Found_network_Not_Found.json @@ -0,0 +1,167 @@ +{ + "auditList": [ + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1", + "interfaceName": "test_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2", + "interfaceName": "test_port_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2" + }, + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + { + "aaiObject": { + "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c", + "interfaceName": "ssc_1_trusted_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0" + }, + { + "aaiObject": { + "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56", + "interfaceName": "ssc_1_service1_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0" + }, + { + "aaiObject": { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2" + }, + { + "aaiObject": { + "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b", + "interfaceName": "ssc_1_mgmt_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1" + }, + { + "aaiObject": { + "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff", + "interfaceName": "ssc_1_mgmt_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0" + }, + { + "aaiObject": { + "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4", + "interfaceName": "ssc_1_service2_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0" + }, + { + "aaiObject": { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8", + "interfaceName": "ssc_1_int_ha_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0" + } + ] +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/Vserver2_Found_VServer1_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/Vserver2_Found_VServer1_Not_Found.json new file mode 100644 index 0000000000..f3dc38d51b --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/Vserver2_Found_VServer1_Not_Found.json @@ -0,0 +1,167 @@ +{ + "auditList": [ + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + "aaiObjectType": "vserver", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1", + "interfaceName": "test_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2", + "interfaceName": "test_port_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": true, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2" + }, + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + "aaiObjectType": "vserver", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + { + "aaiObject": { + "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c", + "interfaceName": "ssc_1_trusted_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0" + }, + { + "aaiObject": { + "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56", + "interfaceName": "ssc_1_service1_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0" + }, + { + "aaiObject": { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2" + }, + { + "aaiObject": { + "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b", + "interfaceName": "ssc_1_mgmt_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1" + }, + { + "aaiObject": { + "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff", + "interfaceName": "ssc_1_mgmt_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0" + }, + { + "aaiObject": { + "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4", + "interfaceName": "ssc_1_service2_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0" + }, + { + "aaiObject": { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8", + "interfaceName": "ssc_1_int_ha_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0" + } + ] +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/Vservers_Not_Found.json b/adapters/mso-openstack-adapters/src/test/resources/Vservers_Not_Found.json new file mode 100644 index 0000000000..d9089dc099 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/Vservers_Not_Found.json @@ -0,0 +1,167 @@ +{ + "auditList": [ + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + "aaiObjectType": "vserver", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz1", + "interfaceName": "test_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adz2", + "interfaceName": "test_port_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4dz/l-interfaces/l-interface/test_port_2" + }, + { + "aaiObject": { + "vserverId": "3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + "aaiObjectType": "vserver", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db" + }, + { + "aaiObject": { + "interfaceId": "dec8bdc7-5718-41dc-bfbb-561ff6eeb81c", + "interfaceName": "ssc_1_trusted_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_trusted_port_0" + }, + { + "aaiObject": { + "interfaceId": "1c56a24b-5f03-435a-850d-31cd4252de56", + "interfaceName": "ssc_1_service1_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0" + }, + { + "aaiObject": { + "interfaceId": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb", + "interfaceName": "service1_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "b7019dd0-2ee9-4447-bdef-ac25676b205a", + "interfaceName": "service1_sub_interface_2", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service1_port_0/l-interfaces/l-interface/service1_sub_interface_2" + }, + { + "aaiObject": { + "interfaceId": "12afcd28-929f-4d80-8a5a-0833bfd5e20b", + "interfaceName": "ssc_1_mgmt_port_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_1" + }, + { + "aaiObject": { + "interfaceId": "80baec42-ffae-425f-ad8c-3f7b2c24bfff", + "interfaceName": "ssc_1_mgmt_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_mgmt_port_0" + }, + { + "aaiObject": { + "interfaceId": "13eddf95-4cf3-45f2-823a-2d890a6549b4", + "interfaceName": "ssc_1_service2_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [], + "linterfaces": { + "linterface": [ + { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + } + ] + } + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0" + }, + { + "aaiObject": { + "interfaceId": "f711be16-2654-4a09-b89d-0511fda20e81", + "interfaceName": "service2_sub_interface_1", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "sub-l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_service2_port_0/l-interfaces/l-interface/service2_sub_interface_1" + }, + { + "aaiObject": { + "interfaceId": "9cab2903-70f7-44fd-b681-491d6ae2adb8", + "interfaceName": "ssc_1_int_ha_port_0", + "l3InterfaceIpv4AddressList": [], + "l3InterfaceIpv6AddressList": [] + }, + "aaiObjectType": "l-interface", + "doesObjectExist": false, + "resourceURI": "/cloud-infrastructure/cloud-regions/cloud-region/cloudOwner/cloudRegion/tenants/tenant/tenantId/vservers/vserver/3a4c2ca5-27b3-4ecc-98c5-06804867c4db/l-interfaces/l-interface/ssc_1_int_ha_port_0" + } + ] +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackNetworkResponse.json b/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackNetworkResponse.json new file mode 100644 index 0000000000..d319fedecd --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/__files/RollbackNetworkResponse.json @@ -0,0 +1,5 @@ +{ + "rollbackNetworkResponse" : { + "networkRolledBack" : true + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml index 398885cd08..694aedae10 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -64,6 +64,8 @@ tomcat: max-threads: 50 mso: logPath: logs + msb-ip: localhost + msb-port: ${wiremock.server.port} catalog: db: spring: @@ -75,6 +77,10 @@ mso: core-pool-size: 50 max-pool-size: 50 queue-capacity: 500 + workflow: + topics: + retryMultiplier: 60000 + retrySequence: 1, 1, 2, 3, 5, 8, 13, 20 spring: datasource: url: jdbc:mariadb://localhost:3307/catalogdb diff --git a/adapters/mso-openstack-adapters/src/test/resources/data.sql b/adapters/mso-openstack-adapters/src/test/resources/data.sql index 77df06bb92..3f6abc4f63 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/data.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/data.sql @@ -1,4 +1,4 @@ - +set foreign_key_checks=0; insert into heat_files(artifact_uuid, name, version, description, body, artifact_checksum, creation_timestamp) values ('00535bdd-0878-4478-b95a-c575c742bfb0', 'nimbus-ethernet-gw', '1', 'created from csar', 'DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n', 'MANUAL RECORD', '2017-01-21 23:56:43'); @@ -29,24 +29,19 @@ insert into heat_environment(artifact_uuid, name, version, description, body, ar insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values ('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null); -insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values -('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null); +insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design,service_model_uuid) values +('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null,'5df8b6de-2083-11e7-93ae-92361f002671'); insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values - ('20c4431c-246d-11e7-93ae-92361f002671', '78ca26d0-246d-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::base::module-0', 'vSAMP10a DEV Base', '1', 'ff874603-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'), ('066de97e-253e-11e7-93ae-92361f002671', '64efd51a-2544-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'); -insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid) values -('cb82ffd8-252a-11e7-93ae-92361f002671', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002671'), -('b4ea86b4-253f-11e7-93ae-92361f002671', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002671'); +insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid,VNF_RESOURCE_CUSTOMIZATION_ID) values +('cb82ffd8-252a-11e7-93ae-92361f002671', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002671',2), +('b4ea86b4-253f-11e7-93ae-92361f002671', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002671',2); -insert into vnf_res_custom_to_vf_module_custom(vnf_resource_cust_model_customization_uuid, vf_module_cust_model_customization_uuid, creation_timestamp) values -('68dc9a92-214c-11e7-93ae-92361f002671', 'cb82ffd8-252a-11e7-93ae-92361f002671', '2017-05-26 15:08:24'), -('68dc9a92-214c-11e7-93ae-92361f002671', 'b4ea86b4-253f-11e7-93ae-92361f002671', '2017-05-26 15:08:24'); - insert into allotted_resource(model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type, subcategory, description, creation_timestamp) values ('f6b7d4c6-e8a4-46e2-81bc-31cad5072842', 'b7a1b78e-6b6b-4b36-9698-8c9530da14af', '1.0', 'Tunnel_Xconn', '', '', '', '2017-05-26 15:08:24'); @@ -88,22 +83,15 @@ insert into collection_network_resource_customization(model_customization_uuid, insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values ('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', null); -insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values -('68dc9a92-214c-11e7-93ae-92361f002672', 'vSAMP10a 2', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002672', null); insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values ('20c4431c-246d-11e7-93ae-92361f002672', '78ca26d0-246d-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::base::module-0', 'vSAMP10a DEV Base', '1', 'ff874603-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'), ('066de97e-253e-11e7-93ae-92361f002672', '64efd51a-2544-11e7-93ae-92361f002671', '2', 'vSAMP10aDEV::PCM::module-1', 'vSAMP10a DEV PCM', '0', 'ff87482f-4222-11e7-9252-005056850d2e', null, '2016-09-14 18:19:56', 'ff2ae348-214a-11e7-93ae-92361f002671'); -insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid) values -('cb82ffd8-252a-11e7-93ae-92361f002672', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002672'), -('b4ea86b4-253f-11e7-93ae-92361f002672', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002672'); - - -insert into vnf_res_custom_to_vf_module_custom(vnf_resource_cust_model_customization_uuid, vf_module_cust_model_customization_uuid, creation_timestamp) values -('68dc9a92-214c-11e7-93ae-92361f002672', 'cb82ffd8-252a-11e7-93ae-92361f002672', '2017-05-26 15:08:24'), -('68dc9a92-214c-11e7-93ae-92361f002672', 'b4ea86b4-253f-11e7-93ae-92361f002672', '2017-05-26 15:08:24'); +insert into vf_module_customization(model_customization_uuid, label, initial_count, min_instances, max_instances, availability_zone_count, heat_environment_artifact_uuid, vol_environment_artifact_uuid, creation_timestamp, vf_module_model_uuid,VNF_RESOURCE_CUSTOMIZATION_ID) values +('cb82ffd8-252a-11e7-93ae-92361f002672', 'base', '1', '0', '0', '0', 'fefb1601-4222-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '20c4431c-246d-11e7-93ae-92361f002672',2), +('b4ea86b4-253f-11e7-93ae-92361f002672', 'PCM', '0', '0', '0', '0', 'fefb1751-4333-11e7-9252-005056850d2e', null, '2017-05-26 15:08:23', '066de97e-253e-11e7-93ae-92361f002672',2); insert into vf_module_to_heat_files(vf_module_model_uuid, heat_files_artifact_uuid) values @@ -116,12 +104,8 @@ insert into network_resource_customization_to_service(service_model_uuid, resour ('5df8b6de-2083-11e7-93ae-92361f002672', '3bdbb104-476c-483e-9f8b-c095b3d308ac'); -insert into vnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values -('5df8b6de-2083-11e7-93ae-92361f002671', '68dc9a92-214c-11e7-93ae-92361f002671'), -('5df8b6de-2083-11e7-93ae-92361f002672', '68dc9a92-214c-11e7-93ae-92361f002672'); - insert into allotted_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values -('5df8b6de-2083-11e7-93ae-92361f002671', '367a8ba9-057a-4506-b106-fbae818597c6' ), +('5df8b6de-2083-11e7-93ae-92361f002671', '367a8ba9-057a-4506-b106-fbae818597c6'), ('5df8b6de-2083-11e7-93ae-92361f002672', '367a8ba9-057a-4506-b106-fbae818597c6'); @@ -140,7 +124,7 @@ VALUES ('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'fsb_volume_image_name_0', b'1', ('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'fsb_volume_size_0', b'1', 'number', NULL), ('97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', 'fsb_volume_type_0', b'1', 'string', NULL); - INSERT INTO `vf_module` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `DESCRIPTION`, `IS_BASE`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `VOL_HEAT_TEMPLATE_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VNF_RESOURCE_MODEL_UUID`) +INSERT INTO `vf_module` (`MODEL_UUID`, `MODEL_INVARIANT_UUID`, `MODEL_VERSION`, `MODEL_NAME`, `DESCRIPTION`, `IS_BASE`, `HEAT_TEMPLATE_ARTIFACT_UUID`, `VOL_HEAT_TEMPLATE_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VNF_RESOURCE_MODEL_UUID`) VALUES ('207fe0dc-4c89-4e5d-9a78-345e99ef7fbe', '547e9ac6-0489-41b6-8289-a7705f6e5c9d', '1', 'TestVnfType::TestModule-0', NULL, 1, 'd187c228-71c6-4c6d-8f33-cd1243442d0a', '97b73b0f-2860-49e5-b9c5-b6f91e4ee4a8', '2018-05-13 12:12:09', 'c5efeb55-4ade-49b8-815c-6a6391f6c46b'); INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION`, `BODY`, `ARTIFACT_CHECKSUM`, `CREATION_TIMESTAMP`) VALUES ('f4a21b58-5654-4cf6-9c50-de42004fe2b4', 'base_vmme.env', '2', 'Auto-generated HEAT Environment deployment artifact', 'parameters:\n Internal1_allow_transit: "True"\n Internal1_dhcp: "False"\n Internal1_forwarding_mode: "l2"\n Internal1_net_cidr: "169.253.0.0"\n Internal1_net_cidr_len: "17"\n Internal1_net_gateway: "169.253.0.3"\n Internal1_rpf: "disable"\n Internal1_shared: "False"\n Internal2_allow_transit: "True"\n Internal2_dhcp: "False"\n Internal2_forwarding_mode: "l2"\n Internal2_net_cidr: "169.255.0.0"\n Internal2_net_cidr_len: "17"\n Internal2_net_gateway: "169.255.0.3"\n Internal2_rpf: "disable"\n Internal2_shared: "False"\n domain_name: "default-domain"\n fsb1_Internal1_mac: "00:80:37:0E:0B:12"\n fsb1_Internal2_mac: "00:80:37:0E:0B:12"\n fsb2_Internal1_mac: "00:80:37:0E:0D:12"\n fsb2_Internal2_mac: "00:80:37:0E:0D:12"\n fsb_flavor_name: "nv.c20r64d1"\n gtp_sec_group_name: "gtp-sec-group"\n int1_sec_group_name: "int1-sec-group"\n int2_sec_group_name: "int2-sec-group"\n ncb1_Internal1_mac: "00:80:37:0E:09:12"\n ncb1_Internal2_mac: "00:80:37:0E:09:12"\n ncb2_Internal1_mac: "00:80:37:0E:0F:12"\n ncb2_Internal2_mac: "00:80:37:0E:0F:12"\n ncb_flavor_name: "nv.c20r64d1"\n oam_sec_group_name: "oam-sec-group"\n pxe_image_name: "MME_PXE-Boot_16ACP04_GA.qcow2"\n sctp-a-IPv6_ethertype: "IPv6"\n sctp-a-display_name: "epc-sctp-a-ipv4v6-sec-group"\n sctp-a-dst_subnet_prefix_v6: "::"\n sctp-a-egress-dst_end_port: 65535\n sctp-a-egress-dst_start_port: 0\n sctp-a-egress-src_end_port: 65535\n sctp-a-egress-src_start_port: 0\n sctp-a-egress_action: "pass"\n sctp-a-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-a-egress_dst_subnet_prefix_len: 0\n sctp-a-egress_ethertype: "IPv4"\n sctp-a-egress_rule_application: "any"\n sctp-a-egress_rule_protocol: "icmp"\n sctp-a-egress_src_addresses: "local"\n sctp-a-ingress-dst_end_port: 65535\n sctp-a-ingress-dst_start_port: 0\n sctp-a-ingress-src_end_port: 65535\n sctp-a-ingress-src_start_port: 0\n sctp-a-ingress-src_subnet_prefix: "0.0.0.0"\n sctp-a-ingress-src_subnet_prefix_len: 0\n sctp-a-ingress_action: "pass"\n sctp-a-ingress_dst_addresses: "local"\n sctp-a-ingress_ethertype: "IPv4"\n sctp-a-ingress_rule_application: "any"\n sctp-a-ingress_rule_protocol: "icmp"\n sctp-a-ipv6-egress-dst_start_port: "0"\n sctp-a-ipv6-egress_action: "pass"\n sctp-a-ipv6-egress_dst_end_port: "65535"\n sctp-a-ipv6-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-a-ipv6-egress_dst_subnet_prefix_len: "0"\n sctp-a-ipv6-egress_ethertype: "IPv4"\n sctp-a-ipv6-egress_rule_application: "any"\n sctp-a-ipv6-egress_rule_protocol: "any"\n sctp-a-ipv6-egress_src_addresses: "local"\n sctp-a-ipv6-egress_src_end_port: "65535"\n sctp-a-ipv6-egress_src_start_port: "0"\n sctp-a-ipv6-ingress-dst_end_port: "65535"\n sctp-a-ipv6-ingress-dst_start_port: "0"\n sctp-a-ipv6-ingress-src_end_port: 65535\n sctp-a-ipv6-ingress-src_start_port: 0\n sctp-a-ipv6-ingress_action: "pass"\n sctp-a-ipv6-ingress_dst_addresses: "local"\n sctp-a-ipv6-ingress_ethertype: "IPv4"\n sctp-a-ipv6-ingress_rule_application: "any"\n sctp-a-ipv6-ingress_rule_protocol: "any"\n sctp-a-ipv6-ingress_src_subnet_prefix: "0.0.0.0"\n sctp-a-ipv6-ingress_src_subnet_prefix_len: "0"\n sctp-a-name: "epc-sctp-a-ipv4v6-sec-group"\n sctp-a-src_subnet_prefix_v6: "::"\n sctp-b-IPv6_ethertype: "IPv6"\n sctp-b-display_name: "epc-sctp-b-ipv4v6-sec-group"\n sctp-b-dst_subnet_prefix_v6: "::"\n sctp-b-egress-dst_end_port: 65535\n sctp-b-egress-dst_start_port: 0\n sctp-b-egress-src_end_port: 65535\n sctp-b-egress-src_start_port: 0\n sctp-b-egress_action: "pass"\n sctp-b-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-b-egress_dst_subnet_prefix_len: 0\n sctp-b-egress_ethertype: "IPv4"\n sctp-b-egress_rule_application: "any"\n sctp-b-egress_rule_protocol: "icmp"\n sctp-b-egress_src_addresses: "local"\n sctp-b-ingress-dst_end_port: 65535\n sctp-b-ingress-dst_start_port: 0\n sctp-b-ingress-src_end_port: 65535\n sctp-b-ingress-src_start_port: 0\n sctp-b-ingress-src_subnet_prefix: "0.0.0.0"\n sctp-b-ingress-src_subnet_prefix_len: 0\n sctp-b-ingress_action: "pass"\n sctp-b-ingress_dst_addresses: "local"\n sctp-b-ingress_ethertype: "IPv4"\n sctp-b-ingress_rule_application: "any"\n sctp-b-ingress_rule_protocol: "icmp"\n sctp-b-ipv6-egress-dst_start_port: "0"\n sctp-b-ipv6-egress_action: "pass"\n sctp-b-ipv6-egress_dst_end_port: "65535"\n sctp-b-ipv6-egress_dst_subnet_prefix: "0.0.0.0"\n sctp-b-ipv6-egress_dst_subnet_prefix_len: "0"\n sctp-b-ipv6-egress_ethertype: "IPv4"\n sctp-b-ipv6-egress_rule_application: "any"\n sctp-b-ipv6-egress_rule_protocol: "any"\n sctp-b-ipv6-egress_src_addresses: "local"\n sctp-b-ipv6-egress_src_end_port: "65535"\n sctp-b-ipv6-egress_src_start_port: "0"\n sctp-b-ipv6-ingress-dst_end_port: "65535"\n sctp-b-ipv6-ingress-dst_start_port: "0"\n sctp-b-ipv6-ingress-src_end_port: 65535\n sctp-b-ipv6-ingress-src_start_port: 0\n sctp-b-ipv6-ingress_action: "pass"\n sctp-b-ipv6-ingress_dst_addresses: "local"\n sctp-b-ipv6-ingress_ethertype: "IPv4"\n sctp-b-ipv6-ingress_rule_application: "any"\n sctp-b-ipv6-ingress_rule_protocol: "any"\n sctp-b-ipv6-ingress_src_subnet_prefix: "0.0.0.0"\n sctp-b-ipv6-ingress_src_subnet_prefix_len: "0"\n sctp-b-name: "epc-sctp-b-ipv4v6-sec-group"\n sctp-b-src_subnet_prefix_v6: "::"\n sctp_rule_protocol: "132"\n vlc_st_availability_zone: "True"\n vlc_st_interface_type_gtp: "other0"\n vlc_st_interface_type_int1: "other1"\n vlc_st_interface_type_int2: "other2"\n vlc_st_interface_type_oam: "management"\n vlc_st_interface_type_sctp_a: "left"\n vlc_st_interface_type_sctp_b: "right"\n vlc_st_service_mode: "in-network-nat"\n vlc_st_service_type: "firewall"\n vlc_st_version: "2"\n vlc_st_virtualization_type: "virtual-machine"\n availability_zone_0: \n availability_zone_1: \n availability_zone_2: \n availability_zone_3: \n fsb_name_0: \n fsb_name_1: \n fsb_oam_ip_0: \n fsb_oam_ip_1: \n fsb_volume_id_0: \n fsb_volume_id_1: \n gtp_net_fqdn: \n gtp_net_name: \n ncb_name_0: \n ncb_name_1: \n oam_net_fqdn: \n oam_net_name: \n sctp_a_net_fqdn: \n sctp_a_net_name: \n sctp_b_net_fqdn: \n sctp_b_net_name: \n vf_module_id: \n vlc_gtp_route_prefixes: \n vlc_oam_route_prefixes: \n vlc_sctp_a_route_prefixes: \n vlc_sctp_b_route_prefixes: \n vnf_id: \n vnf_name: \n', 'MGJjYzM2ZWY1ODBjYzc1MzBiMGQxZmI4N2MyZmFkY2E=', '2018-05-13 12:12:09'); @@ -148,7 +132,8 @@ INSERT INTO `heat_environment` (`ARTIFACT_UUID`, `NAME`, `VERSION`, `DESCRIPTION - INSERT INTO `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`, `LABEL`, `INITIAL_COUNT`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_COUNT`, `HEAT_ENVIRONMENT_ARTIFACT_UUID`, `VOL_ENVIRONMENT_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VF_MODULE_MODEL_UUID`) VALUES ('9b339a61-69ca-465f-86b8-1c72c582b8e8', 'base_vmme', 1, 1, 1, NULL, 'f4a21b58-5654-4cf6-9c50-de42004fe2b4', '3375f64b-4709-4802-8713-7a164763f9cd', '2018-05-13 12:12:09', '207fe0dc-4c89-4e5d-9a78-345e99ef7fbe'); +INSERT INTO `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`, `LABEL`, `INITIAL_COUNT`, `MIN_INSTANCES`, `MAX_INSTANCES`, `AVAILABILITY_ZONE_COUNT`, `HEAT_ENVIRONMENT_ARTIFACT_UUID`, `VOL_ENVIRONMENT_ARTIFACT_UUID`, `CREATION_TIMESTAMP`, `VF_MODULE_MODEL_UUID`,VNF_RESOURCE_CUSTOMIZATION_ID) +VALUES ('9b339a61-69ca-465f-86b8-1c72c582b8e8', 'base_vmme', 1, 1, 1, NULL, 'f4a21b58-5654-4cf6-9c50-de42004fe2b4', '3375f64b-4709-4802-8713-7a164763f9cd', '2018-05-13 12:12:09', '207fe0dc-4c89-4e5d-9a78-345e99ef7fbe',2); INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08'); @@ -157,7 +142,7 @@ INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `PR INSERT INTO `cloud_sites` (`ID`, `region_id`, `identity_service_id`, `cloud_version`, `clli`, `cloudify_id`, `platform`, `orchestrator`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'mtn13', 'MTN13', '3.0', 'MDT13', 'mtn13', null, 'orchestrator', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); - +set foreign_key_checks=1; diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql index ac08f8b645..29a81e8fdf 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql +++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql @@ -1,834 +1,1237 @@ - -create table `allotted_resource` ( - `model_uuid` varchar(200) not null, - `model_invariant_uuid` varchar(200) not null, - `model_version` varchar(20) not null, - `model_name` varchar(200) not null, - `tosca_node_type` varchar(200) default null, - `subcategory` varchar(200) default null, - `description` varchar(1200) default null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`model_uuid`) -) engine=innodb default charset=latin1; - - - - -create table `allotted_resource_customization` ( - `model_customization_uuid` varchar(200) not null, - `model_instance_name` varchar(200) not null, - `providing_service_model_uuid` varchar(200) default null, - `providing_service_model_invariant_uuid` varchar(200) default null, - `providing_service_model_name` varchar(200) default null, - `target_network_role` varchar(200) default null, - `nf_type` varchar(200) default null, - `nf_role` varchar(200) default null, - `nf_function` varchar(200) default null, - `nf_naming_code` varchar(200) default null, - `min_instances` int(11) default null, - `max_instances` int(11) default null, - `ar_model_uuid` varchar(200) not null, - `resource_input` varchar(20000) default null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`model_customization_uuid`), - key `fk_allotted_resource_customization__allotted_resource1_idx` (`ar_model_uuid`), - constraint `fk_allotted_resource_customization__allotted_resource1` foreign key (`ar_model_uuid`) references `allotted_resource` (`model_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - - -create table `heat_environment` ( - `artifact_uuid` varchar(200) not null, - `name` varchar(100) not null, - `version` varchar(20) not null, - `description` varchar(1200) default null, - `body` longtext not null, - `artifact_checksum` varchar(200) not null default 'manual record', - `creation_timestamp` datetime not null default current_timestamp, - primary key (`artifact_uuid`) -) engine=innodb default charset=latin1; - - - -create table `heat_files` ( - `artifact_uuid` varchar(200) not null, - `name` varchar(200) not null, - `version` varchar(20) not null, - `description` varchar(1200) default null, - `body` longtext not null, - `artifact_checksum` varchar(200) not null default 'manual record', - `creation_timestamp` datetime not null default current_timestamp, - primary key (`artifact_uuid`) -) engine=innodb default charset=latin1; - - - - -create table `heat_template` ( - `artifact_uuid` varchar(200) not null, - `name` varchar(200) not null, - `version` varchar(20) not null, - `description` varchar(1200) default null, - `body` longtext not null, - `timeout_minutes` int(11) default null, - `artifact_checksum` varchar(200) not null default 'manual record', - `creation_timestamp` datetime not null default current_timestamp, - primary key (`artifact_uuid`) -) engine=innodb default charset=latin1; - - - -create table `heat_nested_template` ( - `parent_heat_template_uuid` varchar(200) not null, - `child_heat_template_uuid` varchar(200) not null, - `provider_resource_file` varchar(100) default null, - primary key (`parent_heat_template_uuid`,`child_heat_template_uuid`), - key `fk_heat_nested_template__heat_template2_idx` (`child_heat_template_uuid`), - constraint `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` foreign key (`child_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade, - constraint `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` foreign key (`parent_heat_template_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - - -create table `heat_template_params` ( - `heat_template_artifact_uuid` varchar(200) not null, - `param_name` varchar(100) not null, - `is_required` bit(1) not null, - `param_type` varchar(20) default null, - `param_alias` varchar(45) default null, - primary key (`heat_template_artifact_uuid`,`param_name`), - constraint `fk_heat_template_params__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - -create table `network_recipe` ( - `id` int(11) not null auto_increment, - `model_name` varchar(20) not null, - `action` varchar(50) not null, - `description` varchar(1200) default null, - `orchestration_uri` varchar(256) not null, - `network_param_xsd` varchar(2048) default null, - `recipe_timeout` int(11) default null, - `service_type` varchar(45) default null, - `creation_timestamp` datetime not null default current_timestamp, - `version_str` varchar(20) not null, - primary key (`id`), - unique key `uk_rl4f296i0p8lyokxveaiwkayi` (`model_name`,`action`,`version_str`) -) engine=innodb auto_increment=178 default charset=latin1; - - - - -create table `temp_network_heat_template_lookup` ( - `network_resource_model_name` varchar(200) not null, - `heat_template_artifact_uuid` varchar(200) not null, - `aic_version_min` varchar(20) not null, - `aic_version_max` varchar(20) default null, - primary key (`network_resource_model_name`), - key `fk_temp_network_heat_template_lookup__heat_template1_idx` (`heat_template_artifact_uuid`), - constraint `fk_temp_network_heat_template_lookup__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade -) engine=innodb default charset=latin1; - - - -create table `network_resource` ( - `model_uuid` varchar(200) not null, - `model_name` varchar(200) not null, - `model_invariant_uuid` varchar(200) default null, - `description` varchar(1200) default null, - `heat_template_artifact_uuid` varchar(200) null, - `neutron_network_type` varchar(20) default null, - `model_version` varchar(20) default null, - `tosca_node_type` varchar(200) default null, - `aic_version_min` varchar(20) null, - `aic_version_max` varchar(20) default null, - `orchestration_mode` varchar(20) default 'heat', - `resource_category` varchar(20) default null, - `resource_sub_category` varchar(20) default null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`model_uuid`), - key `fk_network_resource__temp_network_heat_template_lookup1_idx` (`model_name`), - key `fk_network_resource__heat_template1_idx` (`heat_template_artifact_uuid`), - constraint `fk_network_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete no action on update cascade -) engine=innodb default charset=latin1; - - - - - -create table `network_resource_customization` ( - `model_customization_uuid` varchar(200) not null, - `model_instance_name` varchar(200) not null, - `network_technology` varchar(45) default null, - `network_type` varchar(45) default null, - `network_role` varchar(200) default null, - `network_scope` varchar(45) default null, - `creation_timestamp` datetime not null default current_timestamp, - `network_resource_model_uuid` varchar(200) not null, - `resource_input` varchar(20000) default null, - primary key (`model_customization_uuid`), - key `fk_network_resource_customization__network_resource1_idx` (`network_resource_model_uuid`), - constraint `fk_network_resource_customization__network_resource1` foreign key (`network_resource_model_uuid`) references `network_resource` (`model_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - - - -create table `tosca_csar` ( - `artifact_uuid` varchar(200) not null, - `name` varchar(200) not null, - `version` varchar(20) not null, - `description` varchar(1200) default null, - `artifact_checksum` varchar(200) not null, - `url` varchar(200) not null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`artifact_uuid`) -) engine=innodb default charset=latin1; - - - - -create table `service` ( - `model_uuid` varchar(200) not null, - `model_name` varchar(200) not null, - `model_invariant_uuid` varchar(200) not null, - `model_version` varchar(20) not null, - `description` varchar(1200) default null, - `creation_timestamp` datetime not null default current_timestamp, - `tosca_csar_artifact_uuid` varchar(200) default null, - `service_type` varchar(200) default null, - `service_role` varchar(200) default null, - `environment_context` varchar(200) default null, - `workload_context` varchar(200) default null, - `resource_order` varchar(200) default null, - primary key (`model_uuid`), - key `fk_service__tosca_csar1_idx` (`tosca_csar_artifact_uuid`), - constraint `fk_service__tosca_csar1` foreign key (`tosca_csar_artifact_uuid`) references `tosca_csar` (`artifact_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - -create table `service_recipe` ( - `id` int(11) not null auto_increment, - `action` varchar(50) not null, - `version_str` varchar(20) default null, - `description` varchar(1200) default null, - `orchestration_uri` varchar(256) not null, - `service_param_xsd` varchar(2048) default null, - `recipe_timeout` int(11) default null, - `service_timeout_interim` int(11) default null, - `creation_timestamp` datetime not null default current_timestamp, - `service_model_uuid` varchar(200) not null, - primary key (`id`), - unique key `uk_7fav5dkux2v8g9d2i5ymudlgc` (`service_model_uuid`,`action`), - key `fk_service_recipe__service1_idx` (`service_model_uuid`), - constraint `fk_service_recipe__service1` foreign key (`service_model_uuid`) references `service` (`model_uuid`) on delete cascade on update cascade -) engine=innodb auto_increment=86 default charset=latin1; - - - -create table `vnf_resource` ( - `orchestration_mode` varchar(20) not null default 'heat', - `description` varchar(1200) default null, - `creation_timestamp` datetime not null default current_timestamp, - `model_uuid` varchar(200) not null, - `aic_version_min` varchar(20) default null, - `aic_version_max` varchar(20) default null, - `model_invariant_uuid` varchar(200) default null, - `model_version` varchar(20) not null, - `model_name` varchar(200) default null, - `tosca_node_type` varchar(200) default null, - `resource_category` varchar(200) default null, - `resource_sub_category` varchar(200) default null, - `heat_template_artifact_uuid` varchar(200) default null, - primary key (`model_uuid`), - key `fk_vnf_resource__heat_template1` (`heat_template_artifact_uuid`), - constraint `fk_vnf_resource__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - - -create table `vf_module` ( - `model_uuid` varchar(200) not null, - `model_invariant_uuid` varchar(200) default null, - `model_version` varchar(20) not null, - `model_name` varchar(200) not null, - `description` varchar(1200) default null, - `is_base` int(11) not null, - `heat_template_artifact_uuid` varchar(200) default null, - `vol_heat_template_artifact_uuid` varchar(200) default null, - `creation_timestamp` datetime not null default current_timestamp, - `vnf_resource_model_uuid` varchar(200) not null, - primary key (`model_uuid`,`vnf_resource_model_uuid`), - key `fk_vf_module__vnf_resource1_idx` (`vnf_resource_model_uuid`), - key `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`heat_template_artifact_uuid`), - key `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`vol_heat_template_artifact_uuid`), - constraint `fk_vf_module__heat_template_art_uuid__heat_template1` foreign key (`heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade, - constraint `fk_vf_module__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade, - constraint `fk_vf_module__vol_heat_template_art_uuid__heat_template2` foreign key (`vol_heat_template_artifact_uuid`) references `heat_template` (`artifact_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - -/*!40101 set @saved_cs_client = @@character_set_client */; -/*!40101 set character_set_client = utf8 */; -create table `vf_module_customization` ( - `model_customization_uuid` varchar(200) not null, - `label` varchar(200) default null, - `initial_count` int(11) default '0', - `min_instances` int(11) default '0', - `max_instances` int(11) default null, - `availability_zone_count` int(11) default null, - `heat_environment_artifact_uuid` varchar(200) default null, - `vol_environment_artifact_uuid` varchar(200) default null, - `creation_timestamp` datetime not null default current_timestamp, - `vf_module_model_uuid` varchar(200) not null, - primary key (`model_customization_uuid`), - key `fk_vf_module_customization__vf_module1_idx` (`vf_module_model_uuid`), - key `fk_vf_module_customization__heat_env__heat_environment1_idx` (`heat_environment_artifact_uuid`), - key `fk_vf_module_customization__vol_env__heat_environment2_idx` (`vol_environment_artifact_uuid`), - constraint `fk_vf_module_customization__heat_env__heat_environment1` foreign key (`heat_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade, - constraint `fk_vf_module_customization__vf_module1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade, - constraint `fk_vf_module_customization__vol_env__heat_environment2` foreign key (`vol_environment_artifact_uuid`) references `heat_environment` (`artifact_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; -/*!40101 set character_set_client = @saved_cs_client */; - - - - - -create table `vf_module_to_heat_files` ( - `vf_module_model_uuid` varchar(200) not null, - `heat_files_artifact_uuid` varchar(200) not null, - primary key (`vf_module_model_uuid`,`heat_files_artifact_uuid`), - key `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`heat_files_artifact_uuid`), - constraint `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` foreign key (`heat_files_artifact_uuid`) references `heat_files` (`artifact_uuid`) on delete cascade on update cascade, - constraint `fk_vf_module_to_heat_files__vf_module__model_uuid1` foreign key (`vf_module_model_uuid`) references `vf_module` (`model_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1 comment='il fait ce qu''il dit'; - - - - -create table `vnf_components` ( - `vnf_id` int(11) not null, - `component_type` varchar(20) not null, - `heat_template_id` int(11) default null, - `heat_environment_id` int(11) default null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`vnf_id`,`component_type`) -) engine=innodb default charset=latin1; - - - - -create table `vnf_components_recipe` ( - `id` int(11) not null auto_increment, - `vnf_type` varchar(200) default null, - `vnf_component_type` varchar(45) not null, - `action` varchar(50) not null, - `service_type` varchar(45) default null, - `version` varchar(20) not null, - `description` varchar(1200) default null, - `orchestration_uri` varchar(256) not null, - `vnf_component_param_xsd` varchar(2048) default null, - `recipe_timeout` int(11) default null, - `creation_timestamp` datetime default current_timestamp, - `vf_module_model_uuid` varchar(200) default null, - primary key (`id`), - unique key `uk_4dpdwddaaclhc11wxsb7h59ma` (`vf_module_model_uuid`,`vnf_component_type`,`action`,`version`) -) engine=innodb auto_increment=26 default charset=latin1; - - - - -create table `vnf_recipe` ( - `id` int(11) not null auto_increment, - `vnf_type` varchar(200) default null, - `action` varchar(50) not null, - `service_type` varchar(45) default null, - `version_str` varchar(20) not null, - `description` varchar(1200) default null, - `orchestration_uri` varchar(256) not null, - `vnf_param_xsd` varchar(2048) default null, - `recipe_timeout` int(11) default null, - `creation_timestamp` datetime default current_timestamp, - `vf_module_id` varchar(100) default null, - primary key (`id`), - unique key `uk_f3tvqau498vrifq3cr8qnigkr` (`vf_module_id`,`action`,`version_str`) -) engine=innodb auto_increment=10006 default charset=latin1; - - -ALTER TABLE `catalogdb`.`vnf_recipe` -CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ; - - - - - -create table `vnf_resource_customization` ( - `model_customization_uuid` varchar(200) not null, - `model_instance_name` varchar(200) not null, - `min_instances` int(11) default null, - `max_instances` int(11) default null, - `availability_zone_max_count` int(11) default null, - `nf_type` varchar(200) default null, - `nf_role` varchar(200) default null, - `nf_function` varchar(200) default null, - `nf_naming_code` varchar(200) default null, - `creation_timestamp` datetime not null default current_timestamp, - `vnf_resource_model_uuid` varchar(200) not null, - `multi_stage_design` varchar(20) default null, - `resource_input` varchar(20000) default null, - `cds_blueprint_name` varchar(200), - `cds_blueprint_version` varchar(200), - primary key (`model_customization_uuid`), - key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`), - constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - - - -create table `vnf_res_custom_to_vf_module_custom` ( - `vnf_resource_cust_model_customization_uuid` varchar(200) not null, - `vf_module_cust_model_customization_uuid` varchar(200) not null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`vnf_resource_cust_model_customization_uuid`,`vf_module_cust_model_customization_uuid`), - key `fk_vnf_res_custom_to_vf_module_custom__vf_module_customizat_idx` (`vf_module_cust_model_customization_uuid`), - constraint `fk_vnf_res_custom_to_vf_module_custom__vf_module_customization1` foreign key (`vf_module_cust_model_customization_uuid`) references `vf_module_customization` (`model_customization_uuid`) on delete cascade on update cascade, - constraint `fk_vnf_res_custom_to_vf_module_custom__vnf_resource_customiza1` foreign key (`vnf_resource_cust_model_customization_uuid`) references `vnf_resource_customization` (`model_customization_uuid`) on delete cascade on update cascade -) engine=innodb default charset=latin1; - - -create table if not exists external_service_to_internal_model_mapping ( -id int(11) not null, -service_name varchar(200) not null, -product_flavor varchar(200) null, -subscription_service_type varchar(200) not null, -service_model_uuid varchar(200) not null, -primary key (id), -unique index uk_external_service_to_internal_model_mapping -(service_name asc, product_flavor asc, service_model_uuid asc)); - -create table if not exists `collection_resource` ( - model_uuid varchar(200) not null, - model_name varchar(200) not null, - model_invariant_uuid varchar(200) not null, - model_version varchar(20) not null, - tosca_node_type varchar(200) not null, - description varchar(200), - creation_timestamp datetime not null default current_timestamp, - primary key (`model_uuid`) -)engine=innodb default charset=latin1; - -create table if not exists `collection_resource_customization` ( - model_customization_uuid varchar(200) not null, - model_instance_name varchar(200) not null, - role varchar(200) NULL, - object_type varchar(200) not null, - function varchar(200) NULL, - collection_resource_type varchar(200) NULL, - creation_timestamp datetime not null default current_timestamp, - cr_model_uuid varchar(200) not null, - primary key (`model_customization_uuid`) -)engine=innodb default charset=latin1; - -create table if not exists `instance_group` ( - model_uuid varchar(200) not null, - model_name varchar(200) not null, - model_invariant_uuid varchar(200) not null, - model_version varchar(20) not null, - tosca_node_type varchar(200) NULL, - role varchar(200) not null, - object_type varchar(200) not null, - creation_timestamp datetime not null default current_timestamp, - cr_model_uuid varchar(200) not null, - instance_group_type varchar(200) not null, - primary key (`model_uuid`) -)engine=innodb default charset=latin1; - -create table if not exists `collection_resource_instance_group_customization` ( - `collection_resource_customization_model_uuid` varchar(200) not null, - `instance_group_model_uuid` varchar(200) not null, - `function` varchar(200) null, - `description` varchar(1200) null, - `subinterface_network_quantity` int(11) null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`collection_resource_customization_model_uuid`, `instance_group_model_uuid`), - index `fk_collection_resource_instance_group_customization__instan_idx` (`instance_group_model_uuid` asc), - constraint `fk_collection_resource_instance_group_customization__collecti1` - foreign key (`collection_resource_customization_model_uuid`) - references `collection_resource_customization` (`model_customization_uuid`) - on delete cascade - on update cascade, - constraint `fk_collection_resource_instance_group_customization__instance1` - foreign key (`instance_group_model_uuid`) - references `instance_group` (`model_uuid`) - on delete cascade - on update cascade) -engine = innodb -default character set = latin1; - -create table if not exists `vnfc_instance_group_customization` ( - `vnf_resource_customization_model_uuid` varchar(200) not null, - `instance_group_model_uuid` varchar(200) not null, - `function` varchar(200) null, - `description` varchar(1200) null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`vnf_resource_customization_model_uuid`, `instance_group_model_uuid`), - index `fk_vnfc_instance_group_customization__instance_group1_idx` (`instance_group_model_uuid` asc), - constraint `fk_vnfc_instance_group_customization__vnf_resource_customizat1` - foreign key (`vnf_resource_customization_model_uuid`) - references `vnf_resource_customization` (`model_customization_uuid`) - on delete cascade - on update cascade, - constraint `fk_vnfc_instance_group_customization__instance_group1` - foreign key (`instance_group_model_uuid`) - references `instance_group` (`model_uuid`) - on delete cascade - on update cascade) -engine = innodb -default character set = latin1; - - create table if not exists `configuration` - ( `model_uuid` varchar(200) not null, - `model_invariant_uuid` varchar(200) not null, - `model_version` varchar(20) not null, - `model_name` varchar(200) not null, - `tosca_node_type` varchar(200) not null, - `description` varchar(1200) null, - `creation_timestamp` datetime not null default current_timestamp, - primary key (`model_uuid`)) - engine = innodb auto_increment = 20654 - default character set = latin1; - - CREATE TABLE IF NOT EXISTS `service_proxy_customization` ( - `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, - `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL, - `MODEL_UUID` VARCHAR(200) NOT NULL, - `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL, - `MODEL_VERSION` VARCHAR(20) NOT NULL, - `MODEL_NAME` VARCHAR(200) NOT NULL, - `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL, - `DESCRIPTION` VARCHAR(1200) NULL, - `SOURCE_SERVICE_MODEL_UUID` VARCHAR(200) NOT NULL, - `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, +set foreign_key_checks=0; +DROP TABLE IF EXISTS `allotted_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `allotted_resource` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `SUBCATEGORY` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `allotted_resource_customization` +-- + +DROP TABLE IF EXISTS `allotted_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `allotted_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `PROVIDING_SERVICE_MODEL_UUID` varchar(200) DEFAULT NULL, + `PROVIDING_SERVICE_MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `PROVIDING_SERVICE_MODEL_NAME` varchar(200) DEFAULT NULL, + `TARGET_NETWORK_ROLE` varchar(200) DEFAULT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `MIN_INSTANCES` int(11) DEFAULT NULL, + `MAX_INSTANCES` int(11) DEFAULT NULL, + `RESOURCE_INPUT` varchar(20000) DEFAULT NULL, + `AR_MODEL_UUID` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), - INDEX `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID` ASC), - UNIQUE INDEX `UK_service_proxy_customization` (`MODEL_CUSTOMIZATION_UUID` ASC), - INDEX `fk_service_proxy_customization__serv_prox_to_serv` (`MODEL_CUSTOMIZATION_UUID` ASC), - CONSTRAINT `fk_service_proxy_resource_customization__service1` - FOREIGN KEY (`SOURCE_SERVICE_MODEL_UUID`) - REFERENCES `service` (`MODEL_UUID`) - ON DELETE CASCADE - ON UPDATE CASCADE) -ENGINE = InnoDB -AUTO_INCREMENT = 20654 -DEFAULT CHARACTER SET = latin1; - - -create table if not exists `configuration_customization` ( -`model_customization_uuid` varchar(200) not null, -`model_instance_name` varchar(200) not null, -`configuration_type` varchar(200) null, -`configuration_role` varchar(200) null, -`configuration_function` varchar(200) null, -`creation_timestamp` datetime not null default current_timestamp, -`configuration_model_uuid` varchar(200) not null, -`service_proxy_customization_model_customization_uuid` varchar(200) null, -`configuration_customization_model_customization_uuid` varchar(200) null, -primary key (`model_customization_uuid`), -index `fk_configuration_customization__configuration_idx` (`configuration_model_uuid` asc), -index `fk_configuration_customization__service_proxy_customization_idx` -(`service_proxy_customization_model_customization_uuid` asc), -index `fk_configuration_customization__configuration_customization_idx` -(`configuration_customization_model_customization_uuid` asc), -constraint `fk_configuration_resource_customization__configuration_resour1` -foreign key (`configuration_model_uuid`) references `configuration` (`model_uuid`) -on delete cascade on update cascade, -constraint `fk_configuration_customization__service_proxy_customization1` foreign -key (`service_proxy_customization_model_customization_uuid`) references -`service_proxy_customization` (`model_customization_uuid`) -on delete cascade on update cascade, constraint -`fk_configuration_customization__configuration_customization1` foreign -key (`configuration_customization_model_customization_uuid`) references -`configuration_customization` (`model_customization_uuid`) -on delete cascade on update cascade) -engine = innodb -auto_increment =20654 -default character set = latin1; - - -create table `service_proxy_customization_to_service` ( - `service_model_uuid` varchar(200) not null, - `resource_model_customization_uuid` varchar(200) not null, - primary key (`service_model_uuid`,`resource_model_customization_uuid`) -)engine=innodb default charset=latin1; - - -create table `configuration_customization_to_service` ( - `service_model_uuid` varchar(200) not null, - `resource_model_customization_uuid` varchar(200) not null, - primary key (`service_model_uuid`,`resource_model_customization_uuid`) -)engine=innodb default charset=latin1; - - -create table if not exists `collection_resource_customization_to_service` ( - `service_model_uuid` varchar(200) not null, - `resource_model_customization_uuid` varchar(200) not null, - primary key (`service_model_uuid`,`resource_model_customization_uuid`) -)engine=innodb default charset=latin1; - - -create table `network_resource_customization_to_service` ( - `service_model_uuid` varchar(200) not null, - `resource_model_customization_uuid` varchar(200) not null, - primary key (`service_model_uuid`,`resource_model_customization_uuid`) -)engine=innodb default charset=latin1; - -create table `vnf_resource_customization_to_service` ( - `service_model_uuid` varchar(200) not null, - `resource_model_customization_uuid` varchar(200) not null, - primary key (`service_model_uuid`,`resource_model_customization_uuid`) -)engine=innodb default charset=latin1; - -create table `allotted_resource_customization_to_service` ( - `service_model_uuid` varchar(200) not null, - `resource_model_customization_uuid` varchar(200) not null, - primary key (`service_model_uuid`,`resource_model_customization_uuid`) -)engine=innodb default charset=latin1; - - -alter table collection_resource_customization -add foreign key ( cr_model_uuid) -references collection_resource(model_uuid) -on delete cascade; - -alter table vnf_resource_customization -add column -instance_group_model_uuid varchar(200); - -alter table network_resource_customization -add column -instance_group_model_uuid varchar(200); - - -alter table network_resource_customization -add foreign key ( instance_group_model_uuid) -references instance_group(model_uuid) -on delete cascade; - -alter table collection_resource_customization_to_service -add foreign key (service_model_uuid) -references service(model_uuid) -on delete cascade; - -alter table allotted_resource_customization_to_service -add foreign key (service_model_uuid) -references service(model_uuid) -on delete cascade; - - -alter table vnf_resource_customization_to_service -add foreign key (service_model_uuid) -references service(model_uuid) -on delete cascade; - - -alter table network_resource_customization_to_service -add foreign key (service_model_uuid) -references service(model_uuid) -on delete cascade; - - -alter table network_resource_customization_to_service -add foreign key (resource_model_customization_uuid) -references network_resource_customization(model_customization_uuid) -on delete cascade; - -alter table vnf_resource_customization_to_service -add foreign key (resource_model_customization_uuid) -references vnf_resource_customization(model_customization_uuid) -on delete cascade; - -alter table allotted_resource_customization_to_service -add foreign key (resource_model_customization_uuid) -references allotted_resource_customization(model_customization_uuid) -on delete cascade; - -alter table collection_resource_customization_to_service -add foreign key (resource_model_customization_uuid) -references collection_resource_customization(model_customization_uuid) -on delete cascade; - -create table ar_recipe ( - ID INT(11) not null auto_increment, - MODEL_NAME VARCHAR(200) NOT NULL, - `ACTION` VARCHAR(200) NOT NULL, - VERSION_STR VARCHAR(200) NOT NULL, - SERVICE_TYPE VARCHAR(200), - DESCRIPTION VARCHAR(200), - ORCHESTRATION_URI VARCHAR(200) NOT NULL, - AR_PARAM_XSD VARCHAR(200), - RECIPE_TIMEOUT INT(10), - CREATION_TIMESTAMP DATETIME NOT NULL default current_timestamp, - primary key (ID), - unique key `uk_ar_recipe` (`model_name`,`action`,`version_str`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -create table if not exists `collection_network_resource_customization` ( -`model_customization_uuid` varchar(200) not null, -`model_instance_name` varchar(200) not null, -`network_technology` varchar(45) null, -`network_type` varchar(45) null, -`network_role` varchar(200) null, -`network_scope` varchar(45) null, -`creation_timestamp` datetime not null default current_timestamp, -`network_resource_model_uuid` varchar(200) not null, `instance_group_model_uuid` varchar(200) null, -`crc_model_customization_uuid` varchar(200) not null, primary key -(`model_customization_uuid`, `crc_model_customization_uuid`), -index `fk_collection_net_resource_customization__network_resource1_idx` -(`network_resource_model_uuid` asc), index -`fk_collection_net_resource_customization__instance_group1_idx` -(`instance_group_model_uuid` asc), index -`fk_col_net_res_customization__collection_res_customization_idx` -(`crc_model_customization_uuid` asc), constraint -`fk_collection_net_resource_customization__network_resource10` foreign -key (`network_resource_model_uuid`) references -`network_resource` (`model_uuid`) on delete cascade on -update cascade, constraint -`fk_collection_net_resource_customization__instance_group10` foreign key -(`instance_group_model_uuid`) references `instance_group` -(`model_uuid`) on delete cascade on update cascade, constraint -`fk_collection_network_resource_customization__collection_reso1` foreign -key (`crc_model_customization_uuid`) references -`collection_resource_customization` -(`model_customization_uuid`) on delete cascade on update cascade) engine -= innodb default character set = latin1; - -CREATE TABLE IF NOT EXISTS `northbound_request_ref_lookup` ( -`id` INT(11) NOT NULL AUTO_INCREMENT, -`REQUEST_SCOPE` VARCHAR(200) NOT NULL, -`ACTION` VARCHAR(200) NOT NULL, -`MACRO_ACTION` VARCHAR(200) NOT NULL, -`IS_ALACARTE` TINYINT(1) NOT NULL DEFAULT 0, -`IS_TOPLEVELFLOW` TINYINT(1) NOT NULL DEFAULT 0, -`MIN_API_VERSION` DOUBLE NOT NULL, -`MAX_API_VERSION` DOUBLE NULL, -PRIMARY KEY (`id`), -UNIQUE INDEX `UK_northbound_request_ref_lookup` (`MIN_API_VERSION` ASC, `REQUEST_SCOPE` ASC, `ACTION` ASC, `IS_ALACARTE` ASC)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - -CREATE TABLE IF NOT EXISTS `orchestration_flow_reference` ( -`id` INT(11) NOT NULL AUTO_INCREMENT, -`COMPOSITE_ACTION` VARCHAR(200) NOT NULL, -`SEQ_NO` INT(11) NOT NULL, -`FLOW_NAME` VARCHAR(200) NOT NULL, -`FLOW_VERSION` DOUBLE NOT NULL, -`NB_REQ_REF_LOOKUP_ID` INT(11) NOT NULL, -PRIMARY KEY (`id`), -INDEX `fk_orchestration_flow_reference__northbound_req_ref_look_idx` (`NB_REQ_REF_LOOKUP_ID` ASC), -UNIQUE INDEX `UK_orchestration_flow_reference` (`COMPOSITE_ACTION` ASC, `FLOW_NAME` ASC, `SEQ_NO` ASC, `NB_REQ_REF_LOOKUP_ID` ASC), -CONSTRAINT `fk_orchestration_flow_reference__northbound_request_ref_look1` -FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` (`id`) -ON DELETE CASCADE ON UPDATE CASCADE) -ENGINE = InnoDB DEFAULT CHARACTER SET = latin1; - -CREATE TABLE IF NOT EXISTS `rainy_day_handler_macro` ( -`id` INT(11) NOT NULL AUTO_INCREMENT, -`FLOW_NAME` VARCHAR(200) NOT NULL, -`SERVICE_TYPE` VARCHAR(200) NOT NULL, -`VNF_TYPE` VARCHAR(200) NOT NULL, -`ERROR_CODE` VARCHAR(200) NOT NULL, -`WORK_STEP` VARCHAR(200) NOT NULL, -`POLICY` VARCHAR(200) NOT NULL, -PRIMARY KEY (`id`)) -ENGINE = InnoDB -DEFAULT CHARACTER SET = latin1; - -create table if not exists model_recipe ( - `ID` INT(11) NOT NULL AUTO_INCREMENT, - `MODEL_ID` INT(11), - `ACTION` VARCHAR(40), - `SCHEMA_VERSION` VARCHAR(40), - `DESCRIPTION` VARCHAR(40), - `ORCHESTRATION_URI` VARCHAR(20), - `MODEL_PARAM_XSD` VARCHAR(20), - `RECIPE_TIMEOUT` INT(11), - `CREATION_TIMESTAMP` datetime not null default current_timestamp, - PRIMARY KEY (`ID`), - CONSTRAINT uk1_model_recipe UNIQUE (`MODEL_ID`, `ACTION`) -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -create table if not exists model ( - `ID` INT(11) NOT NULL AUTO_INCREMENT, - `MODEL_CUSTOMIZATION_ID` VARCHAR(40), - `MODEL_CUSTOMIZATION_NAME` VARCHAR(40), - `MODEL_INVARIANT_ID` VARCHAR(40), - `MODEL_NAME` VARCHAR(40), - `MODEL_TYPE` VARCHAR(20), - `MODEL_VERSION` VARCHAR(20), - `MODEL_VERSION_ID` VARCHAR(40), - `CREATION_TIMESTAMP` datetime not null default current_timestamp, - `RECIPE` INT(11), - PRIMARY KEY (`ID`), - CONSTRAINT uk1_model UNIQUE (`MODEL_TYPE`, `MODEL_VERSION_ID`), - FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE -) ENGINE=InnoDB DEFAULT CHARSET=latin1; - -CREATE TABLE IF NOT EXISTS `identity_services` ( + KEY `fk_allotted_resource_customization__allotted_resource1_idx` (`AR_MODEL_UUID`), + CONSTRAINT `fk_allotted_resource_customization__allotted_resource1` FOREIGN KEY (`AR_MODEL_UUID`) REFERENCES `allotted_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `allotted_resource_customization_to_service` +-- + +DROP TABLE IF EXISTS `allotted_resource_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `allotted_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + KEY `RESOURCE_MODEL_CUSTOMIZATION_UUID` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `allotted_resource_customization_to_service_ibfk_1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE, + CONSTRAINT `allotted_resource_customization_to_service_ibfk_2` FOREIGN KEY (`RESOURCE_MODEL_CUSTOMIZATION_UUID`) REFERENCES `allotted_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `ar_recipe` +-- + +DROP TABLE IF EXISTS `ar_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `ar_recipe` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_NAME` varchar(200) NOT NULL, + `ACTION` varchar(200) NOT NULL, + `VERSION_STR` varchar(200) NOT NULL, + `SERVICE_TYPE` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(200) NOT NULL, + `AR_PARAM_XSD` varchar(200) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE KEY `uk_ar_recipe` (`MODEL_NAME`,`ACTION`,`VERSION_STR`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `building_block_detail` +-- + +DROP TABLE IF EXISTS `building_block_detail`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `building_block_detail` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `BUILDING_BLOCK_NAME` varchar(200) NOT NULL, + `RESOURCE_TYPE` varchar(25) NOT NULL, + `TARGET_ACTION` varchar(25) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_building_block_name` (`BUILDING_BLOCK_NAME`) +) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cloud_sites` +-- + +DROP TABLE IF EXISTS `cloud_sites`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cloud_sites` ( `ID` varchar(50) NOT NULL, - `IDENTITY_URL` varchar(200) DEFAULT NULL, - `MSO_ID` varchar(255) DEFAULT NULL, - `MSO_PASS` varchar(255) DEFAULT NULL, - `PROJECT_DOMAIN_NAME` varchar(255) DEFAULT NULL, - `USER_DOMAIN_NAME` varchar(255) DEFAULT NULL, - `ADMIN_TENANT` varchar(50) DEFAULT NULL, - `MEMBER_ROLE` varchar(50) DEFAULT NULL, - `TENANT_METADATA` tinyint(1) DEFAULT 0, - `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL, - `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL, + `REGION_ID` varchar(11) DEFAULT NULL, + `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL, + `CLOUD_VERSION` varchar(20) DEFAULT NULL, + `CLLI` varchar(11) DEFAULT NULL, + `CLOUDIFY_ID` varchar(50) DEFAULT NULL, + `PLATFORM` varchar(50) DEFAULT NULL, + `ORCHESTRATOR` varchar(50) DEFAULT NULL, `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, - `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), - `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), - PRIMARY KEY (`ID`) -) ; - + `CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), + CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `cloudify_managers` +-- -CREATE TABLE IF NOT EXISTS `cloudify_managers` ( +DROP TABLE IF EXISTS `cloudify_managers`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cloudify_managers` ( `ID` varchar(50) NOT NULL, `CLOUDIFY_URL` varchar(200) DEFAULT NULL, `USERNAME` varchar(255) DEFAULT NULL, `PASSWORD` varchar(255) DEFAULT NULL, `VERSION` varchar(20) DEFAULT NULL, `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, - `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), - `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`ID`) -) ; - +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_network_resource_customization` +-- + +DROP TABLE IF EXISTS `collection_network_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collection_network_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `NETWORK_TECHNOLOGY` varchar(45) DEFAULT NULL, + `NETWORK_TYPE` varchar(45) DEFAULT NULL, + `NETWORK_ROLE` varchar(200) DEFAULT NULL, + `NETWORK_SCOPE` varchar(45) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `NETWORK_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `INSTANCE_GROUP_MODEL_UUID` varchar(200) DEFAULT NULL, + `CRC_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`,`CRC_MODEL_CUSTOMIZATION_UUID`), + KEY `fk_collection_net_resource_customization__network_resource1_idx` (`NETWORK_RESOURCE_MODEL_UUID`), + KEY `fk_collection_net_resource_customization__instance_group1_idx` (`INSTANCE_GROUP_MODEL_UUID`), + KEY `fk_col_net_res_customization__collection_res_customization_idx` (`CRC_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `fk_collection_net_resource_customization__instance_group10` FOREIGN KEY (`INSTANCE_GROUP_MODEL_UUID`) REFERENCES `instance_group` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_collection_net_resource_customization__network_resource10` FOREIGN KEY (`NETWORK_RESOURCE_MODEL_UUID`) REFERENCES `network_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_collection_network_resource_customization__collection_reso1` FOREIGN KEY (`CRC_MODEL_CUSTOMIZATION_UUID`) REFERENCES `collection_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource` +-- + +DROP TABLE IF EXISTS `collection_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collection_resource` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `TOSCA_NODE_TYPE` varchar(200) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource_customization` +-- + +DROP TABLE IF EXISTS `collection_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collection_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `role` varchar(200) DEFAULT NULL, + `object_type` varchar(200) NOT NULL, + `function` varchar(200) DEFAULT NULL, + `collection_resource_type` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CR_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `CR_MODEL_UUID` (`CR_MODEL_UUID`), + CONSTRAINT `collection_resource_customization_ibfk_1` FOREIGN KEY (`CR_MODEL_UUID`) REFERENCES `collection_resource` (`MODEL_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource_customization_to_service` +-- + +DROP TABLE IF EXISTS `collection_resource_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collection_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + KEY `RESOURCE_MODEL_CUSTOMIZATION_UUID` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `collection_resource_customization_to_service_ibfk_1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE, + CONSTRAINT `collection_resource_customization_to_service_ibfk_2` FOREIGN KEY (`RESOURCE_MODEL_CUSTOMIZATION_UUID`) REFERENCES `collection_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `collection_resource_instance_group_customization` +-- + +DROP TABLE IF EXISTS `collection_resource_instance_group_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `collection_resource_instance_group_customization` ( + `COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID` varchar(200) NOT NULL, + `INSTANCE_GROUP_MODEL_UUID` varchar(200) NOT NULL, + `FUNCTION` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `SUBINTERFACE_NETWORK_QUANTITY` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID`,`INSTANCE_GROUP_MODEL_UUID`), + KEY `fk_collection_resource_instance_group_customization__instan_idx` (`INSTANCE_GROUP_MODEL_UUID`), + CONSTRAINT `fk_collection_resource_instance_group_customization__collecti1` FOREIGN KEY (`COLLECTION_RESOURCE_CUSTOMIZATION_MODEL_UUID`) REFERENCES `collection_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_collection_resource_instance_group_customization__instance1` FOREIGN KEY (`INSTANCE_GROUP_MODEL_UUID`) REFERENCES `instance_group` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `configuration` +-- + +DROP TABLE IF EXISTS `configuration`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `configuration` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `TOSCA_NODE_TYPE` varchar(200) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `configuration_customization` +-- + +DROP TABLE IF EXISTS `configuration_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `configuration_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, + `CONFIGURATION_ROLE` varchar(200) DEFAULT NULL, + `CONFIGURATION_FUNCTION` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, + `SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, + `CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_configuration_customization__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + KEY `fk_configuration_customization__service_proxy_customization_idx` (`SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), + KEY `fk_configuration_customization__configuration_customization_idx` (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `fk_configuration_customization__configuration_customization1` FOREIGN KEY (`CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID`) REFERENCES `configuration_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_configuration_resource_customization__configuration_resour1` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `configuration_customization_to_service` +-- + +DROP TABLE IF EXISTS `configuration_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `configuration_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `controller_selection_reference` +-- + +DROP TABLE IF EXISTS `controller_selection_reference`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `controller_selection_reference` ( + `VNF_TYPE` varchar(50) NOT NULL, + `CONTROLLER_NAME` varchar(100) NOT NULL, + `ACTION_CATEGORY` varchar(15) NOT NULL, + PRIMARY KEY (`VNF_TYPE`,`CONTROLLER_NAME`,`ACTION_CATEGORY`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cvnfc_configuration_customization` +-- + +DROP TABLE IF EXISTS `cvnfc_configuration_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cvnfc_configuration_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `CONFIGURATION_TYPE` varchar(200) DEFAULT NULL, + `CONFIGURATION_ROLE` varchar(200) DEFAULT NULL, + `CONFIGURATION_FUNCTION` varchar(200) DEFAULT NULL, + `POLICY_NAME` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CONFIGURATION_MODEL_UUID` varchar(200) NOT NULL, + `CVNFC_CUSTOMIZATION_ID` int(11) DEFAULT NULL, + PRIMARY KEY (`ID`), + KEY `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID`), + CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=20655 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `cvnfc_customization` +-- + +DROP TABLE IF EXISTS `cvnfc_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `cvnfc_customization` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `TOSCA_NODE_TYPE` varchar(200) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `NFC_FUNCTION` varchar(200) DEFAULT NULL, + `NFC_NAMING_CODE` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` varchar(200) DEFAULT NULL, + `VF_MODULE_CUSTOMIZATION_ID` int(13) DEFAULT NULL, + PRIMARY KEY (`ID`), + KEY `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`), + KEY `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_cvnfc_customization_to_vf_module_resource_customization` (`VF_MODULE_CUSTOMIZATION_ID`), + CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_cvnfc_customization_to_vf_module_resource_customization` FOREIGN KEY (`VF_MODULE_CUSTOMIZATION_ID`) REFERENCES `vf_module_customization` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=20655 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `external_service_to_internal_model_mapping` +-- + +DROP TABLE IF EXISTS `external_service_to_internal_model_mapping`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `external_service_to_internal_model_mapping` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `SERVICE_NAME` varchar(200) NOT NULL, + `PRODUCT_FLAVOR` varchar(200) DEFAULT NULL, + `SUBSCRIPTION_SERVICE_TYPE` varchar(200) NOT NULL, + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_external_service_to_internal_model_mapping` (`SERVICE_NAME`,`PRODUCT_FLAVOR`,`SERVICE_MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `flyway_schema_history` +-- + +DROP TABLE IF EXISTS `flyway_schema_history`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `flyway_schema_history` ( + `installed_rank` int(11) NOT NULL, + `version` varchar(50) DEFAULT NULL, + `description` varchar(200) NOT NULL, + `type` varchar(20) NOT NULL, + `script` varchar(1000) NOT NULL, + `checksum` int(11) DEFAULT NULL, + `installed_by` varchar(100) NOT NULL, + `installed_on` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `execution_time` int(11) NOT NULL, + `success` tinyint(1) NOT NULL, + PRIMARY KEY (`installed_rank`), + KEY `flyway_schema_history_s_idx` (`success`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_environment` +-- + +DROP TABLE IF EXISTS `heat_environment`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `heat_environment` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(100) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext NOT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_files` +-- + +DROP TABLE IF EXISTS `heat_files`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `heat_files` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext NOT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_nested_template` +-- + +DROP TABLE IF EXISTS `heat_nested_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `heat_nested_template` ( + `PARENT_HEAT_TEMPLATE_UUID` varchar(200) NOT NULL, + `CHILD_HEAT_TEMPLATE_UUID` varchar(200) NOT NULL, + `PROVIDER_RESOURCE_FILE` varchar(100) DEFAULT NULL, + PRIMARY KEY (`PARENT_HEAT_TEMPLATE_UUID`,`CHILD_HEAT_TEMPLATE_UUID`), + KEY `fk_heat_nested_template__heat_template2_idx` (`CHILD_HEAT_TEMPLATE_UUID`), + CONSTRAINT `fk_heat_nested_template__child_heat_temp_uuid__heat_template1` FOREIGN KEY (`CHILD_HEAT_TEMPLATE_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_heat_nested_template__parent_heat_temp_uuid__heat_template1` FOREIGN KEY (`PARENT_HEAT_TEMPLATE_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_template` +-- + +DROP TABLE IF EXISTS `heat_template`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `heat_template` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext NOT NULL, + `TIMEOUT_MINUTES` int(11) DEFAULT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `heat_template_params` +-- + +DROP TABLE IF EXISTS `heat_template_params`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `heat_template_params` ( + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NOT NULL, + `PARAM_NAME` varchar(100) NOT NULL, + `IS_REQUIRED` bit(1) NOT NULL, + `PARAM_TYPE` varchar(20) DEFAULT NULL, + `PARAM_ALIAS` varchar(45) DEFAULT NULL, + PRIMARY KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`,`PARAM_NAME`), + CONSTRAINT `fk_heat_template_params__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `identity_services` +-- -CREATE TABLE IF NOT EXISTS `cloud_sites` ( +DROP TABLE IF EXISTS `identity_services`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `identity_services` ( `ID` varchar(50) NOT NULL, - `REGION_ID` varchar(11) DEFAULT NULL, - `IDENTITY_SERVICE_ID` varchar(50) DEFAULT NULL, - `CLOUD_VERSION` varchar(20) DEFAULT NULL, - `CLLI` varchar(11) DEFAULT NULL, - `CLOUDIFY_ID` varchar(50) DEFAULT NULL, - `PLATFORM` varchar(50) DEFAULT NULL, - `ORCHESTRATOR` varchar(50) DEFAULT NULL, + `IDENTITY_URL` varchar(200) DEFAULT NULL, + `MSO_ID` varchar(255) DEFAULT NULL, + `MSO_PASS` varchar(255) DEFAULT NULL, + `ADMIN_TENANT` varchar(50) DEFAULT NULL, + `MEMBER_ROLE` varchar(50) DEFAULT NULL, + `TENANT_METADATA` tinyint(1) DEFAULT '0', + `IDENTITY_SERVER_TYPE` varchar(50) DEFAULT NULL, + `IDENTITY_AUTHENTICATION_TYPE` varchar(50) DEFAULT NULL, `LAST_UPDATED_BY` varchar(120) DEFAULT NULL, - `CREATION_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), - `UPDATE_TIMESTAMP` timestamp NULL DEFAULT current_timestamp(), + `CREATION_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `UPDATE_TIMESTAMP` timestamp NULL DEFAULT CURRENT_TIMESTAMP, + `PROJECT_DOMAIN_NAME` varchar(255) DEFAULT NULL, + `USER_DOMAIN_NAME` varchar(255) DEFAULT NULL, + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `instance_group` +-- + +DROP TABLE IF EXISTS `instance_group`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `instance_group` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `ROLE` varchar(200) NOT NULL, + `OBJECT_TYPE` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `CR_MODEL_UUID` varchar(200) DEFAULT NULL, + `INSTANCE_GROUP_TYPE` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_UUID`), + KEY `CR_MODEL_UUID` (`CR_MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `model` +-- + +DROP TABLE IF EXISTS `model`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `model` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_ID` varchar(40) DEFAULT NULL, + `MODEL_CUSTOMIZATION_NAME` varchar(40) DEFAULT NULL, + `MODEL_INVARIANT_ID` varchar(40) DEFAULT NULL, + `MODEL_NAME` varchar(40) DEFAULT NULL, + `MODEL_TYPE` varchar(20) DEFAULT NULL, + `MODEL_VERSION` varchar(20) DEFAULT NULL, + `MODEL_VERSION_ID` varchar(40) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `RECIPE` int(11) DEFAULT NULL, PRIMARY KEY (`ID`), - KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`), - CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`) -) ;
\ No newline at end of file + UNIQUE KEY `uk1_model` (`MODEL_TYPE`,`MODEL_VERSION_ID`), + KEY `RECIPE` (`RECIPE`), + CONSTRAINT `model_ibfk_1` FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `model_recipe` +-- + +DROP TABLE IF EXISTS `model_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `model_recipe` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_ID` int(11) DEFAULT NULL, + `ACTION` varchar(40) DEFAULT NULL, + `SCHEMA_VERSION` varchar(40) DEFAULT NULL, + `DESCRIPTION` varchar(40) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(20) DEFAULT NULL, + `MODEL_PARAM_XSD` varchar(20) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`), + UNIQUE KEY `uk1_model_recipe` (`MODEL_ID`,`ACTION`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_recipe` +-- + +DROP TABLE IF EXISTS `network_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `network_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `MODEL_NAME` varchar(20) NOT NULL, + `ACTION` varchar(50) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `NETWORK_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `SERVICE_TYPE` varchar(45) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VERSION_STR` varchar(20) NOT NULL, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_rl4f296i0p8lyokxveaiwkayi` (`MODEL_NAME`,`ACTION`,`VERSION_STR`) +) ENGINE=InnoDB AUTO_INCREMENT=181 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_resource` +-- + +DROP TABLE IF EXISTS `network_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `network_resource` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NULL, + `NEUTRON_NETWORK_TYPE` varchar(20) DEFAULT NULL, + `MODEL_VERSION` varchar(20) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `AIC_VERSION_MIN` varchar(20) NULL, + `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, + `ORCHESTRATION_MODE` varchar(20) DEFAULT 'HEAT', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`), + KEY `fk_network_resource__temp_network_heat_template_lookup1_idx` (`MODEL_NAME`), + KEY `fk_network_resource__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_network_resource__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE NO ACTION ON UPDATE CASCADE, + CONSTRAINT `fk_network_resource__temp_network_heat_template_lookup__mod_nm1` FOREIGN KEY (`MODEL_NAME`) REFERENCES `temp_network_heat_template_lookup` (`NETWORK_RESOURCE_MODEL_NAME`) ON DELETE NO ACTION ON UPDATE NO ACTION +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_resource_customization` +-- + +DROP TABLE IF EXISTS `network_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `network_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `NETWORK_TECHNOLOGY` varchar(45) DEFAULT NULL, + `NETWORK_TYPE` varchar(45) DEFAULT NULL, + `NETWORK_ROLE` varchar(200) DEFAULT NULL, + `NETWORK_SCOPE` varchar(45) DEFAULT NULL, + `RESOURCE_INPUT` varchar(20000) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `NETWORK_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_network_resource_customization__network_resource1_idx` (`NETWORK_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_network_resource_customization__network_resource1` FOREIGN KEY (`NETWORK_RESOURCE_MODEL_UUID`) REFERENCES `network_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `network_resource_customization_to_service` +-- + +DROP TABLE IF EXISTS `network_resource_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `network_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + KEY `RESOURCE_MODEL_CUSTOMIZATION_UUID` (`RESOURCE_MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `network_resource_customization_to_service_ibfk_1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE, + CONSTRAINT `network_resource_customization_to_service_ibfk_2` FOREIGN KEY (`RESOURCE_MODEL_CUSTOMIZATION_UUID`) REFERENCES `network_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `northbound_request_ref_lookup` +-- + +DROP TABLE IF EXISTS `northbound_request_ref_lookup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `northbound_request_ref_lookup` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `REQUEST_SCOPE` varchar(200) NOT NULL, + `MACRO_ACTION` varchar(200) NOT NULL, + `ACTION` varchar(200) NOT NULL, + `IS_ALACARTE` tinyint(1) NOT NULL DEFAULT '0', + `MIN_API_VERSION` double NOT NULL, + `MAX_API_VERSION` double DEFAULT NULL, + `IS_TOPLEVELFLOW` tinyint(1) DEFAULT NULL, + `CLOUD_OWNER` varchar(200) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_northbound_request_ref_lookup` (`MIN_API_VERSION`,`REQUEST_SCOPE`,`ACTION`,`IS_ALACARTE`,`MACRO_ACTION`,`CLOUD_OWNER`) +) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orchestration_flow_reference` +-- + +DROP TABLE IF EXISTS `orchestration_flow_reference`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orchestration_flow_reference` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `COMPOSITE_ACTION` varchar(200) NOT NULL, + `SEQ_NO` int(11) NOT NULL, + `FLOW_NAME` varchar(200) NOT NULL, + `FLOW_VERSION` double NOT NULL, + `NB_REQ_REF_LOOKUP_ID` int(11) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_orchestration_flow_reference` (`COMPOSITE_ACTION`,`FLOW_NAME`,`SEQ_NO`,`NB_REQ_REF_LOOKUP_ID`), + KEY `fk_orchestration_flow_reference__northbound_req_ref_look_idx` (`NB_REQ_REF_LOOKUP_ID`), + KEY `fk_orchestration_flow_reference__building_block_detail` (`FLOW_NAME`), + CONSTRAINT `fk_orchestration_flow_reference__northbound_request_ref_look1` FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=398 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `orchestration_status_state_transition_directive` +-- + +DROP TABLE IF EXISTS `orchestration_status_state_transition_directive`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `orchestration_status_state_transition_directive` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `RESOURCE_TYPE` varchar(25) NOT NULL, + `ORCHESTRATION_STATUS` varchar(25) NOT NULL, + `TARGET_ACTION` varchar(25) NOT NULL, + `FLOW_DIRECTIVE` varchar(25) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_orchestration_status_state_transition_directive` (`RESOURCE_TYPE`,`ORCHESTRATION_STATUS`,`TARGET_ACTION`) +) ENGINE=InnoDB AUTO_INCREMENT=686 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `rainy_day_handler_macro` +-- + +DROP TABLE IF EXISTS `rainy_day_handler_macro`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `rainy_day_handler_macro` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `FLOW_NAME` varchar(200) NOT NULL, + `SERVICE_TYPE` varchar(200) NOT NULL, + `VNF_TYPE` varchar(200) NOT NULL, + `ERROR_CODE` varchar(200) NOT NULL, + `WORK_STEP` varchar(200) NOT NULL, + `POLICY` varchar(200) NOT NULL, + `SECONDARY_POLICY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service` +-- + +DROP TABLE IF EXISTS `service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `service` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `TOSCA_CSAR_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `SERVICE_TYPE` varchar(200) DEFAULT NULL, + `SERVICE_ROLE` varchar(200) DEFAULT NULL, + `ENVIRONMENT_CONTEXT` varchar(200) DEFAULT NULL, + `WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL, + `SERVICE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_ORDER` varchar(200) default NULL, + PRIMARY KEY (`MODEL_UUID`), + KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`), + CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service_proxy_customization` +-- + +DROP TABLE IF EXISTS `service_proxy_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `service_proxy_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `TOSCA_NODE_TYPE` varchar(200) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `SOURCE_SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_service_proxy_customization__service1_idx` (`SOURCE_SERVICE_MODEL_UUID`), + CONSTRAINT `fk_service_proxy_resource_customization__service1` FOREIGN KEY (`SOURCE_SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service_proxy_customization_to_service` +-- + +DROP TABLE IF EXISTS `service_proxy_customization_to_service`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `service_proxy_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `service_recipe` +-- + +DROP TABLE IF EXISTS `service_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `service_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ACTION` varchar(50) NOT NULL, + `VERSION_STR` varchar(20) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `SERVICE_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `SERVICE_TIMEOUT_INTERIM` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_7fav5dkux2v8g9d2i5ymudlgc` (`SERVICE_MODEL_UUID`,`ACTION`), + KEY `fk_service_recipe__service1_idx` (`SERVICE_MODEL_UUID`), + CONSTRAINT `fk_service_recipe__service1` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=93 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `temp_network_heat_template_lookup` +-- + +DROP TABLE IF EXISTS `temp_network_heat_template_lookup`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `temp_network_heat_template_lookup` ( + `NETWORK_RESOURCE_MODEL_NAME` varchar(200) NOT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) NULL, + `AIC_VERSION_MIN` varchar(20) NULL, + `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, + PRIMARY KEY (`NETWORK_RESOURCE_MODEL_NAME`), + KEY `fk_temp_network_heat_template_lookup__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_temp_network_heat_template_lookup__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE NO ACTION ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `tosca_csar` +-- + +DROP TABLE IF EXISTS `tosca_csar`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `tosca_csar` ( + `ARTIFACT_UUID` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ARTIFACT_CHECKSUM` varchar(200) NOT NULL, + `URL` varchar(200) NOT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ARTIFACT_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vf_module` +-- + +DROP TABLE IF EXISTS `vf_module`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vf_module` ( + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `IS_BASE` tinyint(1) NOT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `VOL_HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`MODEL_UUID`,`VNF_RESOURCE_MODEL_UUID`), + KEY `fk_vf_module__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), + KEY `fk_vf_module__heat_template_art_uuid__heat_template1_idx` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + KEY `fk_vf_module__vol_heat_template_art_uuid__heat_template2_idx` (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_vf_module__heat_template_art_uuid__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module__vol_heat_template_art_uuid__heat_template2` FOREIGN KEY (`VOL_HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vf_module_customization` +-- + +DROP TABLE IF EXISTS `vf_module_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vf_module_customization` ( + `ID` int(13) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `LABEL` varchar(200) DEFAULT NULL, + `INITIAL_COUNT` int(11) DEFAULT '0', + `MIN_INSTANCES` int(11) DEFAULT '0', + `MAX_INSTANCES` int(11) DEFAULT NULL, + `AVAILABILITY_ZONE_COUNT` int(11) DEFAULT NULL, + `HEAT_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `VOL_ENVIRONMENT_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL, + `VNF_RESOURCE_CUSTOMIZATION_ID` int(13) DEFAULT NULL, + PRIMARY KEY (`ID`), + KEY `fk_vf_module_customization__vf_module1_idx` (`VF_MODULE_MODEL_UUID`), + KEY `fk_vf_module_customization__heat_env__heat_environment1_idx` (`HEAT_ENVIRONMENT_ARTIFACT_UUID`), + KEY `fk_vf_module_customization__vol_env__heat_environment2_idx` (`VOL_ENVIRONMENT_ARTIFACT_UUID`), + KEY `fk_vf_module_customization_to_vnf_resource_customization` (`VNF_RESOURCE_CUSTOMIZATION_ID`), + KEY `vf_module_customization_model_cust_uuid_idx` (`MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `fk_vf_module_customization__heat_env__heat_environment1` FOREIGN KEY (`HEAT_ENVIRONMENT_ARTIFACT_UUID`) REFERENCES `heat_environment` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module_customization__vf_module1` FOREIGN KEY (`VF_MODULE_MODEL_UUID`) REFERENCES `vf_module` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module_customization__vol_env__heat_environment2` FOREIGN KEY (`VOL_ENVIRONMENT_ARTIFACT_UUID`) REFERENCES `heat_environment` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module_customization_to_vnf_resource_customization` FOREIGN KEY (`VNF_RESOURCE_CUSTOMIZATION_ID`) REFERENCES `vnf_resource_customization` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vf_module_to_heat_files` +-- + +DROP TABLE IF EXISTS `vf_module_to_heat_files`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vf_module_to_heat_files` ( + `VF_MODULE_MODEL_UUID` varchar(200) NOT NULL, + `HEAT_FILES_ARTIFACT_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`VF_MODULE_MODEL_UUID`,`HEAT_FILES_ARTIFACT_UUID`), + KEY `fk_vf_module_to_heat_files__heat_files__artifact_uuid1_idx` (`HEAT_FILES_ARTIFACT_UUID`), + CONSTRAINT `fk_vf_module_to_heat_files__heat_files__artifact_uuid1` FOREIGN KEY (`HEAT_FILES_ARTIFACT_UUID`) REFERENCES `heat_files` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vf_module_to_heat_files__vf_module__model_uuid1` FOREIGN KEY (`VF_MODULE_MODEL_UUID`) REFERENCES `vf_module` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='il fait ce qu''il dit'; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_components` +-- + +DROP TABLE IF EXISTS `vnf_components`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnf_components` ( + `VNF_ID` int(11) NOT NULL, + `COMPONENT_TYPE` varchar(20) NOT NULL, + `HEAT_TEMPLATE_ID` int(11) DEFAULT NULL, + `HEAT_ENVIRONMENT_ID` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`VNF_ID`,`COMPONENT_TYPE`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_components_recipe` +-- + +DROP TABLE IF EXISTS `vnf_components_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnf_components_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `VNF_TYPE` varchar(200) DEFAULT NULL, + `VNF_COMPONENT_TYPE` varchar(45) NOT NULL, + `ACTION` varchar(50) NOT NULL, + `SERVICE_TYPE` varchar(45) DEFAULT NULL, + `VERSION` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `VNF_COMPONENT_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP, + `VF_MODULE_MODEL_UUID` varchar(200) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_4dpdwddaaclhc11wxsb7h59ma` (`VF_MODULE_MODEL_UUID`,`VNF_COMPONENT_TYPE`,`ACTION`,`VERSION`) +) ENGINE=InnoDB AUTO_INCREMENT=38 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_recipe` +-- + +DROP TABLE IF EXISTS `vnf_recipe`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnf_recipe` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `NF_ROLE` varchar(200) DEFAULT NULL, + `ACTION` varchar(50) NOT NULL, + `SERVICE_TYPE` varchar(45) DEFAULT NULL, + `VERSION_STR` varchar(20) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `ORCHESTRATION_URI` varchar(256) NOT NULL, + `VNF_PARAM_XSD` varchar(2048) DEFAULT NULL, + `RECIPE_TIMEOUT` int(11) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime DEFAULT CURRENT_TIMESTAMP, + `VF_MODULE_ID` varchar(100) DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `UK_f3tvqau498vrifq3cr8qnigkr` (`VF_MODULE_ID`,`ACTION`,`VERSION_STR`) +) ENGINE=InnoDB AUTO_INCREMENT=10015 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_resource` +-- + +DROP TABLE IF EXISTS `vnf_resource`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `MODEL_UUID` varchar(200) NOT NULL, + `AIC_VERSION_MIN` varchar(20) DEFAULT NULL, + `AIC_VERSION_MAX` varchar(20) DEFAULT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `HEAT_TEMPLATE_ARTIFACT_UUID` varchar(200) DEFAULT NULL, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`), + KEY `fk_vnf_resource__heat_template1` (`HEAT_TEMPLATE_ARTIFACT_UUID`), + CONSTRAINT `fk_vnf_resource__heat_template1` FOREIGN KEY (`HEAT_TEMPLATE_ARTIFACT_UUID`) REFERENCES `heat_template` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnf_resource_customization` +-- + +DROP TABLE IF EXISTS `vnf_resource_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnf_resource_customization` ( + `ID` int(13) NOT NULL AUTO_INCREMENT, + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `MIN_INSTANCES` int(11) DEFAULT NULL, + `MAX_INSTANCES` int(11) DEFAULT NULL, + `AVAILABILITY_ZONE_MAX_COUNT` int(11) DEFAULT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + `RESOURCE_INPUT` varchar(20000) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) default null, + `CDS_BLUEPRINT_VERSION` varchar(20) default null, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), + KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), + KEY `fk_vnf_resource_customization_to_service` (`SERVICE_MODEL_UUID`), + KEY `vnf_resource_customization_mod_cust_uuid_idx` (`MODEL_CUSTOMIZATION_UUID`), + CONSTRAINT `fk_vnf_resource_customization__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnf_resource_customization_to_service` FOREIGN KEY (`SERVICE_MODEL_UUID`) REFERENCES `service` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnfc_customization` +-- + +DROP TABLE IF EXISTS `vnfc_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnfc_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) NOT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) NOT NULL, + `TOSCA_NODE_TYPE` varchar(200) NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `vnfc_instance_group_customization` +-- + +DROP TABLE IF EXISTS `vnfc_instance_group_customization`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `vnfc_instance_group_customization` ( + `ID` int(13) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `VNF_RESOURCE_CUSTOMIZATION_ID` int(13) NOT NULL, + `INSTANCE_GROUP_MODEL_UUID` varchar(200) NOT NULL, + `FUNCTION` varchar(200) DEFAULT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + KEY `fk_vnfc_instance_group_customization__instance_group1_idx` (`INSTANCE_GROUP_MODEL_UUID`), + CONSTRAINT `fk_vnfc_instance_group_customization__instance_group1` FOREIGN KEY (`INSTANCE_GROUP_MODEL_UUID`) REFERENCES `instance_group` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnfc_instance_group_customization_vnf_customization` FOREIGN KEY (`VNF_RESOURCE_CUSTOMIZATION_ID`) REFERENCES `vnf_resource_customization` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +set foreign_key_checks=1; + +CREATE TABLE IF NOT EXISTS `pnf_resource` ( + `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT', + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `MODEL_UUID` varchar(200) NOT NULL, + `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL, + `MODEL_VERSION` varchar(20) NOT NULL, + `MODEL_NAME` varchar(200) DEFAULT NULL, + `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL, + `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL, + `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL, + PRIMARY KEY (`MODEL_UUID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization` ( + `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + `MODEL_INSTANCE_NAME` varchar(200) NOT NULL, + `NF_TYPE` varchar(200) DEFAULT NULL, + `NF_ROLE` varchar(200) DEFAULT NULL, + `NF_FUNCTION` varchar(200) DEFAULT NULL, + `NF_NAMING_CODE` varchar(200) DEFAULT NULL, + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL, + `RESOURCE_INPUT` varchar(2000) DEFAULT NULL, + `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL, + `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL, + `SKIP_POST_INSTANTIATION_CONFIGURATION` boolean default true, + PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`), + KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` ( + `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL, + PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`) +)ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `workflow` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `ARTIFACT_UUID` varchar(200) NOT NULL, + `ARTIFACT_NAME` varchar(200) NOT NULL, + `NAME` varchar(200) NOT NULL, + `OPERATION_NAME` varchar(200) DEFAULT NULL, + `VERSION` double NOT NULL, + `DESCRIPTION` varchar(1200) DEFAULT NULL, + `BODY` longtext DEFAULT NULL, + `RESOURCE_TARGET` varchar(200) NOT NULL, + `SOURCE` varchar(200) NOT NULL, + `TIMEOUT_MINUTES` int(11) DEFAULT NULL, + `ARTIFACT_CHECKSUM` varchar(200) DEFAULT 'MANUAL RECORD', + `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`ID`), + UNIQUE KEY `UK_workflow` (`ARTIFACT_UUID`,`NAME`,`VERSION`,`SOURCE`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +CREATE TABLE IF NOT EXISTS `vnf_resource_to_workflow` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, + `WORKFLOW_ID` int(11) NOT NULL, + PRIMARY KEY (`ID`), + UNIQUE KEY `UK_vnf_resource_to_workflow` (`VNF_RESOURCE_MODEL_UUID`,`WORKFLOW_ID`), + KEY `fk_vnf_resource_to_workflow__workflow1_idx` (`WORKFLOW_ID`), + KEY `fk_vnf_resource_to_workflow__vnf_res_mod_uuid_idx` (`VNF_RESOURCE_MODEL_UUID`), + CONSTRAINT `fk_vnf_resource_to_workflow__vnf_resource1` FOREIGN KEY (`VNF_RESOURCE_MODEL_UUID`) REFERENCES `vnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `fk_vnf_resource_to_workflow__workflow1` FOREIGN KEY (`WORKFLOW_ID`) REFERENCES `workflow` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + diff --git a/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json b/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json new file mode 100644 index 0000000000..6b63895a33 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/stack-resources.json @@ -0,0 +1,441 @@ +{ + "resources": [ + { + "resource_name": "ge_000", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d/resources/ge_000", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-ge_000-t66dxpwq6nb5/deee54a3-08ac-477b-9c09-c798edb40be1", + "rel": "nested" + } + ], + "logical_resource_id": "ge_000", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:52Z", + "required_by": [ + "vfw_instance" + ], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "deee54a3-08ac-477b-9c09-c798edb40be1", + "resource_type": "port.yaml" + }, + { + "resource_name": "vfw_instance", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d/resources/vfw_instance", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule/d1431cdc-9b29-44fc-98d0-9b3dc1ac246d", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "nested" + } + ], + "logical_resource_id": "vfw_instance", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:52Z", + "required_by": [], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "resource_type": "vfw.yaml" + }, + { + "resource_name": "port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-ge_000-t66dxpwq6nb5/deee54a3-08ac-477b-9c09-c798edb40be1/resources/port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-ge_000-t66dxpwq6nb5/deee54a3-08ac-477b-9c09-c798edb40be1", + "rel": "stack" + } + ], + "logical_resource_id": "port", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:52Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "212a203a-9764-4f42-84ea-731536a8f13a", + "resource_type": "OS::Neutron::Port" + }, + { + "resource_name": "pfe0", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/pfe0", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-pfe0-kvqmgn7jmiti/1325e04b-e836-4a13-bb2e-f34923d97ad7", + "rel": "nested" + } + ], + "logical_resource_id": "pfe0", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [ + "re0" + ], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "1325e04b-e836-4a13-bb2e-f34923d97ad7", + "resource_type": "fpc.yaml" + }, + { + "resource_name": "fpc_internal_port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/fpc_internal_port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_internal_port-gbnyc4w7mb5b/4e920f39-9784-417e-9331-d75e2e37cc51", + "rel": "nested" + } + ], + "logical_resource_id": "fpc_internal_port", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [ + "pfe0" + ], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "4e920f39-9784-417e-9331-d75e2e37cc51", + "resource_type": "re_pfe_port.yaml" + }, + { + "resource_name": "re-fpc-affinity-grp", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re-fpc-affinity-grp", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + } + ], + "logical_resource_id": "re-fpc-affinity-grp", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [ + "pfe0", + "re0" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "3aa37238-f8ff-4c96-b56a-8903bae28a60", + "resource_type": "OS::Nova::ServerGroup" + }, + { + "resource_name": "re0", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re0", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re0-73oifso3xntc/0915e27e-428d-4d2c-a67b-abbce18081b2", + "rel": "nested" + } + ], + "logical_resource_id": "re0", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "0915e27e-428d-4d2c-a67b-abbce18081b2", + "resource_type": "re.yaml" + }, + { + "resource_name": "re_external_port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re_external_port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_external_port-3okiee3zocr7/f58c65e3-a72e-4b2d-a295-cb40324d6b4c", + "rel": "nested" + } + ], + "logical_resource_id": "re_external_port", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [ + "re0" + ], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "f58c65e3-a72e-4b2d-a295-cb40324d6b4c", + "resource_type": "port.yaml" + }, + { + "resource_name": "fpc_external_port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/fpc_external_port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_external_port-5vumcqp7hkbn/979e47c9-c15a-428e-ad73-af922029ee37", + "rel": "nested" + } + ], + "logical_resource_id": "fpc_external_port", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [ + "pfe0", + "re0" + ], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "979e47c9-c15a-428e-ad73-af922029ee37", + "resource_type": "port.yaml" + }, + { + "resource_name": "re_internal_port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re_internal_port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_internal_port-u4txbvemndci/0aebfd9d-ad97-43b1-a67b-b2b5340738d2", + "rel": "nested" + } + ], + "logical_resource_id": "re_internal_port", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [ + "re0" + ], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "0aebfd9d-ad97-43b1-a67b-b2b5340738d2", + "resource_type": "re_pfe_port.yaml" + }, + { + "resource_name": "re_pfe_network", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b/resources/re_pfe_network", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam/54f93b9e-5138-4f3f-bfe0-ee06e1f0877b", + "rel": "stack" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29", + "rel": "nested" + } + ], + "logical_resource_id": "re_pfe_network", + "resource_status_reason": "state changed", + "updated_time": "2018-04-09T21:09:54Z", + "required_by": [ + "fpc_internal_port", + "re_internal_port" + ], + "resource_status": "CREATE_COMPLETE", + "physical_resource_id": "290fc2fd-cd1d-47d0-90eb-2ece7c009b29", + "resource_type": "bridge_int.yaml" + }, + { + "resource_name": "fpc", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-pfe0-kvqmgn7jmiti/1325e04b-e836-4a13-bb2e-f34923d97ad7/resources/fpc", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-pfe0-kvqmgn7jmiti/1325e04b-e836-4a13-bb2e-f34923d97ad7", + "rel": "stack" + } + ], + "logical_resource_id": "fpc", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:58Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "43c2159b-2c04-46ac-bda5-594110cae2d3", + "resource_type": "OS::Nova::Server" + }, + { + "resource_name": "port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_internal_port-gbnyc4w7mb5b/4e920f39-9784-417e-9331-d75e2e37cc51/resources/port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_internal_port-gbnyc4w7mb5b/4e920f39-9784-417e-9331-d75e2e37cc51", + "rel": "stack" + } + ], + "logical_resource_id": "port", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:56Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "387e3904-8948-43d1-8635-b6c2042b54da", + "resource_type": "OS::Neutron::Port" + }, + { + "resource_name": "re", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re0-73oifso3xntc/0915e27e-428d-4d2c-a67b-abbce18081b2/resources/re", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re0-73oifso3xntc/0915e27e-428d-4d2c-a67b-abbce18081b2", + "rel": "stack" + } + ], + "logical_resource_id": "re", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:10:36Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "7cff109a-b2b7-4933-97b4-ec44a8365568", + "resource_type": "OS::Nova::Server" + }, + { + "resource_name": "port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_external_port-3okiee3zocr7/f58c65e3-a72e-4b2d-a295-cb40324d6b4c/resources/port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_external_port-3okiee3zocr7/f58c65e3-a72e-4b2d-a295-cb40324d6b4c", + "rel": "stack" + } + ], + "logical_resource_id": "port", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:55Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "70a09dfd-f1c5-4bc8-bd8f-dc539b8d662a", + "resource_type": "OS::Neutron::Port" + }, + { + "resource_name": "port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_external_port-5vumcqp7hkbn/979e47c9-c15a-428e-ad73-af922029ee37/resources/port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-fpc_external_port-5vumcqp7hkbn/979e47c9-c15a-428e-ad73-af922029ee37", + "rel": "stack" + } + ], + "logical_resource_id": "port", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:55Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "12f88b4d-c8a4-4fbd-bcb4-7e36af02430b", + "resource_type": "OS::Neutron::Port" + }, + { + "resource_name": "port", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_internal_port-u4txbvemndci/0aebfd9d-ad97-43b1-a67b-b2b5340738d2/resources/port", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_internal_port-u4txbvemndci/0aebfd9d-ad97-43b1-a67b-b2b5340738d2", + "rel": "stack" + } + ], + "logical_resource_id": "port", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:56Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "c54b9f45-b413-4937-bbe4-3c8a5689cfc9", + "resource_type": "OS::Neutron::Port" + }, + { + "resource_name": "bridge_network_subnet", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29/resources/bridge_network_subnet", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29", + "rel": "stack" + } + ], + "logical_resource_id": "bridge_network_subnet", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:55Z", + "required_by": [], + "resource_status_reason": "state changed", + "physical_resource_id": "5ffd8c02-6913-4b67-adba-74e78c2bbe40", + "resource_type": "OS::Neutron::Subnet" + }, + { + "resource_name": "bridge_network", + "links": [ + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29/resources/bridge_network", + "rel": "self" + }, + { + "href": "http://10.10.10.10:8004/v1/7320ec4a5b9d4589ba7c4412ccfd290f/stacks/ClosedLoop_vFW_VfModule-vfw_instance-tw3i5ile2nam-re_pfe_network-2wmjvgzrhtvs/290fc2fd-cd1d-47d0-90eb-2ece7c009b29", + "rel": "stack" + } + ], + "logical_resource_id": "bridge_network", + "resource_status": "CREATE_COMPLETE", + "updated_time": "2018-04-09T21:09:55Z", + "required_by": [ + "bridge_network_subnet" + ], + "resource_status_reason": "state changed", + "physical_resource_id": "5ad95036-8daf-4379-a59c-865f35976cd4", + "resource_type": "OS::Neutron::Net" + } + ] +} |