aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-openstack-adapters/src/test')
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java150
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java332
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java239
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImplTest.java25
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java29
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/CreateNetwork4.json46
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/GetResources.json228
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json79
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json72
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1.json43
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json72
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json72
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json31
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface0.json41
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json70
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse4.json25
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/logback-test.xml6
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/schema.sql11
21 files changed, 1643 insertions, 14 deletions
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..52b67b8eb9
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
@@ -0,0 +1,150 @@
+/*-
+ * ============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 AuditStackServiceDataTest extends AuditStackServiceData {
+
+ @InjectMocks
+ AuditStackServiceData auditStackService = new AuditStackServiceData();
+
+ @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).auditHeatStack("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).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(false).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(false).when(heatStackAuditMock).auditHeatStack("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/AuditVServerTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
new file mode 100644
index 0000000000..02557d8c20
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
@@ -0,0 +1,332 @@
+/*-
+ * ============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 static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.io.File;
+import java.io.IOException;
+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;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+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.client.aai.AAIObjectPlurals;
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.aai.entities.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;
+import com.woorea.openstack.heat.model.Resource;
+import com.woorea.openstack.heat.model.Resources;
+
+@RunWith(MockitoJUnitRunner.Silent.class)
+public class AuditVServerTest extends AuditVServer {
+
+ 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(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.auditVservers(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);
+ assertEquals(false, exists);
+ }
+
+ @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.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ assertEquals(true, exists);
+ }
+
+ @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.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ assertEquals(false, exists);
+ }
+
+ @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.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ assertEquals(false, exists);
+ }
+
+ @Test
+ public void audit_Vserver_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
+ doReturn(false).when(aaiResourcesMock).exists(vserverURI);
+ doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
+ boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ assertEquals(false, exists);
+ }
+
+ @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.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ assertEquals(false, exists);
+ }
+
+ @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.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+ assertEquals(false, exists);
+ }
+
+}
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
new file mode 100644
index 0000000000..c5b93a7cb9
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
@@ -0,0 +1,239 @@
+/*-
+ * ============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 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.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;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+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.skyscreamer.jsonassert.JSONAssert;
+
+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;
+
+
+@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/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
+ assertEquals("/ea2d13cc98b44d60a6f94bdcb2738f9e/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/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/test_stack/f711be16-2654-4a09-b89d-0511fda20e81");
+ assertEquals("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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("/ea2d13cc98b44d60a6f94bdcb2738f9e/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 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));
+ }
+
+
+}
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 094d308221..f8dcddde04 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
@@ -25,10 +25,12 @@ 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;
@@ -184,8 +186,11 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
" </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<>(), "messageId",
+ "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<Subnet>(), networkParams, "messageId",
new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
}
@@ -199,14 +204,17 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
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<>(), "messageId",
+ "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<>(), "messageId",
+ "dvspg-VCE_VPE-mtjnj40avbc", "physicalNetworkName", new ArrayList<>(), new ArrayList<>(), new HashMap<String,String>(), "messageId",
new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
}
@@ -237,8 +245,10 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
.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<>(), "messageId",
+ "physicalNetworkName", new ArrayList<>(), false, false, new ArrayList<>(), networkParams, "messageId",
new MsoRequest(), "http://localhost:"+wireMockPort+"/notificationUrl");
}
@@ -251,15 +261,18 @@ public class MsoNetworkAdapterAsyncImplTest extends BaseRestTestUtils {
.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<>(), "messageId",
+ "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<>(), "messageId",
+ "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 6123415b41..3910d9ec44 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
@@ -88,7 +88,7 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
request.setSkipAAI(true);
request.setFailIfExists(false);
MsoRequest msoReq = new MsoRequest();
- NetworkTechnology networkTechnology = NetworkTechnology.CONTRAIL;
+ String networkTechnology = "CONTRAIL";
msoReq.setRequestId(MSO_REQUEST_ID);
msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
@@ -296,6 +296,33 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
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)));
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 f958a5b140..1fd3ffc90a 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
@@ -67,8 +67,8 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
public void createVfModule() throws Exception {
//expectedException.expect(VnfException.class);
Map<String, String> stackInputs = new HashMap<>();
- stackInputs.put("oof_directives", "{oofDIRECTIVES}");
- stackInputs.put("sdnc_directives", "{sdncDIRECTIVES}");
+ stackInputs.put("oof_directives", "{}");
+ stackInputs.put("sdnc_directives", "{}");
stackInputs.put("generic_vnf_id", "genVNFID");
stackInputs.put("vf_module_id", "vfMODULEID");
diff --git a/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork4.json b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork4.json
new file mode 100644
index 0000000000..3a116a6fc1
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/CreateNetwork4.json
@@ -0,0 +1,46 @@
+{
+ "createNetworkRequest": {
+ "skipAAI": true,
+ "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709",
+ "synchronous": true,
+ "cloudSiteId": "mtn13",
+ "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f",
+ "networkId": "da886914-efb2-4917-b335-c8381528d90b",
+ "networkName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3",
+ "networkType": "CONTRAIL30_BASIC",
+ "modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844",
+ "networkTechnology": "NEUTRON",
+ "subnets": [{
+ "subnetName": "APP-C-24595-T-IST-04AShared_untrusted_vDBE_net_3_subnet_1",
+ "subnetId": "da60501d-9aa8-48d2-99b7-26644fa01093",
+ "cidr": "20",
+ "gatewayIp": "",
+ "ipVersion": "4",
+ "enableDHCP": false,
+ "addrFromStart": true,
+ "hostRoutes": []
+ }],
+ "providerVlanNetwork": {
+ "physicalNetworkName": "FALSE",
+ "vlans": []
+ },
+ "contrailNetwork": {
+ "shared": "false",
+ "external": "false",
+ "routeTargets": [],
+ "policyFqdns": [],
+ "routeTableFqdns": []
+ },
+ "failIfExists": true,
+ "backout": false,
+ "networkParams": {
+ "shared": "true",
+ "external": "false"
+ },
+ "msoRequest": {
+ "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7",
+ "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6"
+ },
+ "contrailRequest": false
+ }
+} \ 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
new file mode 100644
index 0000000000..22e66d41bb
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json
@@ -0,0 +1,228 @@
+{
+ "resources": [
+ {
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732/resources/vlbagent_eph_aff_id",
+ "rel": "self"
+ },
+ {
+ "href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "vlbagent_eph_aff_id",
+ "physical_resource_id": "zdyh3brlba05_addon-vlbagent_eph_aff_id-euhxoicxsgso",
+ "required_by": [
+ "ssc_server_1"
+ ],
+ "resource_name": "vlbagent_eph_aff_id",
+ "resource_status": "CREATE_COMPLETE",
+ "resource_status_reason": "state changed",
+ "resource_type": "OS::Heat::RandomString",
+ "updated_time": "2019-02-07T22:56:12Z"
+ },
+ {
+ "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"
+ }
+ ]
+}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json b/adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json
new file mode 100644
index 0000000000..e2e701233f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1ResourceGroupResponse.json
@@ -0,0 +1,79 @@
+{
+ "resources": [
+ {
+ "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_name": "1",
+ "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",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "resource_type": "vlan_subinterface_ssc_service1.yaml"
+ },
+ {
+ "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_name": "0",
+ "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",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "resource_type": "vlan_subinterface_ssc_service1.yaml"
+ },
+ {
+ "parent_resource": "ssc_1_subint_service1_port_0_subinterfaces",
+ "resource_name": "2",
+ "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",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "bd0fc728-cbde-4301-a581-db56f494675c",
+ "resource_type": "vlan_subinterface_ssc_service1.yaml"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0.json
new file mode 100644
index 0000000000..20121e6ff9
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0.json
@@ -0,0 +1,41 @@
+{
+ "stack": {
+ "parent": "31d0647a-6043-49a4-81b6-ccab29380672",
+ "disable_rollback": true,
+ "description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
+ "links": [
+ {
+ "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": "self"
+ }
+ ],
+ "stack_status_reason": "Stack CREATE completed successfully",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
+ "stack_owner": "m08699",
+ "creation_time": "2019-01-23T19:34:57Z",
+ "capabilities": [],
+ "notification_topics": [],
+ "updated_time": null,
+ "timeout_mins": 120,
+ "stack_status": "CREATE_COMPLETE",
+ "parameters": {
+ "OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
+ "port_interface": "27391d94-33af-474a-927d-d409249e8fd3",
+ "OS::stack_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "vip_v6_address": "2001:1890:e005:1403::",
+ "network_id": "1bc1c5fe-896f-4629-b499-a5a36ece4253,c2f4ad4a-0089-41fa-aba7-a80963def29b,70bc637c-ea0f-4452-8aca-01e90c842ff1",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1",
+ "counter": "0",
+ "mac_address": "02:27:39:1d:94:33",
+ "vip_address": "12.251.1.8",
+ "vlan_tag": "101,102,103",
+ "ip_address": "12.251.1.5",
+ "ip_v6_address": "2001:1890:e005:1402:8000::"
+ },
+ "id": "0d9cd813-2ae1-46c0-9ebb-48081f6cffbb",
+ "outputs": [],
+ "template_description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json
new file mode 100644
index 0000000000..0f3f35418e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface0Resources.json
@@ -0,0 +1,72 @@
+
+
+{
+ "resources": [
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_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"
+ ],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "d54dfd09-75c6-4e04-b204-909455b8f933",
+ "resource_type": "OS::ContrailV2::VirtualMachineInterface"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1.json
new file mode 100644
index 0000000000..788757b24e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1.json
@@ -0,0 +1,43 @@
+
+
+{
+ "stack": {
+ "parent": "31d0647a-6043-49a4-81b6-ccab29380672",
+ "disable_rollback": true,
+ "description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
+ "links": [
+ {
+ "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": "self"
+ }
+ ],
+ "stack_status_reason": "Stack CREATE completed successfully",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
+ "stack_owner": "m08699",
+ "creation_time": "2019-01-23T19:34:57Z",
+ "capabilities": [],
+ "notification_topics": [],
+ "updated_time": null,
+ "timeout_mins": 120,
+ "stack_status": "CREATE_COMPLETE",
+ "parameters": {
+ "OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
+ "port_interface": "27391d94-33af-474a-927d-d409249e8fd3",
+ "OS::stack_id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-0-yghihziaf36m",
+ "vip_v6_address": "2001:1890:e005:1403::",
+ "network_id": "1bc1c5fe-896f-4629-b499-a5a36ece4253,c2f4ad4a-0089-41fa-aba7-a80963def29b,70bc637c-ea0f-4452-8aca-01e90c842ff1",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1",
+ "counter": "0",
+ "mac_address": "02:27:39:1d:94:33",
+ "vip_address": "12.251.1.8",
+ "vlan_tag": "101,102,103",
+ "ip_address": "12.251.1.5",
+ "ip_v6_address": "2001:1890:e005:1402:8000::"
+ },
+ "id": "b7019dd0-2ee9-4447-bdef-ac25676b205a",
+ "outputs": [],
+ "template_description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json
new file mode 100644
index 0000000000..cfc4d7fed6
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface1Resources.json
@@ -0,0 +1,72 @@
+
+
+{
+ "resources": [
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_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"
+ ],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "f7a998c0-8939-4b07-bf4a-0862e9c325e1",
+ "resource_type": "OS::ContrailV2::VirtualMachineInterface"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2.json
new file mode 100644
index 0000000000..c8fab2ae80
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2.json
@@ -0,0 +1,41 @@
+{
+ "stack": {
+ "parent": "31d0647a-6043-49a4-81b6-ccab29380672",
+ "disable_rollback": true,
+ "description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
+ "links": [
+ {
+ "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbtsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675cc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c",
+ "rel": "self"
+ }
+ ],
+ "stack_status_reason": "Stack CREATE completed successfully",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv",
+ "stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
+ "stack_owner": "m08699",
+ "creation_time": "2019-01-23T19:34:57Z",
+ "capabilities": [],
+ "notification_topics": [],
+ "updated_time": null,
+ "timeout_mins": 120,
+ "stack_status": "CREATE_COMPLETE",
+ "parameters": {
+ "OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
+ "port_interface": "27391d94-33af-474a-927d-d409249e8fd3",
+ "OS::stack_id": "bd0fc728-cbde-4301-a581-db56f494675c",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv",
+ "vip_v6_address": "2001:1890:e005:1403::",
+ "network_id": "1bc1c5fe-896f-4629-b499-a5a36ece4253,c2f4ad4a-0089-41fa-aba7-a80963def29b,70bc637c-ea0f-4452-8aca-01e90c842ff1",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1",
+ "counter": "2",
+ "mac_address": "02:27:39:1d:94:33",
+ "vip_address": "12.251.1.8",
+ "vlan_tag": "101,102,103",
+ "ip_address": "12.251.1.5",
+ "ip_v6_address": "2001:1890:e005:1402:8000::"
+ },
+ "id": "bd0fc728-cbde-4301-a581-db56f494675c",
+ "outputs": [],
+ "template_description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json
new file mode 100644
index 0000000000..e8aa80eb6f
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service1SubInterface2Resources.json
@@ -0,0 +1,72 @@
+
+
+{
+ "resources": [
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_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"
+ ],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "621c1fea-60b8-44ee-aede-c01b8b1aaa70",
+ "resource_type": "OS::ContrailV2::VirtualMachineInterface"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_vmi_0_v6_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_mis_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",
+ "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",
+ "rel": "stack"
+ }
+ ],
+ "logical_resource_id": "ssc_subint_mis_vmi_0_ip_0",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json b/adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json
new file mode 100644
index 0000000000..59f315a726
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service2ResourceGroupResponse.json
@@ -0,0 +1,31 @@
+
+
+{
+ "resources": [
+ {
+ "parent_resource": "ssc_1_subint_service2_port_0_subinterfaces",
+ "resource_name": "0",
+ "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",
+ "resource_status_reason": "state changed",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status": "CREATE_COMPLETE",
+ "physical_resource_id": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "resource_type": "vlan_subinterface_ssc_service2.yaml"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface0.json b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface0.json
new file mode 100644
index 0000000000..d10332b76e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface0.json
@@ -0,0 +1,41 @@
+{
+ "stack": {
+ "parent": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c",
+ "disable_rollback": true,
+ "description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n",
+ "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",
+ "rel": "self"
+ }
+ ],
+ "stack_status_reason": "Stack CREATE completed successfully",
+ "stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y",
+ "stack_user_project_id": "dfffe8b2401b45368ca6e21f19796ce1",
+ "stack_owner": "m08699",
+ "creation_time": "2019-01-23T19:34:56Z",
+ "capabilities": [],
+ "notification_topics": [],
+ "updated_time": null,
+ "timeout_mins": 120,
+ "stack_status": "CREATE_COMPLETE",
+ "parameters": {
+ "OS::project_id": "ea2d13cc98b44d60a6f94bdcb2738f9e",
+ "port_interface": "0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "OS::stack_id": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "OS::stack_name": "tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst-0-upfi5nhurk7y",
+ "vip_v6_address": "2001:1890:1001:4a32::3",
+ "network_id": "8be20e92-68d6-4aec-ae66-0fc0fc933546",
+ "subinterface_name_prefix": "tsbc0005v_tsbc0005vm002_subint_untrusted_service2",
+ "counter": "0",
+ "mac_address": "02:05:94:a2:f2:7e",
+ "vip_address": "32.68.12.91",
+ "vlan_tag": "81",
+ "ip_address": "32.68.12.92",
+ "ip_v6_address": "2001:1890:1001:4a32::4"
+ },
+ "id": "f711be16-2654-4a09-b89d-0511fda20e81",
+ "outputs": [],
+ "template_description": "HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs\n"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json
new file mode 100644
index 0000000000..84ae20f43e
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/Service2SubInterface1Resources.json
@@ -0,0 +1,70 @@
+{
+ "resources": [
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_service2_vmi_0",
+ "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",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [
+ "ssc_subint_service2_vmi_0_v6_ip_0",
+ "ssc_subint_service2_vmi_0_ip_0"
+ ],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
+ "resource_type": "OS::ContrailV2::VirtualMachineInterface"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_service2_vmi_0_v6_ip_0",
+ "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",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "e7f25707-12fd-454f-95ac-6a05cd70806f",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ },
+ {
+ "parent_resource": "0",
+ "resource_name": "ssc_subint_service2_vmi_0_ip_0",
+ "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",
+ "resource_status": "CREATE_COMPLETE",
+ "updated_time": "2019-01-23T19:34:56Z",
+ "required_by": [],
+ "resource_status_reason": "state changed",
+ "physical_resource_id": "6d23f4d3-8f7b-42c5-bb9e-4aee5797d506",
+ "resource_type": "OS::ContrailV2::InstanceIp"
+ }
+ ]
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse4.json b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse4.json
new file mode 100644
index 0000000000..2e5517cebb
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/test/resources/__files/CreateNetworkResponse4.json
@@ -0,0 +1,25 @@
+{
+ "createNetworkResponse": {
+ "networkId": "da886914-efb2-4917-b335-c8381528d90b",
+ "neutronNetworkId": null,
+ "networkStackId": "stackname/stackId",
+ "networkFqdn": null,
+ "networkCreated": true,
+ "subnetMap": {
+
+ },
+ "rollback": {
+ "networkStackId": "stackname/stackId",
+ "tenantId": "ba38bc24a2ef4fb2ad2810c894f1938f",
+ "cloudId": "mtn13",
+ "networkType": "CONTRAIL30_BASIC",
+ "modelCustomizationUuid": "3bdbb104-ffff-483e-9f8b-c095b3d30844",
+ "networkCreated": true,
+ "msoRequest": {
+ "requestId": "5349f419-b3e9-4546-b3a1-094bd568d6b7",
+ "serviceInstanceId": "cf965caf-a003-4189-abf9-e0ed77056dd6"
+ }
+ },
+ "messageId": "c4c44af4-4310-4d8b-a1eb-656fc99fe709"
+ }
+} \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
index 0611e62f3d..5d6eee746f 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
+++ b/adapters/mso-openstack-adapters/src/test/resources/logback-test.xml
@@ -41,7 +41,11 @@
<appender-ref ref="STDOUT" />
</logger>
- <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
+ <appender-ref ref="STDOUT" />
+ </logger>
+
+ <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
diff --git a/adapters/mso-openstack-adapters/src/test/resources/schema.sql b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
index 72810d6f3c..e9f2a09860 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/schema.sql
+++ b/adapters/mso-openstack-adapters/src/test/resources/schema.sql
@@ -28,6 +28,7 @@ create table `allotted_resource_customization` (
`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`),
@@ -138,11 +139,11 @@ create table `network_resource` (
`model_name` varchar(200) not null,
`model_invariant_uuid` varchar(200) default null,
`description` varchar(1200) default null,
- `heat_template_artifact_uuid` varchar(200) not 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) not 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,
@@ -151,8 +152,7 @@ create table `network_resource` (
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
+ 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;
@@ -168,6 +168,7 @@ create table `network_resource_customization` (
`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
@@ -203,6 +204,7 @@ create table `service` (
`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
@@ -381,6 +383,7 @@ create table `vnf_resource_customization` (
`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,
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