Delete all NS-Groups when call unstack.sh

Besides typical NSGroups which backes Neutron security-group,
the plugin also creates nested NSGroups, these should be deleted as well
when calling unstack.sh.

Change-Id: Id2e803dd29f1cd019eeaf0df7ca6309054fda600
This commit is contained in:
Roey Chen 2015-12-28 04:17:03 -08:00
parent b973e406f9
commit a46f433429

View File

@ -285,18 +285,11 @@ class NSXClient(object):
response = self.get(endpoint="/ns-groups")
return response.json()['results']
def get_os_ns_groups(self):
"""
Retrieve all NSGroups created from OpenStack
"""
ns_groups = self.get_ns_groups()
return self.get_os_resources(ns_groups)
def cleanup_os_ns_groups(self):
"""
Cleanup all NSGroups created from OpenStack plugin
"""
ns_groups = self.get_os_ns_groups()
ns_groups = self.get_ns_groups()
print("Number of OS NSGroups to be deleted: %s" % len(ns_groups))
for nsg in ns_groups:
endpoint = "/ns-groups/%s" % nsg['id']