summaryrefslogtreecommitdiffstats
path: root/sdnvpn/test/functest/testcase_3.py
diff options
context:
space:
mode:
authortomsou <soth@intracom-telecom.com>2017-05-22 09:14:22 +0000
committertomsou <soth@intracom-telecom.com>2017-05-31 13:19:43 +0000
commitde80ee56c458b127be3497f3882bc1c962f42dfe (patch)
treec2c415ece2c7e6aabf7a0a59493485787142e6b1 /sdnvpn/test/functest/testcase_3.py
parent9fb7fad2a9f83ddb7d0c1f61b2d5609352fb6f15 (diff)
Cleanup after testcase running
After every testcase running cleanup neutron and nova elements: - Allocated floating IPs (nova) - Created instances (nova) - Created images (nova) - Created router-subnet interfaces (neutron) - Created gateaway routers (neutron) - Created routers (neutron) - Created subnets (neutron) - Created networks (neutron) - Created bgpvpns (neutron) JIRA: SDNVPN-145 JIRA: SDNVPN-148 Change-Id: Id6df004bb9d0d394e2cf39692b624607167c9a6c Signed-off-by: tomsou <soth@intracom-telecom.com>
Diffstat (limited to 'sdnvpn/test/functest/testcase_3.py')
-rw-r--r--sdnvpn/test/functest/testcase_3.py44
1 files changed, 33 insertions, 11 deletions
diff --git a/sdnvpn/test/functest/testcase_3.py b/sdnvpn/test/functest/testcase_3.py
index b906be6..85a8827 100644
--- a/sdnvpn/test/functest/testcase_3.py
+++ b/sdnvpn/test/functest/testcase_3.py
@@ -149,6 +149,9 @@ def main():
nova_client = os_utils.get_nova_client()
neutron_client = os_utils.get_neutron_client()
+ (floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
+ subnet_ids, interfaces, bgpvpn_ids) = ([] for i in range(8))
+
sg_id = os_utils.create_security_group_full(neutron_client,
TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
@@ -156,18 +159,26 @@ def main():
test_utils.open_http_port(neutron_client, sg_id)
test_utils.open_bgp_port(neutron_client, sg_id)
- net_id, _, _ = test_utils.create_network(neutron_client,
- TESTCASE_CONFIG.net_1_name,
- TESTCASE_CONFIG.subnet_1_name,
- TESTCASE_CONFIG.subnet_1_cidr,
- TESTCASE_CONFIG.router_1_name)
-
- quagga_net_id, _, _ = test_utils.create_network(
+ net_id, subnet_1_id, router_1_id = test_utils.create_network(
neutron_client,
- TESTCASE_CONFIG.quagga_net_name,
- TESTCASE_CONFIG.quagga_subnet_name,
- TESTCASE_CONFIG.quagga_subnet_cidr,
- TESTCASE_CONFIG.quagga_router_name)
+ TESTCASE_CONFIG.net_1_name,
+ TESTCASE_CONFIG.subnet_1_name,
+ TESTCASE_CONFIG.subnet_1_cidr,
+ TESTCASE_CONFIG.router_1_name)
+
+ quagga_net_id, subnet_quagga_id, \
+ router_quagga_id = test_utils.create_network(
+ neutron_client,
+ TESTCASE_CONFIG.quagga_net_name,
+ TESTCASE_CONFIG.quagga_subnet_name,
+ TESTCASE_CONFIG.quagga_subnet_cidr,
+ TESTCASE_CONFIG.quagga_router_name)
+
+ interfaces.append(tuple((router_1_id, subnet_1_id)))
+ interfaces.append(tuple((router_quagga_id, subnet_quagga_id)))
+ network_ids.extend([net_id, quagga_net_id])
+ router_ids.extend([router_1_id, router_quagga_id])
+ subnet_ids.extend([subnet_1_id, subnet_quagga_id])
installer_type = str(os.environ['INSTALLER_TYPE'].lower())
if installer_type == "fuel":
@@ -185,6 +196,8 @@ def main():
container="bare",
public="public")
+ image_ids.append(ubuntu_image_id)
+
# NOTE(rski) The order of this seems a bit weird but
# there is a reason for this, namely
# https://jira.opnfv.org/projects/SDNVPN/issues/SDNVPN-99
@@ -198,6 +211,8 @@ def main():
# fake_fip is needed to bypass NAT
# see below for the reason why.
fake_fip = os_utils.create_floating_ip(neutron_client)
+
+ floatingip_ids.extend([fip['fip_id'], fake_fip['fip_id']])
# pin quagga to some compute
compute_node = nova_client.hypervisors.list()[0]
quagga_compute_node = "nova:" + compute_node.hypervisor_hostname
@@ -225,6 +240,8 @@ def main():
userdata=quagga_bootstrap_script,
compute_node=quagga_compute_node)
+ instance_ids.append(quagga_vm)
+
fip_added = os_utils.add_floating_ip(nova_client,
quagga_vm.id,
fip['fip_addr'])
@@ -265,6 +282,11 @@ def main():
finally:
test_utils.detach_instance_from_ext_br(quagga_vm, compute)
+ 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)
+
return results.compile_summary()