X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Futils%2Fopenstack_utils.py;h=e7cdfc8625837fbcbfc4139b503acbb29ae0fe2d;hb=7c5786afbd8b63c7ca71961abc52a2477ea03824;hp=a8966264844e34bee3fe1251f76b8e1f31b6a139;hpb=063c8af074a70b0b99c5c90c56d1fef541354192;p=functest.git diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py index a89662648..e7cdfc862 100644 --- a/functest/utils/openstack_utils.py +++ b/functest/utils/openstack_utils.py @@ -82,7 +82,8 @@ def get_env_cred_dict(): 'OS_PROJECT_NAME': 'project_name', 'OS_ENDPOINT_TYPE': 'endpoint_type', 'OS_REGION_NAME': 'region_name', - 'OS_CACERT': 'https_cacert' + 'OS_CACERT': 'https_cacert', + 'OS_INSECURE': 'https_insecure' } return env_cred_dict @@ -150,10 +151,12 @@ def get_credentials_for_rally(): cred_key = env_cred_dict.get('OS_REGION_NAME') rally_conf[cred_key] = region_name - cacert = os.getenv('OS_CACERT') - if cacert is not None: - cred_key = env_cred_dict.get('OS_CACERT') - rally_conf[cred_key] = cacert + cred_key = env_cred_dict.get('OS_CACERT') + rally_conf[cred_key] = os.getenv('OS_CACERT', '') + + insecure_key = env_cred_dict.get('OS_INSECURE') + rally_conf[insecure_key] = os.getenv('OS_INSECURE', '').lower() == 'true' + return rally_conf @@ -422,12 +425,12 @@ def get_or_create_flavor(flavor_name, ram, disk, vcpus, public=True): return flavor_exists, flavor_id -def get_floating_ips(nova_client): +def get_floating_ips(neutron_client): try: - floating_ips = nova_client.floating_ips.list() - return floating_ips + floating_ips = neutron_client.list_floatingips() + return floating_ips['floatingips'] except Exception as e: - logger.error("Error [get_floating_ips(nova_client)]: %s" % e) + logger.error("Error [get_floating_ips(neutron_client)]: %s" % e) return None @@ -590,12 +593,12 @@ def delete_instance(nova_client, instance_id): return False -def delete_floating_ip(nova_client, floatingip_id): +def delete_floating_ip(neutron_client, floatingip_id): try: - nova_client.floating_ips.delete(floatingip_id) + neutron_client.delete_floatingip(floatingip_id) return True except Exception as e: - logger.error("Error [delete_floating_ip(nova_client, '%s')]: %s" + logger.error("Error [delete_floating_ip(neutron_client, '%s')]: %s" % (floatingip_id, e)) return False @@ -1188,9 +1191,9 @@ def delete_security_group(neutron_client, secgroup_id): # ********************************************* # GLANCE # ********************************************* -def get_images(nova_client): +def get_images(glance_client): try: - images = nova_client.images.list() + images = glance_client.images.list() return images except Exception as e: logger.error("Error [get_images]: %s" % e) @@ -1254,12 +1257,12 @@ def get_or_create_image(name, path, format): return image_exists, image_id -def delete_glance_image(nova_client, image_id): +def delete_glance_image(glance_client, image_id): try: - nova_client.images.delete(image_id) + glance_client.images.delete(image_id) return True except Exception as e: - logger.error("Error [delete_glance_image(nova_client, '%s')]: %s" + logger.error("Error [delete_glance_image(glance_client, '%s')]: %s" % (image_id, e)) return False