From 13f102e42fc4f7d874ccd7af5400a7b1e240e4c8 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 20 Mar 2019 14:28:22 -0400 Subject: Adjust audit to use device_id to find nova server Adjust audit to use device_id to find nova server Change-Id: If060b68ba480b0750e66a7fe26a6fa72382dcdd5 Issue-ID: SO-1677 Signed-off-by: Benjamin, Max (mb388a) --- .../org/onap/so/adapters/audit/HeatStackAudit.java | 44 ++- .../onap/so/adapters/audit/HeatStackAuditTest.java | 40 +- .../src/test/resources/GetResources.json | 407 +++++++++++---------- .../src/test/resources/NeutronPort1.json | 41 +++ .../src/test/resources/NeutronPort2.json | 41 +++ .../src/test/resources/NeutronPort3.json | 41 +++ .../src/test/resources/NeutronPort4.json | 41 +++ .../src/test/resources/NeutronPort5.json | 41 +++ .../src/test/resources/NeutronPort6.json | 41 +++ 9 files changed, 521 insertions(+), 216 deletions(-) create mode 100644 adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json create mode 100644 adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json (limited to 'adapters/mso-openstack-adapters/src') diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java index 19e3ab71f5..72dee07379 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java @@ -34,6 +34,7 @@ import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.Vserver; import org.onap.so.openstack.utils.MsoHeatUtils; +import org.onap.so.openstack.utils.MsoNeutronUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -43,6 +44,7 @@ import com.woorea.openstack.heat.model.Link; import com.woorea.openstack.heat.model.Resource; import com.woorea.openstack.heat.model.Resources; import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.quantum.model.Port; @Component public class HeatStackAudit { @@ -54,6 +56,9 @@ public class HeatStackAudit { @Autowired protected MsoHeatUtils heat; + @Autowired + protected MsoNeutronUtils neutron; + @Autowired protected AuditVServer auditVservers; @@ -82,8 +87,9 @@ public class HeatStackAudit { if(novaResources.isEmpty()) return true; else{ + List> neutronPortDetails = retrieveNeutronPortDetails(resources,cloudRegion,tenantId); List resourceGroups = extractResourceGroups(resources); - Set vserversToAudit = createVserverSet(resources, novaResources); + Set vserversToAudit = createVserverSet(resources, novaResources,neutronPortDetails); Set vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups, vserversToAudit); if(isCreateAudit){ @@ -186,18 +192,16 @@ public class HeatStackAudit { lInterface.getInterfaceId(),subinterfaceStack.getId()); } - protected Set createVserverSet(Resources resources, List novaResources) { + protected Set createVserverSet(Resources resources, List novaResources, List> neutronPortDetails) { Set vserversToAudit = new HashSet<>(); for (Resource novaResource : novaResources) { Vserver auditVserver = new Vserver(); auditVserver.setLInterfaces(new LInterfaces()); auditVserver.setVserverId(novaResource.getPhysicalResourceId()); - Stream filteredNeutronNetworks = resources.getList().stream() - .filter(resource -> resource.getRequiredBy().contains(novaResource.getLogicalResourceId())) - .filter(resource -> "OS::Neutron::Port".equals(resource.getType())); - filteredNeutronNetworks.forEach(network -> { + Stream filteredNeutronPorts = filterNeutronPorts(novaResource, neutronPortDetails); + filteredNeutronPorts.forEach(port -> { LInterface lInterface = new LInterface(); - lInterface.setInterfaceId(network.getPhysicalResourceId()); + lInterface.setInterfaceId(port.getId()); auditVserver.getLInterfaces().getLInterface().add(lInterface); }); vserversToAudit.add(auditVserver); @@ -205,6 +209,31 @@ public class HeatStackAudit { return vserversToAudit; } + /** + * @param novaResource Single openstack resource that is of type Nova + * @param neutronPorts List of Neutron ports created within the stack + * @return Filtered list of neutron ports taht relate to the nova server in openstack + */ + protected Stream filterNeutronPorts(Resource novaResource, List> neutronPorts) { + List filteredNeutronPorts = neutronPorts.stream().filter(Optional::isPresent).map(Optional::get) + .collect(Collectors.toList()); + return filteredNeutronPorts.stream() + .filter(port -> port.getDeviceId().equalsIgnoreCase(novaResource.getPhysicalResourceId())); + } + + /** + * @param resources Resource stream created by the stack in openstack + * @param cloudSiteId Unique site id to identify which openstack we talk to + * @param tenantId The tenant within the cloud we are talking to where resouces exist + * @return List of optional neutron ports found within the cloud site and tenant + */ + protected List> retrieveNeutronPortDetails(Resources resources,String cloudSiteId,String tenantId){ + return resources.getList().stream() + .filter(resource -> "OS::Neutron::Port".equals(resource.getType())) + .map(resource -> neutron.getNeutronPort(resource.getPhysicalResourceId(),cloudSiteId,tenantId)).collect(Collectors.toList()); + + } + protected Optional extractResourcePathFromHref(String href) { try { Optional stackPath = extractStackPathFromHref(href); @@ -234,3 +263,4 @@ public class HeatStackAudit { } } + diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java index 5eea46d09f..987e4cf76d 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java @@ -26,6 +26,7 @@ import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.doReturn; import java.io.File; +import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Optional; @@ -42,6 +43,7 @@ import org.onap.aai.domain.yang.LInterface; import org.onap.aai.domain.yang.LInterfaces; import org.onap.aai.domain.yang.Vserver; import org.onap.so.openstack.utils.MsoHeatUtils; +import org.onap.so.openstack.utils.MsoNeutronUtils; import org.skyscreamer.jsonassert.JSONAssert; import com.fasterxml.jackson.databind.DeserializationFeature; @@ -49,6 +51,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.woorea.openstack.heat.model.Resource; import com.woorea.openstack.heat.model.Resources; import com.woorea.openstack.heat.model.Stack; +import com.woorea.openstack.quantum.model.Port; @RunWith(MockitoJUnitRunner.Silent.class) @@ -60,6 +63,9 @@ public class HeatStackAuditTest extends HeatStackAudit { @Mock private MsoHeatUtils msoHeatUtilsMock; + @Mock + private MsoNeutronUtils neutronUtilsMock; + @Mock private AuditVServer auditVserver; @@ -72,10 +78,32 @@ public class HeatStackAuditTest extends HeatStackAudit { private ObjectMapper stackObjectMapper = new ObjectMapper().configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true); + private List> portList = new ArrayList<>(); + @Before public void setup() throws Exception{ resources= objectMapper.readValue(new File("src/test/resources/GetResources.json"), Resources.class); + Port neutronPort1 =stackObjectMapper.readValue(new File("src/test/resources/NeutronPort1.json"), Port.class); + doReturn(Optional.of(neutronPort1)).when(neutronUtilsMock).getNeutronPort("7ee06d9d-3d18-411c-9d3e-aec930f70413", cloudRegion,tenantId); + Port neutronPort2 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort2.json"), Port.class); + doReturn(Optional.of(neutronPort2)).when(neutronUtilsMock).getNeutronPort("27391d94-33af-474a-927d-d409249e8fd3", cloudRegion,tenantId); + Port neutronPort3 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort3.json"), Port.class); + doReturn(Optional.of(neutronPort3)).when(neutronUtilsMock).getNeutronPort("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", cloudRegion,tenantId); + Port neutronPort4 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort4.json"), Port.class); + doReturn(Optional.of(neutronPort4)).when(neutronUtilsMock).getNeutronPort("8d93f63e-e972-48c7-ad98-b2122da47315", cloudRegion,tenantId); + Port neutronPort5 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort5.json"), Port.class); + doReturn(Optional.of(neutronPort5)).when(neutronUtilsMock).getNeutronPort("0594a2f2-7ea4-42eb-abc2-48ea49677fca", cloudRegion,tenantId); + Port neutronPort6 = stackObjectMapper.readValue(new File("src/test/resources/NeutronPort6.json"), Port.class); + doReturn(Optional.of(neutronPort6)).when(neutronUtilsMock).getNeutronPort("00bb8407-650e-48b5-b919-33b88d6f8fe3", cloudRegion,tenantId); + + portList.add(Optional.empty()); + portList.add(Optional.of(neutronPort1)); + portList.add(Optional.of(neutronPort2)); + portList.add(Optional.of(neutronPort3)); + portList.add(Optional.of(neutronPort4)); + portList.add(Optional.of(neutronPort5)); + portList.add(Optional.of(neutronPort6)); } @Test @@ -111,13 +139,13 @@ public class HeatStackAuditTest extends HeatStackAudit { vServer1.setLInterfaces(vServer1Linterfaces); LInterface ssc_1_trusted_port_0 = new LInterface(); - ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b"); + ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413"); 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"); + ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943"); vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1); LInterface ssc_1_mgmt_port_0 = new LInterface(); @@ -187,7 +215,7 @@ public class HeatStackAuditTest extends HeatStackAudit { Resources service1ResourceQuerySubInt3 = objectMapper.readValue(new File("src/test/resources/Service1SubInterface2Resources.json"), Resources.class); doReturn(service1ResourceQuerySubInt3).when(msoHeatUtilsMock).executeHeatClientRequest("/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz-2-y3ndsavmsymv/bd0fc728-cbde-4301-a581-db56f494675c/resources", cloudRegion,tenantId, Resources.class); - Set vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources); + Set vServersToAudit = heatStackAudit.createVserverSet(resources, novaResources,portList); Set vserversWithSubInterfaces = heatStackAudit.processSubInterfaces(cloudRegion,tenantId,resourceGroups, vServersToAudit); String actualValue = objectMapper.writeValueAsString(vserversWithSubInterfaces); @@ -219,7 +247,7 @@ public class HeatStackAuditTest extends HeatStackAudit { vServer1.setLInterfaces(vServer1Linterfaces); LInterface ssc_1_trusted_port_0 = new LInterface(); - ssc_1_trusted_port_0.setInterfaceId("d2f51f82-0ec2-4581-bd1a-d2a82073e52b"); + ssc_1_trusted_port_0.setInterfaceId("7ee06d9d-3d18-411c-9d3e-aec930f70413"); vServer1.getLInterfaces().getLInterface().add(ssc_1_trusted_port_0); LInterface ssc_1_service1_port_0 = new LInterface(); @@ -227,7 +255,7 @@ public class HeatStackAuditTest extends HeatStackAudit { 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"); + ssc_1_mgmt_port_1.setInterfaceId("fdeedf37-c01e-4ab0-bdd6-8d5fc4913943"); vServer1.getLInterfaces().getLInterface().add(ssc_1_mgmt_port_1); LInterface ssc_1_mgmt_port_0 = new LInterface(); @@ -244,7 +272,7 @@ public class HeatStackAuditTest extends HeatStackAudit { expectedVservers.add(vServer1); - Set actualVservers = heatStackAudit.createVserverSet(resources, novaResources); + Set actualVservers = heatStackAudit.createVserverSet(resources, novaResources,portList); assertThat(actualVservers, sameBeanAs(expectedVservers)); } diff --git a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json index 22e66d41bb..3366ce4a05 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/GetResources.json +++ b/adapters/mso-openstack-adapters/src/test/resources/GetResources.json @@ -1,6 +1,6 @@ { - "resources": [ - { + "resources": [ + { "links": [ { "href": "https://orchestration.com:8004/v1/99cecb7b19dc4690960761abd0fe2413/stacks/zdyh3brlba05_addon/03840be2-7ce6-4e38-a748-dbd59a798732/resources/vlbagent_eph_aff_id", @@ -22,207 +22,208 @@ "resource_type": "OS::Heat::RandomString", "updated_time": "2019-02-07T22:56:12Z" }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_trusted_port_0", + "physical_resource_id": "7ee06d9d-3d18-411c-9d3e-aec930f70413", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_trusted_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_service1_port_0", + "physical_resource_id": "36551a08-592c-4329-ab75-6c594420754c", + "required_by": [ + "ssc_1_subint_service1_port_0_subinterfaces", + "ssc_server_1" + ], + "resource_name": "ssc_1_service1_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c", + "rel": "nested" + } + ], + "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces", + "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c", + "required_by": [], + "resource_name": "ssc_1_subint_service2_port_0_subinterfaces", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Heat::ResourceGroup", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_mgmt_port_1", + "physical_resource_id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_mgmt_port_1", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0", + "rel": "self" + }, { - "resource_name": "ssc_1_trusted_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_trusted_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_trusted_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_service1_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service1_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_service1_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_1_subint_service1_port_0_subinterfaces", - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "27391d94-33af-474a-927d-d409249e8fd3", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_subint_service2_port_0_subinterfaces", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service2_port_0_subinterfaces", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service2_port_0_subinterfaces-hlzdigtimzst/447a9b41-714e-434b-b1d0-6cce8d9f0f0c", - "rel": "nested" - } - ], - "logical_resource_id": "ssc_1_subint_service2_port_0_subinterfaces", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [], - "resource_status_reason": "state changed", - "physical_resource_id": "447a9b41-714e-434b-b1d0-6cce8d9f0f0c", - "resource_type": "OS::Heat::ResourceGroup" - }, - { - "resource_name": "ssc_1_mgmt_port_1", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_1", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_mgmt_port_1", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "07f5b14c-147a-4d14-8c94-a9e94dbc097b", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_mgmt_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_mgmt_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_mgmt_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_service2_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_service2_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_1_subint_service2_port_0_subinterfaces", - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_1_int_ha_port_0", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_1_int_ha_port_0", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [ - "ssc_server_1" - ], - "resource_status_reason": "state changed", - "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3", - "resource_type": "OS::Neutron::Port" - }, - { - "resource_name": "ssc_server_1", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - } - ], - "logical_resource_id": "ssc_server_1", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [], - "resource_status_reason": "state changed", - "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", - "resource_type": "OS::Nova::Server" - }, - { - "resource_name": "ssc_1_subint_service1_port_0_subinterfaces", - "links": [ - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces", - "rel": "self" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", - "rel": "stack" - }, - { - "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672", - "rel": "nested" - } - ], - "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces", - "resource_status": "CREATE_COMPLETE", - "updated_time": "2019-01-23T19:34:15Z", - "required_by": [], - "resource_status_reason": "state changed", - "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672", - "resource_type": "OS::Heat::ResourceGroup" + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_mgmt_port_0", + "physical_resource_id": "8d93f63e-e972-48c7-ad98-b2122da47315", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_mgmt_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_service2_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" } - ] + ], + "logical_resource_id": "ssc_1_service2_port_0", + "physical_resource_id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "required_by": [ + "ssc_1_subint_service2_port_0_subinterfaces", + "ssc_server_1" + ], + "resource_name": "ssc_1_service2_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_int_ha_port_0", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_1_int_ha_port_0", + "physical_resource_id": "00bb8407-650e-48b5-b919-33b88d6f8fe3", + "required_by": [ + "ssc_server_1" + ], + "resource_name": "ssc_1_int_ha_port_0", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Neutron::Port", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_server_1", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + } + ], + "logical_resource_id": "ssc_server_1", + "physical_resource_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "required_by": [], + "resource_name": "ssc_server_1", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Nova::Server", + "updated_time": "2019-01-23T19:34:15Z" + }, + { + "links": [ + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34/resources/ssc_1_subint_service1_port_0_subinterfaces", + "rel": "self" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001/75e046b1-cf7d-4590-91e7-a6079f83fd34", + "rel": "stack" + }, + { + "href": "https://orchestration.com:8004/v1/ea2d13cc98b44d60a6f94bdcb2738f9e/stacks/tsbc0005vm002ssc001-ssc_1_subint_service1_port_0_subinterfaces-dtmxjmny7yjz/31d0647a-6043-49a4-81b6-ccab29380672", + "rel": "nested" + } + ], + "logical_resource_id": "ssc_1_subint_service1_port_0_subinterfaces", + "physical_resource_id": "31d0647a-6043-49a4-81b6-ccab29380672", + "required_by": [], + "resource_name": "ssc_1_subint_service1_port_0_subinterfaces", + "resource_status": "CREATE_COMPLETE", + "resource_status_reason": "state changed", + "resource_type": "OS::Heat::ResourceGroup", + "updated_time": "2019-01-23T19:34:15Z" + } + ] } + diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json new file mode 100644 index 0000000000..e4bd83c21d --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort1.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "7ee06d9d-3d18-411c-9d3e-aec930f70413", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json new file mode 100644 index 0000000000..376a526133 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort2.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "27391d94-33af-474a-927d-d409249e8fd3", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json new file mode 100644 index 0000000000..f0549216be --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort3.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "fdeedf37-c01e-4ab0-bdd6-8d5fc4913943", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json new file mode 100644 index 0000000000..fa10b0c864 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort4.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "8d93f63e-e972-48c7-ad98-b2122da47315", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json new file mode 100644 index 0000000000..54a9ee8404 --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort5.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} diff --git a/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json new file mode 100644 index 0000000000..c47dfd755b --- /dev/null +++ b/adapters/mso-openstack-adapters/src/test/resources/NeutronPort6.json @@ -0,0 +1,41 @@ +{ + "port": { + "admin_state_up": true, + "allowed_address_pairs": [ + { + "ip_address": "192.168.1.1", + "mac_address": "" + } + ], + "binding:host_id": "cool.host.com", + "binding:vif_details": { + "vhostuser_mode": "client", + "vhostuser_socket": "/var/run/asdfasdf/asdfasfd-3d", + "vhostuser_vrouter_plug": true + }, + "binding:vif_type": "vhostuser", + "binding:vnic_type": "normal", + "device_id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "device_owner": "compute:ddd-daa-ddd", + "fixed_ips": [ + { + "ip_address": "2001:1890:1001:264d::2d:2b", + "subnet_id": "1327b4d5-e0f7-4e95-b019-60caaac751d1" + }, + { + "ip_address": "192.168.1.1", + "subnet_id": "05f0a2e9-e9d9-4cc0-8635-b82d3de2d700" + } + ], + "id": "00bb8407-650e-48b5-b919-33b88d6f8fe3", + "mac_address": "02:7e:e0:6d:9d:3d", + "name": "ibcx0026v_ibcx0026vm003_untrusted_port", + "network_id": "cee81fae-28b9-40a0-985f-181796ae0df6", + "port_security_enabled": true, + "security_groups": [ + "ee45e4fd-b00c-4396-85ee-18d82bd03ef6" + ], + "status": "ACTIVE", + "tenant_id": "a9442388264e4a198e68484e676404e9" + } +} -- cgit 1.2.3-korg