diff options
author | Stamatis Katsaounis <mokats@intracom-telecom.com> | 2018-09-06 14:44:48 +0300 |
---|---|---|
committer | Stamatis Katsaounis <mokats@intracom-telecom.com> | 2018-11-01 16:25:02 +0200 |
commit | 72eb4c28889c56340c7ae222c8199e564ba46e41 (patch) | |
tree | 2d935a4bf48d211c664945a6fa50c1d25f2d7684 /sdnvpn/test/functest/testcase_3.py | |
parent | 93fa759def8b61029ef1bb08b491a66cb7ddeb17 (diff) |
Replace neutron client calls with openstack sdk
JIRA: SDNVPN-237
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>
(cherry picked from commit ebf6885a907379083b360ae729f69151c1dd8115)
Diffstat (limited to 'sdnvpn/test/functest/testcase_3.py')
-rw-r--r-- | sdnvpn/test/functest/testcase_3.py | 27 |
1 files changed, 13 insertions, 14 deletions
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: |