diff options
-rw-r--r-- | sdnvpn/lib/utils.py | 23 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_1.py | 8 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_2.py | 9 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_3.py | 10 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_4.py | 9 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_7.py | 8 | ||||
-rw-r--r-- | sdnvpn/test/functest/testcase_8.py | 9 |
7 files changed, 36 insertions, 40 deletions
diff --git a/sdnvpn/lib/utils.py b/sdnvpn/lib/utils.py index 78bd09e..e22e455 100644 --- a/sdnvpn/lib/utils.py +++ b/sdnvpn/lib/utils.py @@ -538,8 +538,16 @@ def detach_instance_from_ext_br(instance, compute_node): compute_node.run_cmd(cmd.format(bridge=bridge)) -def cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, subnet_ids, - router_ids, network_ids): +def cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, interfaces, + subnet_ids, router_ids, network_ids): + + if len(floatingip_ids) != 0: + for floatingip_id in floatingip_ids: + if not os_utils.delete_floating_ip(neutron_client, floatingip_id): + logging.error('Fail to delete all floating ips. ' + 'Floating ip with id {} was not deleted.'. + format(floatingip_id)) + return False if len(bgpvpn_ids) != 0: for bgpvpn_id in bgpvpn_ids: @@ -586,16 +594,7 @@ def cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, subnet_ids, return True -def cleanup_nova(nova_client, floatingip_ids, instance_ids, image_ids): - - if len(floatingip_ids) != 0: - for floatingip_id in floatingip_ids: - if not os_utils.delete_floating_ip(nova_client, floatingip_id): - logging.error('Fail to delete all floating ips. ' - 'Floating ip with id {} was not deleted.'. - format(floatingip_id)) - return False - +def cleanup_nova(nova_client, instance_ids, image_ids): if len(instance_ids) != 0: for instance_id in instance_ids: if not os_utils.delete_instance(nova_client, instance_id): diff --git a/sdnvpn/test/functest/testcase_1.py b/sdnvpn/test/functest/testcase_1.py index 467c311..8291151 100644 --- a/sdnvpn/test/functest/testcase_1.py +++ b/sdnvpn/test/functest/testcase_1.py @@ -212,10 +212,10 @@ def main(): results.get_ping_status(vm_1, vm_4, expected="PASS", timeout=30) results.get_ping_status(vm_1, vm_5, expected="PASS", timeout=30) - test_utils.cleanup_nova(nova_client, floatingip_ids, instance_ids, - image_ids) - test_utils.cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, - subnet_ids, router_ids, network_ids) + test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, + interfaces, subnet_ids, router_ids, + network_ids) return results.compile_summary() diff --git a/sdnvpn/test/functest/testcase_2.py b/sdnvpn/test/functest/testcase_2.py index f8d53de..0265aee 100644 --- a/sdnvpn/test/functest/testcase_2.py +++ b/sdnvpn/test/functest/testcase_2.py @@ -253,11 +253,10 @@ def main(): expected="not reachable", timeout=30) - test_utils.cleanup_nova(nova_client, floatingip_ids, instance_ids, - image_ids) - test_utils.cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, - subnet_ids, router_ids, network_ids) - + test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, + interfaces, subnet_ids, router_ids, + network_ids) return results.compile_summary() diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py index dbbdb59..24d413c 100644 --- a/sdnvpn/test/functest/testcase_3.py +++ b/sdnvpn/test/functest/testcase_3.py @@ -279,14 +279,12 @@ def main(): else: results.add_failure("Peering with quagga") - test_utils.cleanup_nova(nova_client, floatingip_ids, instance_ids, - image_ids) - test_utils.cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, - subnet_ids, router_ids, network_ids) - + test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, + interfaces, subnet_ids, router_ids, + network_ids) return results.compile_summary() - if __name__ == '__main__': logging.basicConfig(level=logging.INFO) main() diff --git a/sdnvpn/test/functest/testcase_4.py b/sdnvpn/test/functest/testcase_4.py index 871a4bb..cff60f1 100644 --- a/sdnvpn/test/functest/testcase_4.py +++ b/sdnvpn/test/functest/testcase_4.py @@ -219,11 +219,10 @@ def main(): results.add_to_summary(0, "=") logger.info("\n%s" % results.summary) - test_utils.cleanup_nova(nova_client, floatingip_ids, instance_ids, - image_ids) - test_utils.cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, - subnet_ids, router_ids, network_ids) - + test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, + interfaces, subnet_ids, router_ids, + network_ids) return results.compile_summary() diff --git a/sdnvpn/test/functest/testcase_7.py b/sdnvpn/test/functest/testcase_7.py index 07bb257..21bc12b 100644 --- a/sdnvpn/test/functest/testcase_7.py +++ b/sdnvpn/test/functest/testcase_7.py @@ -164,11 +164,11 @@ def main(): results.ping_ip_test(fip['fip_addr']) floatingip_ids.append(fip['fip_id']) - test_utils.cleanup_nova(nova_client, floatingip_ids, instance_ids, - image_ids) - test_utils.cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, - subnet_ids, router_ids, network_ids) + test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, + interfaces, subnet_ids, router_ids, + network_ids) return results.compile_summary() diff --git a/sdnvpn/test/functest/testcase_8.py b/sdnvpn/test/functest/testcase_8.py index 6961546..7738c75 100644 --- a/sdnvpn/test/functest/testcase_8.py +++ b/sdnvpn/test/functest/testcase_8.py @@ -166,10 +166,11 @@ def main(): floatingip_ids.append(fip['fip_id']) - test_utils.cleanup_nova(nova_client, floatingip_ids, instance_ids, - image_ids) - test_utils.cleanup_neutron(neutron_client, bgpvpn_ids, interfaces, - subnet_ids, router_ids, network_ids) + test_utils.cleanup_nova(nova_client, instance_ids, image_ids) + test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids, + interfaces, subnet_ids, router_ids, + network_ids) + return results.compile_summary() |