aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xci/prepare_env.py8
-rwxr-xr-xtestcases/OpenStack/tempest/run_tempest.py11
-rwxr-xr-xtestcases/features/promise.py5
-rw-r--r--testcases/vnf/vIMS/orchestrator.py6
-rwxr-xr-xtestcases/vnf/vIMS/vIMS.py31
-rw-r--r--utils/openstack_utils.py37
6 files changed, 66 insertions, 32 deletions
diff --git a/ci/prepare_env.py b/ci/prepare_env.py
index ed6a4ed5f..e31afd495 100755
--- a/ci/prepare_env.py
+++ b/ci/prepare_env.py
@@ -18,6 +18,7 @@ import os
import re
import subprocess
import sys
+import json
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
@@ -206,8 +207,11 @@ def install_rally():
ft_utils.execute_command(cmd, logger=logger, exit_on_error=False,
error_msg=("Deployment %s does not exist."
% DEPLOYMENT_MAME), verbose=False)
-
- cmd = "rally deployment create --fromenv --name=" + DEPLOYMENT_MAME
+ rally_conf = os_utils.get_credentials_for_rally()
+ with open('rally_conf.json', 'w') as fp:
+ json.dump(rally_conf, fp)
+ cmd = "rally deployment create --file=rally_conf.json --name="
+ cmd += DEPLOYMENT_MAME
ft_utils.execute_command(cmd, logger,
error_msg="Problem creating Rally deployment")
diff --git a/testcases/OpenStack/tempest/run_tempest.py b/testcases/OpenStack/tempest/run_tempest.py
index 8ca3bdb3f..f99678df4 100755
--- a/testcases/OpenStack/tempest/run_tempest.py
+++ b/testcases/OpenStack/tempest/run_tempest.py
@@ -193,6 +193,17 @@ def configure_tempest(deployment_dir):
config.set('identity', 'tenant_name', TENANT_NAME)
config.set('identity', 'username', USER_NAME)
config.set('identity', 'password', USER_PASSWORD)
+
+ if os.getenv('OS_ENDPOINT_TYPE') is not None:
+ services_list = ['compute', 'volume', 'image', 'network',
+ 'data-processing', 'object-storage', 'orchestration']
+ sections = config.sections()
+ for service in services_list:
+ if service not in sections:
+ config.add_section(service)
+ config.set(service, 'endpoint_type',
+ os.environ.get("OS_ENDPOINT_TYPE"))
+
with open(tempest_conf_file, 'wb') as config_file:
config.write(config_file)
diff --git a/testcases/features/promise.py b/testcases/features/promise.py
index 564f94709..74c1ad782 100755
--- a/testcases/features/promise.py
+++ b/testcases/features/promise.py
@@ -18,7 +18,6 @@ import time
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as functest_utils
import functest.utils.openstack_utils as openstack_utils
-import glanceclient.client as glclient
import keystoneclient.v2_0.client as ksclient
from neutronclient.v2_0 import client as ntclient
import novaclient.client as nvclient
@@ -134,9 +133,7 @@ def main():
"project_id": TENANT_NAME,
})
- glance_endpoint = keystone.service_catalog.url_for(
- service_type='image', endpoint_type='publicURL')
- glance = glclient.Client(1, glance_endpoint, token=keystone.auth_token)
+ glance = openstack_utils.get_glance_client()
nova = nvclient.Client("2", **nv_creds)
logger.info("Creating image '%s' from '%s'..." % (IMAGE_NAME,
diff --git a/testcases/vnf/vIMS/orchestrator.py b/testcases/vnf/vIMS/orchestrator.py
index 7917e77e7..d88efe9b3 100644
--- a/testcases/vnf/vIMS/orchestrator.py
+++ b/testcases/vnf/vIMS/orchestrator.py
@@ -46,6 +46,12 @@ class orchestrator:
def set_ssh_user(self, ssh_user):
self.config['ssh_user'] = ssh_user
+ def set_nova_url(self, nova_url):
+ self.config['nova_url'] = nova_url
+
+ def set_neutron_url(self, neutron_url):
+ self.config['neutron_url'] = neutron_url
+
def set_nameservers(self, nameservers):
if 0 < len(nameservers):
self.config['dns_subnet_1'] = nameservers[0]
diff --git a/testcases/vnf/vIMS/vIMS.py b/testcases/vnf/vIMS/vIMS.py
index 20a61158e..790bfa0cc 100755
--- a/testcases/vnf/vIMS/vIMS.py
+++ b/testcases/vnf/vIMS/vIMS.py
@@ -22,7 +22,6 @@ import time
import yaml
import keystoneclient.v2_0.client as ksclient
-import glanceclient.client as glclient
import novaclient.client as nvclient
from neutronclient.v2_0 import client as ntclient
@@ -316,9 +315,7 @@ def main():
})
logger.info("Upload some OS images if it doesn't exist")
- glance_endpoint = keystone.service_catalog.url_for(
- service_type='image', endpoint_type='publicURL')
- glance = glclient.Client(1, glance_endpoint, token=keystone.auth_token)
+ glance = os_utils.get_glance_client()
for img in IMAGES.keys():
image_name = IMAGES[img]['image_name']
@@ -347,36 +344,25 @@ def main():
"init",
"Failed to update security group quota for tenant " + TENANT_NAME)
- logger.info("Update cinder quota for this tenant")
- from cinderclient import client as cinderclient
-
- creds_cinder = os_utils.get_credentials("cinder")
- cinder_client = cinderclient.Client('1', creds_cinder['username'],
- creds_cinder['api_key'],
- creds_cinder['project_id'],
- creds_cinder['auth_url'],
- service_type="volume")
- if not os_utils.update_cinder_quota(cinder_client, tenant_id, 20, 10, 150):
- step_failure(
- "init", "Failed to update cinder quota for tenant " + TENANT_NAME)
-
# ############### CLOUDIFY INITIALISATION ################
+ public_auth_url = keystone.service_catalog.url_for(
+ service_type='identity', endpoint_type='publicURL')
cfy = orchestrator(VIMS_DATA_DIR, CFY_INPUTS, logger)
cfy.set_credentials(username=ks_creds['username'], password=ks_creds[
'password'], tenant_name=ks_creds['tenant_name'],
- auth_url=ks_creds['auth_url'])
+ auth_url=public_auth_url)
logger.info("Collect flavor id for cloudify manager server")
nova = nvclient.Client("2", **nv_creds)
- flavor_name = "m1.medium"
+ flavor_name = "m1.large"
flavor_id = os_utils.get_flavor_id(nova, flavor_name)
for requirement in CFY_MANAGER_REQUIERMENTS:
if requirement == 'ram_min':
flavor_id = os_utils.get_flavor_id_by_ram_range(
- nova, CFY_MANAGER_REQUIERMENTS['ram_min'], 8196)
+ nova, CFY_MANAGER_REQUIERMENTS['ram_min'], 10000)
if flavor_id == '':
logger.error(
@@ -414,6 +400,11 @@ def main():
if ns:
cfy.set_nameservers(ns)
+ if 'compute' in nova.client.services_url:
+ cfy.set_nova_url(nova.client.services_url['compute'])
+ if neutron.httpclient.endpoint_url is not None:
+ cfy.set_neutron_url(neutron.httpclient.endpoint_url)
+
logger.info("Prepare virtualenv for cloudify-cli")
cmd = "chmod +x " + VIMS_DIR + "create_venv.sh"
functest_utils.execute_command(cmd, logger)
diff --git a/utils/openstack_utils.py b/utils/openstack_utils.py
index d14828dbb..75f06046a 100644
--- a/utils/openstack_utils.py
+++ b/utils/openstack_utils.py
@@ -70,6 +70,10 @@ def get_credentials(service):
"auth_url": os.environ.get("OS_AUTH_URL"),
tenant: os.environ.get("OS_TENANT_NAME")
})
+ if os.getenv('OS_ENDPOINT_TYPE') is not None:
+ creds.update({
+ "endpoint_type": os.environ.get("OS_ENDPOINT_TYPE")
+ })
cacert = os.environ.get("OS_CACERT")
if cacert is not None:
# each openstack client uses differnt kwargs for this
@@ -94,6 +98,24 @@ def source_credentials(rc_file):
return env
+def get_credentials_for_rally():
+ creds = get_credentials("keystone")
+ admin_keys = ['username', 'tenant_name', 'password']
+ endpoint_types = [('internalURL', 'internal'),
+ ('publicURL', 'public'), ('adminURL', 'admin')]
+ if 'endpoint_type' in creds.keys():
+ for k, v in endpoint_types:
+ if creds['endpoint_type'] == k:
+ creds['endpoint_type'] = v
+ rally_conf = {"type": "ExistingCloud", "admin": {}}
+ for key in creds:
+ if key in admin_keys:
+ rally_conf['admin'][key] = creds[key]
+ else:
+ rally_conf[key] = creds[key]
+ return rally_conf
+
+
# *********************************************
# CLIENTS
# *********************************************
@@ -109,11 +131,10 @@ def get_nova_client():
def get_cinder_client():
creds_cinder = get_credentials("cinder")
- return cinderclient.Client('2', creds_cinder['username'],
- creds_cinder['api_key'],
- creds_cinder['project_id'],
- creds_cinder['auth_url'],
- service_type="volume")
+ creds_cinder.update({
+ "service_type": "volume"
+ })
+ return cinderclient.Client('2', **creds_cinder)
def get_neutron_client():
@@ -123,8 +144,12 @@ def get_neutron_client():
def get_glance_client():
keystone_client = get_keystone_client()
+ glance_endpoint_type = 'publicURL'
+ os_endpoint_type = os.getenv('OS_ENDPOINT_TYPE')
+ if os_endpoint_type is not None:
+ glance_endpoint_type = os_endpoint_type
glance_endpoint = keystone_client.service_catalog.url_for(
- service_type='image', endpoint_type='publicURL')
+ service_type='image', endpoint_type=glance_endpoint_type)
return glanceclient.Client(1, glance_endpoint,
token=keystone_client.auth_token)