diff options
author | Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com> | 2017-11-07 15:54:56 +0100 |
---|---|---|
committer | Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com> | 2017-11-08 06:32:49 +0000 |
commit | f3d22e693075fc40ed392f4d1345a81c84bf34c4 (patch) | |
tree | ca3fbf0742c994fc7b972f95834983947218831f | |
parent | 8211ebd59a28be997386030cb1f87e0630770a78 (diff) |
use glance_client for image cleanup
Change-Id: Ia192a1b26c5f31b6d3465a060c3d8a3097e6ebd4
Signed-off-by: Periyasamy Palanisamy <periyasamy.palanisamy@ericsson.com>
-rw-r--r-- | sdnvpn/lib/utils.py | 7 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_1.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_10.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_11.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_2.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_3.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_4.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_7.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_8.py | 3 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_9.py | 1 |
10 files changed, 22 insertions, 10 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py index 54c9730..1afccf7 100644 --- a/sdnvpn/lib/utils.py +++ b/sdnvpn/lib/utils.py @@ -592,7 +592,7 @@ def cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, return True -def cleanup_nova(nova_client, instance_ids, image_ids): +def cleanup_nova(nova_client, instance_ids): if len(instance_ids) != 0: for instance_id in instance_ids: if not os_utils.delete_instance(nova_client, instance_id): @@ -600,10 +600,13 @@ def cleanup_nova(nova_client, instance_ids, image_ids): 'Instance with id {} was not deleted.'. format(instance_id)) return False + return True + +def cleanup_glance(glance_client, image_ids): if len(image_ids) != 0: for image_id in image_ids: - if not os_utils.delete_glance_image(nova_client, image_id): + if not os_utils.delete_glance_image(glance_client, image_id): logging.error('Fail to delete all images. ' 'Image with id {} was not deleted.'. format(image_id)) diff --git a/sdnvpn/test/functest/testcase_1.py b/sdnvpn/test/functest/testcase_1.py index 718f305..1b51f00 100644 --- a/sdnvpn/test/functest/testcase_1.py +++ b/sdnvpn/test/functest/testcase_1.py @@ -210,7 +210,8 @@ def main(): logger.error("exception occurred while executing testcase_1: %s", e) raise finally: - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_10.py b/sdnvpn/test/functest/testcase_10.py index 557b658..6344a17 100644 --- a/sdnvpn/test/functest/testcase_10.py +++ b/sdnvpn/test/functest/testcase_10.py @@ -252,7 +252,8 @@ def main(): for thread in threads: thread.join() - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_11.py b/sdnvpn/test/functest/testcase_11.py index bb51199..40de205 100644 --- a/sdnvpn/test/functest/testcase_11.py +++ b/sdnvpn/test/functest/testcase_11.py @@ -128,7 +128,8 @@ def main(): raise finally: # Cleanup topology - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_2.py b/sdnvpn/test/functest/testcase_2.py index bc37c5c..7594055 100644 --- a/sdnvpn/test/functest/testcase_2.py +++ b/sdnvpn/test/functest/testcase_2.py @@ -271,7 +271,8 @@ def main(): logger.error("exception occurred while executing testcase_2: %s", e) raise finally: - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py index 7e14505..3dc1e7c 100644 --- a/sdnvpn/test/functest/testcase_3.py +++ b/sdnvpn/test/functest/testcase_3.py @@ -278,7 +278,8 @@ def main(): logger.error("exception occurred while executing testcase_3: %s", e) raise finally: - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_4.py b/sdnvpn/test/functest/testcase_4.py index f6748f9..5e6b2b8 100644 --- a/sdnvpn/test/functest/testcase_4.py +++ b/sdnvpn/test/functest/testcase_4.py @@ -220,7 +220,8 @@ def main(): logger.error("exception occurred while executing testcase_4: %s", e) raise finally: - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_7.py b/sdnvpn/test/functest/testcase_7.py index 65a77b6..2d9e713 100644 --- a/sdnvpn/test/functest/testcase_7.py +++ b/sdnvpn/test/functest/testcase_7.py @@ -163,7 +163,8 @@ def main(): logger.error("exception occurred while executing testcase_7: %s", e) raise finally: - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_8.py b/sdnvpn/test/functest/testcase_8.py index abb111f..fb54761 100644 --- a/sdnvpn/test/functest/testcase_8.py +++ b/sdnvpn/test/functest/testcase_8.py @@ -165,7 +165,8 @@ def main(): logger.error("exception occurred while executing testcase_8: %s", e) raise finally: - test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_nova(nova_client, instance_ids) + test_utils.cleanup_glance(glance_client, image_ids) test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, subnet_ids, router_ids, network_ids) diff --git a/sdnvpn/test/functest/testcase_9.py b/sdnvpn/test/functest/testcase_9.py index 45e9d5b..1489a5a 100644 --- a/sdnvpn/test/functest/testcase_9.py +++ b/sdnvpn/test/functest/testcase_9.py @@ -65,6 +65,7 @@ def main(): return results.compile_summary() + if __name__ == '__main__': logging.basicConfig(level=logging.INFO) sys.exit(main()) |