From cf996c653bef62f2ae71331cf45323e5f183b2be Mon Sep 17 00:00:00 2001 From: Salvatore Orlando Date: Thu, 30 Jan 2014 09:15:18 -0800 Subject: [PATCH] Remove network resources created in scenario tests Change-Id: I1bd53d99f2632441ebf648cb0c2929c9b55998b6 Closes-Bug: #1274410 --- tempest/common/isolated_creds.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tempest/common/isolated_creds.py b/tempest/common/isolated_creds.py index f2df061cf8..146fac9df7 100644 --- a/tempest/common/isolated_creds.py +++ b/tempest/common/isolated_creds.py @@ -472,7 +472,11 @@ class IsolatedCreds(object): net_client = self.network_admin_client for cred in self.isolated_net_resources: network, subnet, router = self.isolated_net_resources.get(cred) - if self.network_resources.get('router'): + LOG.debug("Clearing network: %(network)s, " + "subnet: %(subnet)s, router: %(router)s", + {'network': network, 'subnet': subnet, 'router': router}) + if (not self.network_resources or + self.network_resources.get('router')): try: if self.tempest_client: net_client.remove_router_interface_with_subnet_id( @@ -485,13 +489,16 @@ class IsolatedCreds(object): router['name']) pass self._clear_isolated_router(router['id'], router['name']) - if self.network_resources.get('network'): + if (not self.network_resources or + self.network_resources.get('network')): # TODO(mlavalle) This method call will be removed once patch # https://review.openstack.org/#/c/46563/ merges in Neutron self._cleanup_ports(network['id']) - if self.network_resources.get('subnet'): + if (not self.network_resources or + self.network_resources.get('subnet')): self._clear_isolated_subnet(subnet['id'], subnet['name']) - if self.network_resources.get('network'): + if (not self.network_resources or + self.network_resources.get('network')): self._clear_isolated_network(network['id'], network['name']) def clear_isolated_creds(self):