aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Buil <mbuil@suse.com>2018-04-18 10:37:40 +0200
committerManuel Buil <mbuil@suse.com>2018-04-18 12:28:14 +0200
commit9fc412714c038f69f959105e1f5dc8e8a670d0b9 (patch)
tree29d2132eea0a19d7b586279d5fa3973b864fe5a8
parent31177afd6821f65e2601cb2b928624ba8f3d0216 (diff)
Track the indirectly created security groups
networking-odl creates a security group when creating a router. This security group is not tracked by SNAPs and thus it never gets removed when running the clean up. We need this workaround until the following bug is fixed: https://bugs.launchpad.net/networking-odl/+bug/1763705 Change-Id: I15b939609e815f24ef0c1dcc0aeb9f4471f351f0 Signed-off-by: Manuel Buil <mbuil@suse.com>
-rw-r--r--sfc/lib/cleanup.py8
-rw-r--r--sfc/lib/openstack_utils.py11
2 files changed, 18 insertions, 1 deletions
diff --git a/sfc/lib/cleanup.py b/sfc/lib/cleanup.py
index 32835fa8..7a2f4053 100644
--- a/sfc/lib/cleanup.py
+++ b/sfc/lib/cleanup.py
@@ -82,6 +82,13 @@ def delete_openstack_objects(creators):
logger.error('Unexpected error cleaning - %s', e)
+# Networking-odl generates a new security group when creating a router
+# which is not tracked by SNAPs
+def delete_untracked_security_groups():
+ openstack_sfc = os_sfc_utils.OpenStackSFC()
+ openstack_sfc.delete_all_security_groups()
+
+
def cleanup_odl(odl_ip, odl_port):
delete_odl_resources(odl_ip, odl_port, 'service-function-forwarder')
delete_odl_resources(odl_ip, odl_port, 'service-function-chain')
@@ -98,6 +105,7 @@ def cleanup(creators, odl_ip=None, odl_port=None):
delete_vnfds()
delete_vims()
delete_openstack_objects(creators)
+ delete_untracked_security_groups()
if odl_ip is not None and odl_port is not None:
cleanup_odl(odl_ip, odl_port)
diff --git a/sfc/lib/openstack_utils.py b/sfc/lib/openstack_utils.py
index b7254bf1..0b343f37 100644
--- a/sfc/lib/openstack_utils.py
+++ b/sfc/lib/openstack_utils.py
@@ -253,10 +253,19 @@ class OpenStackSFC:
" with name {1}".format(vm.name, port_name))
raise Exception("Client VM does not have the desired port")
+ def delete_all_security_groups(self):
+ '''
+ Deletes all the available security groups
-# TACKER SECTION #
+ Needed until this bug is fixed:
+ https://bugs.launchpad.net/networking-odl/+bug/1763705
+ '''
+ sec_groups = neutron_utils.list_security_groups(self.neutron)
+ for sg in sec_groups:
+ neutron_utils.delete_security_group(self.neutron, sg)
+# TACKER SECTION #
def get_tacker_client_version():
api_version = os.getenv('OS_TACKER_API_VERSION')
if api_version is not None: