Add test for the validate auto_allocated_topology API
This new test calls neutron API to check requirements for the auto
allocated topology and to make sure that it don't returns 404 for
example.
Depends-On: https://review.opendev.org/c/openstack/neutron/+/920360
Depends-On: https://review.opendev.org/c/openstack/neutron/+/920481
Depends-On: https://review.opendev.org/c/openstack/neutron/+/920482
Related-bug: #2066369
Change-Id: I9b46699cdf9361a49e558130b336722599419f0f
diff --git a/neutron_tempest_plugin/api/test_auto_allocated_topology.py b/neutron_tempest_plugin/api/test_auto_allocated_topology.py
index 4d70bfc..2177402 100644
--- a/neutron_tempest_plugin/api/test_auto_allocated_topology.py
+++ b/neutron_tempest_plugin/api/test_auto_allocated_topology.py
@@ -79,6 +79,14 @@
body = client.list_networks(name='auto_allocated_network')
self.networks.extend(body['networks'])
+ @decorators.idempotent_id('10e4ecef-4309-4bda-9c4d-192e1b5a5831')
+ def test_check_requirements_for_auto_allocate_net_topology(self):
+ body = self.client.validate_auto_allocated_topology_requirements()
+ topology = body['auto_allocated_topology']
+ self.assertIn('dry-run', topology['id'])
+ self.assertIn('tenant_id', topology)
+ self.assertIn('project_id', topology)
+
@decorators.idempotent_id('64bc0b02-cee4-11e5-9f3c-080027605a2b')
def test_get_allocated_net_topology_as_tenant(self):
resources_before = self._count_topology_resources()
diff --git a/neutron_tempest_plugin/services/network/json/network_client.py b/neutron_tempest_plugin/services/network/json/network_client.py
index 1153a2a..289ef61 100644
--- a/neutron_tempest_plugin/services/network/json/network_client.py
+++ b/neutron_tempest_plugin/services/network/json/network_client.py
@@ -804,6 +804,14 @@
body = jsonutils.loads(body)
return service_client.ResponseBody(resp, body)
+ def validate_auto_allocated_topology_requirements(self, tenant_id=None):
+ uri = '%s/auto-allocated-topology/%s?fields=dry-run' % (
+ self.uri_prefix, tenant_id)
+ resp, body = self.get(uri)
+ self.expected_success(200, resp.status)
+ body = jsonutils.loads(body)
+ return service_client.ResponseBody(resp, body)
+
def get_auto_allocated_topology(self, tenant_id=None):
uri = '%s/auto-allocated-topology/%s' % (self.uri_prefix, tenant_id)
resp, body = self.get(uri)