summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolas Hermanns <nikolas.hermanns@ericsson.com>2017-06-29 12:45:19 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-06-29 12:45:19 +0000
commitbea2edf545006f76385a6f597aef999871011b26 (patch)
treeb5e6de311839b5079800d098baaaaa1d10e6ab47
parent752497c8d7b72ad1599cd14a2061d11322201068 (diff)
parent18443e7872ddb154e2c91433ed03b09deab90321 (diff)
Merge "Adapt the floating ip handling in functest"
-rw-r--r--sdnvpn/lib/utils.py23
-rw-r--r--sdnvpn/test/functest/testcase_1.py8
-rw-r--r--sdnvpn/test/functest/testcase_2.py9
-rw-r--r--sdnvpn/test/functest/testcase_3.py10
-rw-r--r--sdnvpn/test/functest/testcase_4.py9
-rw-r--r--sdnvpn/test/functest/testcase_7.py8
-rw-r--r--sdnvpn/test/functest/testcase_8.py9
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()