Merge "Implement the DELETE method for get-me-a-network"
diff --git a/neutron/tests/tempest/api/test_auto_allocated_topology.py b/neutron/tests/tempest/api/test_auto_allocated_topology.py
index afdfe8c..65c3057 100644
--- a/neutron/tests/tempest/api/test_auto_allocated_topology.py
+++ b/neutron/tests/tempest/api/test_auto_allocated_topology.py
@@ -22,11 +22,14 @@
class TestAutoAllocatedTopology(base.BaseAdminNetworkTest):
"""
- NOTE: This test may eventually migrate to Tempest.
-
- Tests the Get-Me-A-Network operation in the Neutron API
+ Tests the Get-Me-A-Network operations in the Neutron API
using the REST client for Neutron.
"""
+ # NOTE(armax): this is a precaution to avoid interference
+ # from other tests exercising this extension. So long as
+ # all tests are added under TestAutoAllocatedTopology,
+ # nothing bad should happen.
+ force_tenant_isolation = True
@classmethod
@test.requires_ext(extension="auto-allocated-topology", service="network")
@@ -101,3 +104,14 @@
# After the initial GET, the API should be idempotent
self.assertEqual(network_id1, network_id2)
self.assertEqual(resources_after1, resources_after2)
+
+ @test.idempotent_id('aabc0b02-cee4-11e5-9f3c-091127605a2b')
+ def test_delete_allocated_net_topology_as_tenant(self):
+ resources_before = self._count_topology_resources()
+ self.assertEqual((0, 0, 0), resources_before)
+ body = self.client.get_auto_allocated_topology()
+ topology = body['auto_allocated_topology']
+ self.assertIsNotNone(topology)
+ self.client.delete_auto_allocated_topology()
+ resources_after = self._count_topology_resources()
+ self.assertEqual((0, 0, 0), resources_after)
diff --git a/neutron/tests/tempest/services/network/json/network_client.py b/neutron/tests/tempest/services/network/json/network_client.py
index 9c8cb05..54a1fc3 100644
--- a/neutron/tests/tempest/services/network/json/network_client.py
+++ b/neutron/tests/tempest/services/network/json/network_client.py
@@ -738,6 +738,12 @@
body = jsonutils.loads(body)
return service_client.ResponseBody(resp, body)
+ def delete_auto_allocated_topology(self, tenant_id=None):
+ uri = '%s/auto-allocated-topology/%s' % (self.uri_prefix, tenant_id)
+ resp, body = self.delete(uri)
+ self.expected_success(204, resp.status)
+ return service_client.ResponseBody(resp, body)
+
def create_security_group_rule(self, direction, security_group_id,
**kwargs):
post_body = {'security_group_rule': kwargs}