summaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rwxr-xr-xutils/openstack_clean.py11
-rwxr-xr-xutils/openstack_utils.py7
2 files changed, 17 insertions, 1 deletions
diff --git a/utils/openstack_clean.py b/utils/openstack_clean.py
index 8aba763ce..3b937c917 100755
--- a/utils/openstack_clean.py
+++ b/utils/openstack_clean.py
@@ -202,9 +202,20 @@ def remove_networks(neutron_client, default_networks, default_routers):
else:
remove_routers(neutron_client, routers, default_routers)
+ # trozet: wait for Neutron to auto-cleanup HA networks when HA router is
+ # deleted
+ time.sleep(5)
+
# remove networks
if network_ids is not None:
for net_id in network_ids:
+ networks = os_utils.get_network_list(neutron_client)
+ if networks is None:
+ logger.debug("No networks left to remove")
+ break
+ elif not any(network['id'] == net_id for network in networks):
+ logger.debug("Network %s has already been removed" % net_id)
+ continue
logger.debug("Removing network %s ..." % net_id)
if os_utils.delete_neutron_net(neutron_client, net_id):
logger.debug(" > Done!")
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index bc718bb2b..ff9b54a58 100755
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -705,6 +705,11 @@ def create_network_association(neutron_client, bgpvpn_id, neutron_network_id):
return neutron_client.create_network_association(bgpvpn_id, json_body)
+def create_router_association(neutron_client, bgpvpn_id, router_id):
+ json_body = {"router_association": {"router_id": router_id}}
+ return neutron_client.create_router_association(bgpvpn_id, json_body)
+
+
def update_bgpvpn(neutron_client, bgpvpn_id, **kwargs):
json_body = {"bgpvpn": kwargs}
return neutron_client.update_bgpvpn(bgpvpn_id, json_body)
@@ -1077,7 +1082,7 @@ def create_tenant(keystone_client, tenant_name, tenant_description):
enabled=True)
return tenant.id
except Exception, e:
- logger.error("Error [create_tenant(cinder_client, '%s', '%s')]: %s"
+ logger.error("Error [create_tenant(keystone_client, '%s', '%s')]: %s"
% (tenant_name, tenant_description, e))
return None