summaryrefslogtreecommitdiffstats
path: root/sdnvpn/test/functest
diff options
context:
space:
mode:
authorStamatis Katsaounis <mokats@intracom-telecom.com>2018-09-06 14:44:48 +0300
committerStamatis Katsaounis <mokats@intracom-telecom.com>2018-10-09 16:40:10 +0300
commitebf6885a907379083b360ae729f69151c1dd8115 (patch)
tree715f7716028fff85e2e3e44045ad55dff916c1d8 /sdnvpn/test/functest
parentc05105a4f9f51f7bb31cad791e65d664e5a3bc4b (diff)
Replace neutron client calls with openstack sdk
JIRA: SDNVPN-220 This patch replaces almost all calls of neutron client with openstack sdk. The calls regarding bgpvpn are not replaced due to lack of support from openstack sdk at the moment. Change-Id: Idf52b8c57b895f87ba6320e350bf170faa24d0a7 Signed-off-by: Stamatis Katsaounis <mokats@intracom-telecom.com>
Diffstat (limited to 'sdnvpn/test/functest')
-rw-r--r--sdnvpn/test/functest/run_sdnvpn_tests.py41
-rw-r--r--sdnvpn/test/functest/testcase_1.py13
-rw-r--r--sdnvpn/test/functest/testcase_10.py13
-rw-r--r--sdnvpn/test/functest/testcase_11.py13
-rw-r--r--sdnvpn/test/functest/testcase_12.py13
-rw-r--r--sdnvpn/test/functest/testcase_13.py29
-rw-r--r--sdnvpn/test/functest/testcase_2.py17
-rw-r--r--sdnvpn/test/functest/testcase_3.py27
-rw-r--r--sdnvpn/test/functest/testcase_4.py11
-rw-r--r--sdnvpn/test/functest/testcase_7.py23
-rw-r--r--sdnvpn/test/functest/testcase_8.py22
11 files changed, 101 insertions, 121 deletions
diff --git a/sdnvpn/test/functest/run_sdnvpn_tests.py b/sdnvpn/test/functest/run_sdnvpn_tests.py
index 3f3b519..b1b242e 100644
--- a/sdnvpn/test/functest/run_sdnvpn_tests.py
+++ b/sdnvpn/test/functest/run_sdnvpn_tests.py
@@ -32,22 +32,22 @@ class SdnvpnFunctest(feature.Feature):
def execute(self):
cloud = os_utils.get_os_cloud()
- neutron_client = os_utils.get_neutron_client()
+ conn = os_utils.get_os_connection()
tenant_id = os_utils.get_tenant_id(os_utils.get_keystone_client(),
os.environ['OS_PROJECT_NAME'])
- neutron_quota = test_utils.get_neutron_quota(neutron_client, tenant_id)
+ neutron_quota = test_utils.get_neutron_quota(conn, tenant_id)
(neutron_nw_quota, neutron_subnet_quota, neutron_port_quota,
neutron_router_quota) = (
- neutron_quota['network'], neutron_quota['subnet'],
- neutron_quota['port'], neutron_quota['router'])
+ neutron_quota.networks, neutron_quota.subnets,
+ neutron_quota.ports, neutron_quota.routers)
instances_quota = test_utils.get_nova_instances_quota(cloud)
logger.info("Setting net/subnet/port/router "
"quota to unlimited")
test_utils.update_nw_subnet_port_quota(
- neutron_client,
+ conn,
tenant_id,
COMMON_CONFIG.neutron_nw_quota,
COMMON_CONFIG.neutron_subnet_quota,
@@ -64,29 +64,22 @@ class SdnvpnFunctest(feature.Feature):
# Clean up the stale floating ip's so that required
# ip addresses are available for sdnvpn testcases
logger.info("Cleaning up the Floating IP Addresses")
- floating_ips = os_utils.get_floating_ips(neutron_client)
- if floating_ips is not None:
- for floating_ip in floating_ips:
- os_utils.delete_floating_ip(
- neutron_client, floating_ip['id'])
+ floating_ips = os_utils.get_floating_ips(conn)
+ for floating_ip in floating_ips:
+ os_utils.delete_floating_ip(conn, floating_ip.id)
# Workaround for
# https://jira.opnfv.org/browse/SNAPS-318
# Clean up the stale routers
logger.info("Cleaning up the stale routers")
- ports = os_utils.get_port_list(neutron_client)
- if ports is not None:
- for port in ports:
- if port['device_owner'] == 'network:router_interface':
- os_utils.delete_neutron_port(
- neutron_client, port['id'])
- routers = os_utils.get_router_list(neutron_client)
- if routers is not None:
- for router in routers:
- os_utils.remove_gateway_router(
- neutron_client, router['id'])
- os_utils.delete_neutron_router(
- neutron_client, router['id'])
+ ports = os_utils.get_port_list(conn)
+ for port in ports:
+ if port.device_owner == 'network:router_interface':
+ os_utils.delete_neutron_port(conn, port.id)
+ routers = os_utils.get_router_list(conn)
+ for router in routers:
+ os_utils.remove_gateway_router(conn, router.id)
+ os_utils.delete_neutron_router(conn, router.id)
with open(COMMON_CONFIG.config_file) as f:
config_yaml = yaml.safe_load(f)
@@ -132,7 +125,7 @@ class SdnvpnFunctest(feature.Feature):
overall_status = "FAIL"
logger.info("Resetting subnet/net/port quota")
- test_utils.update_nw_subnet_port_quota(neutron_client,
+ test_utils.update_nw_subnet_port_quota(conn,
tenant_id,
neutron_nw_quota,
neutron_subnet_quota,
diff --git a/sdnvpn/test/functest/testcase_1.py b/sdnvpn/test/functest/testcase_1.py
index 1ba90af..b524abf 100644
--- a/sdnvpn/test/functest/testcase_1.py
+++ b/sdnvpn/test/functest/testcase_1.py
@@ -33,7 +33,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
subnet_ids, interfaces, bgpvpn_ids) = ([] for i in range(8))
@@ -45,17 +44,17 @@ def main():
container="bare", public='public')
image_ids.append(image_id)
- network_1_id = test_utils.create_net(neutron_client,
+ network_1_id = test_utils.create_net(conn,
TESTCASE_CONFIG.net_1_name)
- subnet_1_id = test_utils.create_subnet(neutron_client,
+ subnet_1_id = test_utils.create_subnet(conn,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
network_1_id)
- network_2_id = test_utils.create_net(neutron_client,
+ network_2_id = test_utils.create_net(conn,
TESTCASE_CONFIG.net_2_name)
- subnet_2_id = test_utils.create_subnet(neutron_client,
+ subnet_2_id = test_utils.create_subnet(conn,
TESTCASE_CONFIG.subnet_2_name,
TESTCASE_CONFIG.subnet_2_cidr,
network_2_id)
@@ -63,7 +62,7 @@ def main():
subnet_ids.extend([subnet_1_id, subnet_2_id])
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
compute_nodes = test_utils.assert_and_get_compute_nodes(conn)
@@ -246,7 +245,7 @@ def main():
finally:
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids,
+ test_utils.cleanup_neutron(conn, 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 a315c32..dbfbfd4 100644
--- a/sdnvpn/test/functest/testcase_10.py
+++ b/sdnvpn/test/functest/testcase_10.py
@@ -73,7 +73,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
subnet_ids, interfaces, bgpvpn_ids) = ([] for i in range(8))
@@ -85,9 +84,9 @@ def main():
public='public')
image_ids.append(image_id)
- network_1_id = test_utils.create_net(neutron_client,
+ network_1_id = test_utils.create_net(conn,
TESTCASE_CONFIG.net_1_name)
- subnet_1_id = test_utils.create_subnet(neutron_client,
+ subnet_1_id = test_utils.create_subnet(conn,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
network_1_id)
@@ -95,7 +94,7 @@ def main():
network_ids.append(network_1_id)
subnet_ids.append(subnet_1_id)
- sg_id = os_utils.create_security_group_full(neutron_client,
+ sg_id = os_utils.create_security_group_full(conn,
TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
@@ -262,9 +261,9 @@ def main():
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids,
- interfaces, subnet_ids, router_ids,
- network_ids)
+ test_utils.cleanup_neutron(conn, neutron_client, floatingip_ids,
+ bgpvpn_ids, interfaces, subnet_ids,
+ router_ids, network_ids)
return results.compile_summary()
diff --git a/sdnvpn/test/functest/testcase_11.py b/sdnvpn/test/functest/testcase_11.py
index 78f01a9..fd2c74a 100644
--- a/sdnvpn/test/functest/testcase_11.py
+++ b/sdnvpn/test/functest/testcase_11.py
@@ -32,7 +32,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
openstack_nodes = test_utils.get_nodes()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
@@ -45,9 +44,9 @@ def main():
container="bare", public='public')
image_ids.append(image_id)
- network_1_id = test_utils.create_net(neutron_client,
+ network_1_id = test_utils.create_net(conn,
TESTCASE_CONFIG.net_1_name)
- subnet_1_id = test_utils.create_subnet(neutron_client,
+ subnet_1_id = test_utils.create_subnet(conn,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
network_1_id)
@@ -56,7 +55,7 @@ def main():
subnet_ids.append(subnet_1_id)
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
# Check required number of compute nodes
@@ -129,9 +128,9 @@ def main():
# Cleanup topology
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids,
- interfaces, subnet_ids, router_ids,
- network_ids)
+ test_utils.cleanup_neutron(conn, neutron_client, floatingip_ids,
+ bgpvpn_ids, interfaces, subnet_ids,
+ router_ids, network_ids)
# Connect again OVS to Controller
for compute_node in compute_nodes:
compute_node.run_cmd("sudo ovs-vsctl set-controller {} {}".
diff --git a/sdnvpn/test/functest/testcase_12.py b/sdnvpn/test/functest/testcase_12.py
index 53e5ab9..6bb8140 100644
--- a/sdnvpn/test/functest/testcase_12.py
+++ b/sdnvpn/test/functest/testcase_12.py
@@ -32,7 +32,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
openstack_nodes = test_utils.get_nodes()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
@@ -45,9 +44,9 @@ def main():
container="bare", public='public')
image_ids.append(image_id)
- network_1_id = test_utils.create_net(neutron_client,
+ network_1_id = test_utils.create_net(conn,
TESTCASE_CONFIG.net_1_name)
- subnet_1_id = test_utils.create_subnet(neutron_client,
+ subnet_1_id = test_utils.create_subnet(conn,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
network_1_id)
@@ -56,7 +55,7 @@ def main():
subnet_ids.append(subnet_1_id)
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
# Check required number of compute nodes
@@ -186,9 +185,9 @@ def main():
# Cleanup topology
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids, bgpvpn_ids,
- interfaces, subnet_ids, router_ids,
- network_ids)
+ test_utils.cleanup_neutron(conn, neutron_client, floatingip_ids,
+ bgpvpn_ids, interfaces, subnet_ids,
+ router_ids, network_ids)
return results.compile_summary()
diff --git a/sdnvpn/test/functest/testcase_13.py b/sdnvpn/test/functest/testcase_13.py
index 4152c67..e15c8f1 100644
--- a/sdnvpn/test/functest/testcase_13.py
+++ b/sdnvpn/test/functest/testcase_13.py
@@ -36,7 +36,7 @@ def main():
if not os.path.isfile(COMMON_CONFIG.ubuntu_image_path):
logger.info("Downloading image")
image_dest_path = '/'.join(
- COMMON_CONFIG.ubuntu_image_path.split('/')[:-1])
+ COMMON_CONFIG.ubuntu_image_path.split('/')[:-1])
os_utils.download_url(
"http://artifacts.opnfv.org/sdnvpn/"
"ubuntu-16.04-server-cloudimg-amd64-disk1.img",
@@ -45,7 +45,6 @@ def main():
logger.info("Using old image")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
subnet_ids, interfaces, bgpvpn_ids, flavor_ids) = ([] for i in range(9))
@@ -64,7 +63,7 @@ def main():
flavor_ids.append(flavor_id)
network_1_id, subnet_1_id, router_1_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_1_name,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
@@ -76,7 +75,7 @@ def main():
router_ids.extend([router_1_id])
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
compute_nodes = test_utils.assert_and_get_compute_nodes(conn)
@@ -102,13 +101,13 @@ def main():
userdata=u1)
vm_1_ip = test_utils.get_instance_ip(conn, vm_1)
- vm1_port = test_utils.get_port(neutron_client, vm_1.id)
+ vm1_port = test_utils.get_port(conn, vm_1.id)
test_utils.update_port_allowed_address_pairs(
- neutron_client,
- vm1_port['id'],
+ conn,
+ vm1_port.id,
[test_utils.AllowedAddressPair(
TESTCASE_CONFIG.extra_route_cidr,
- vm1_port['mac_address'])])
+ vm1_port.mac_address)])
vm_2 = test_utils.create_instance(
conn,
@@ -122,13 +121,13 @@ def main():
userdata=u1)
vm_2_ip = test_utils.get_instance_ip(conn, vm_2)
- vm2_port = test_utils.get_port(neutron_client, vm_2.id)
+ vm2_port = test_utils.get_port(conn, vm_2.id)
test_utils.update_port_allowed_address_pairs(
- neutron_client,
- vm2_port['id'],
+ conn,
+ vm2_port.id,
[test_utils.AllowedAddressPair(
TESTCASE_CONFIG.extra_route_cidr,
- vm2_port['mac_address'])])
+ vm2_port.mac_address)])
test_utils.async_Wait_for_instances([vm_1, vm_2])
@@ -184,7 +183,7 @@ def main():
neutron_client, bgpvpn_id, router_1_id)
test_utils.update_router_extra_route(
- neutron_client, router_1_id,
+ conn, router_1_id,
[test_utils.ExtraRoute(TESTCASE_CONFIG.extra_route_cidr,
vm_1_ip),
test_utils.ExtraRoute(TESTCASE_CONFIG.extra_route_cidr,
@@ -207,10 +206,10 @@ def main():
logger.error("exception occurred while executing testcase_13: %s", e)
raise
finally:
- test_utils.update_router_no_extra_route(neutron_client, router_ids)
+ test_utils.update_router_no_extra_route(conn, router_ids)
test_utils.cleanup_nova(conn, instance_ids, flavor_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids,
+ test_utils.cleanup_neutron(conn, 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 12f3cc4..b4f05b2 100644
--- a/sdnvpn/test/functest/testcase_2.py
+++ b/sdnvpn/test/functest/testcase_2.py
@@ -34,7 +34,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
subnet_ids, interfaces, bgpvpn_ids) = ([] for i in range(8))
@@ -55,31 +54,31 @@ def main():
image_ids.append(image_id)
network_1_id = test_utils.create_net(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_1_name)
subnet_1a_id = test_utils.create_subnet(
- neutron_client,
+ conn,
TESTCASE_CONFIG.subnet_1a_name,
TESTCASE_CONFIG.subnet_1a_cidr,
network_1_id)
# TODO: uncomment the commented lines once ODL has
# support for mulitple subnets under same neutron network
# subnet_1b_id = test_utils.create_subnet(
- # neutron_client,
+ # conn,
# TESTCASE_CONFIG.subnet_1b_name,
# TESTCASE_CONFIG.subnet_1b_cidr,
# network_1_id)
network_2_id = test_utils.create_net(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_2_name)
# subnet_2a_id = test_utils.create_subnet(
- # neutron_client,
+ # conn,
# TESTCASE_CONFIG.subnet_2a_name,
# TESTCASE_CONFIG.subnet_2a_cidr,
# network_2_id)
subnet_2b_id = test_utils.create_subnet(
- neutron_client,
+ conn,
TESTCASE_CONFIG.subnet_2b_name,
TESTCASE_CONFIG.subnet_2b_cidr,
network_2_id)
@@ -90,7 +89,7 @@ def main():
subnet_2b_id])
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
compute_nodes = test_utils.assert_and_get_compute_nodes(conn)
@@ -271,7 +270,7 @@ def main():
finally:
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids,
+ test_utils.cleanup_neutron(conn, 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 796feeb..2a3a530 100644
--- a/sdnvpn/test/functest/testcase_3.py
+++ b/sdnvpn/test/functest/testcase_3.py
@@ -172,7 +172,7 @@ def main():
if not os.path.isfile(COMMON_CONFIG.ubuntu_image_path):
logger.info("Downloading image")
image_dest_path = '/'.join(
- COMMON_CONFIG.ubuntu_image_path.split('/')[:-1])
+ COMMON_CONFIG.ubuntu_image_path.split('/')[:-1])
os_utils.download_url(
"http://artifacts.opnfv.org/sdnvpn/"
"ubuntu-16.04-server-cloudimg-amd64-disk1.img",
@@ -180,7 +180,6 @@ def main():
else:
logger.info("Using old image")
- conn = os_utils.get_os_connection()
neutron_client = os_utils.get_neutron_client()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
@@ -193,12 +192,12 @@ def main():
flavor_ids.append(flavor_id)
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
- test_utils.open_icmp(neutron_client, sg_id)
- test_utils.open_http_port(neutron_client, sg_id)
+ test_utils.open_icmp(conn, sg_id)
+ test_utils.open_http_port(conn, sg_id)
- test_utils.open_bgp_port(neutron_client, sg_id)
+ test_utils.open_bgp_port(conn, sg_id)
image_id = os_utils.create_glance_image(
conn, TESTCASE_CONFIG.image_name,
@@ -207,7 +206,7 @@ def main():
image_ids.append(image_id)
net_1_id, subnet_1_id, router_1_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_1_name,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
@@ -215,7 +214,7 @@ def main():
quagga_net_id, subnet_quagga_id, \
router_quagga_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.quagga_net_name,
TESTCASE_CONFIG.quagga_subnet_name,
TESTCASE_CONFIG.quagga_subnet_cidr,
@@ -256,7 +255,7 @@ def main():
# cloud-init script.
# fake_fip is needed to bypass NAT
# see below for the reason why.
- fake_fip = os_utils.create_floating_ip(neutron_client)
+ fake_fip = os_utils.create_floating_ip(conn)
# pin quagga to some compute
floatingip_ids.append(fake_fip['fip_id'])
compute_node = conn.compute.hypervisors().next()
@@ -290,16 +289,16 @@ def main():
instance_ids.append(quagga_vm.id)
- quagga_vm_port = test_utils.get_port(neutron_client,
+ quagga_vm_port = test_utils.get_port(conn,
quagga_vm.id)
- fip_added = os_utils.attach_floating_ip(neutron_client,
- quagga_vm_port['id'])
+ fip_added = os_utils.attach_floating_ip(conn,
+ quagga_vm_port.id)
msg = ("Assign a Floating IP to %s " %
TESTCASE_CONFIG.quagga_instance_name)
if fip_added:
results.add_success(msg)
- floatingip_ids.append(fip_added['floatingip']['id'])
+ floatingip_ids.append(fip_added.id)
else:
results.add_failure(msg)
@@ -412,7 +411,7 @@ def main():
test_utils.detach_instance_from_ext_br(quagga_vm, compute)
test_utils.cleanup_nova(conn, instance_ids, flavor_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids,
+ test_utils.cleanup_neutron(conn, neutron_client, floatingip_ids,
bgpvpn_ids, interfaces, subnet_ids,
router_ids, network_ids)
if fake_fip is not None:
diff --git a/sdnvpn/test/functest/testcase_4.py b/sdnvpn/test/functest/testcase_4.py
index 4c7cc40..650a88a 100644
--- a/sdnvpn/test/functest/testcase_4.py
+++ b/sdnvpn/test/functest/testcase_4.py
@@ -34,7 +34,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
subnet_ids, interfaces, bgpvpn_ids) = ([] for i in range(8))
@@ -47,18 +46,18 @@ def main():
image_ids.append(image_id)
network_1_id, subnet_1_id, router_1_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_1_name,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
TESTCASE_CONFIG.router_1_name)
network_2_id = test_utils.create_net(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_2_name)
subnet_2_id = test_utils.create_subnet(
- neutron_client,
+ conn,
TESTCASE_CONFIG.subnet_2_name,
TESTCASE_CONFIG.subnet_2_cidr,
network_2_id)
@@ -68,7 +67,7 @@ def main():
subnet_ids.extend([subnet_1_id, subnet_2_id])
sg_id = os_utils.create_security_group_full(
- neutron_client,
+ conn,
TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
@@ -260,7 +259,7 @@ def main():
finally:
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids,
+ test_utils.cleanup_neutron(conn, 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 715b55a..e588b14 100644
--- a/sdnvpn/test/functest/testcase_7.py
+++ b/sdnvpn/test/functest/testcase_7.py
@@ -43,7 +43,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
subnet_ids, interfaces, bgpvpn_ids) = ([] for i in range(8))
@@ -56,14 +55,14 @@ def main():
image_ids.append(image_id)
network_1_id, subnet_1_id, router_1_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_1_name,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
TESTCASE_CONFIG.router_1_name)
network_2_id, subnet_2_id, router_2_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_2_name,
TESTCASE_CONFIG.subnet_2_name,
TESTCASE_CONFIG.subnet_2_cidr,
@@ -76,10 +75,10 @@ def main():
subnet_ids.extend([subnet_1_id, subnet_2_id])
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
- test_utils.open_icmp(neutron_client, sg_id)
- test_utils.open_http_port(neutron_client, sg_id)
+ test_utils.open_icmp(conn, sg_id)
+ test_utils.open_http_port(conn, sg_id)
vm_2 = test_utils.create_instance(
conn,
@@ -151,18 +150,16 @@ def main():
results.record_action(msg)
results.add_to_summary(0, '-')
- vm2_port = test_utils.get_port(neutron_client,
- vm_2.id)
- fip_added = os_utils.attach_floating_ip(neutron_client,
- vm2_port['id'])
+ vm2_port = test_utils.get_port(conn, vm_2.id)
+ fip_added = os_utils.attach_floating_ip(conn, vm2_port.id)
if fip_added:
results.add_success(msg)
else:
results.add_failure(msg)
- results.ping_ip_test(fip_added['floatingip']['floating_ip_address'])
+ results.ping_ip_test(fip_added.floating_ip_address)
- floatingip_ids.append(fip_added['floatingip']['id'])
+ floatingip_ids.append(fip_added.id)
except Exception as e:
logger.error("exception occurred while executing testcase_7: %s", e)
@@ -170,7 +167,7 @@ def main():
finally:
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids,
+ test_utils.cleanup_neutron(conn, 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 adf09e4..26d1f35 100644
--- a/sdnvpn/test/functest/testcase_8.py
+++ b/sdnvpn/test/functest/testcase_8.py
@@ -41,7 +41,6 @@ def main():
results.add_to_summary(0, "=")
neutron_client = os_utils.get_neutron_client()
- conn = os_utils.get_os_connection()
(floatingip_ids, instance_ids, router_ids, network_ids, image_ids,
subnet_ids, interfaces, bgpvpn_ids) = ([] for i in range(8))
@@ -54,14 +53,14 @@ def main():
image_ids.append(image_id)
network_1_id, subnet_1_id, router_1_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_1_name,
TESTCASE_CONFIG.subnet_1_name,
TESTCASE_CONFIG.subnet_1_cidr,
TESTCASE_CONFIG.router_1_name)
network_2_id, subnet_2_id, router_1_id = test_utils.create_network(
- neutron_client,
+ conn,
TESTCASE_CONFIG.net_2_name,
TESTCASE_CONFIG.subnet_2_name,
TESTCASE_CONFIG.subnet_2_cidr,
@@ -74,10 +73,10 @@ def main():
subnet_ids.extend([subnet_1_id, subnet_2_id])
sg_id = os_utils.create_security_group_full(
- neutron_client, TESTCASE_CONFIG.secgroup_name,
+ conn, TESTCASE_CONFIG.secgroup_name,
TESTCASE_CONFIG.secgroup_descr)
- test_utils.open_icmp(neutron_client, sg_id)
- test_utils.open_http_port(neutron_client, sg_id)
+ test_utils.open_icmp(conn, sg_id)
+ test_utils.open_http_port(conn, sg_id)
compute_nodes = test_utils.assert_and_get_compute_nodes(conn)
av_zone_1 = "nova:" + compute_nodes[0]
@@ -154,23 +153,22 @@ def main():
msg = "Assign a Floating IP to %s" % vm_1.name
results.record_action(msg)
- vm1_port = test_utils.get_port(neutron_client, vm_1.id)
- fip_added = os_utils.attach_floating_ip(neutron_client,
- vm1_port['id'])
+ vm1_port = test_utils.get_port(conn, vm_1.id)
+ fip_added = os_utils.attach_floating_ip(conn, vm1_port.id)
if fip_added:
results.add_success(msg)
else:
results.add_failure(msg)
- fip = fip_added['floatingip']['floating_ip_address']
+ fip = fip_added.floating_ip_address
results.add_to_summary(0, "=")
results.record_action("Ping %s via Floating IP" % vm_1.name)
results.add_to_summary(0, "-")
results.ping_ip_test(fip)
- floatingip_ids.append(fip_added['floatingip']['id'])
+ floatingip_ids.append(fip_added.id)
except Exception as e:
logger.error("exception occurred while executing testcase_8: %s", e)
@@ -178,7 +176,7 @@ def main():
finally:
test_utils.cleanup_nova(conn, instance_ids)
test_utils.cleanup_glance(conn, image_ids)
- test_utils.cleanup_neutron(neutron_client, floatingip_ids,
+ test_utils.cleanup_neutron(conn, neutron_client, floatingip_ids,
bgpvpn_ids, interfaces, subnet_ids,
router_ids, network_ids)