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
This commit is contained in:
Slawek Kaplonski 2024-05-22 16:16:38 +02:00
parent 839bbc9a6d
commit 9aec7b695e
2 changed files with 16 additions and 0 deletions

View File

@ -79,6 +79,14 @@ class TestAutoAllocatedTopology(base.BaseAdminNetworkTest):
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()

View File

@ -804,6 +804,14 @@ class NetworkClientJSON(service_client.RestClient):
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)