aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests
diff options
context:
space:
mode:
Diffstat (limited to 'functest/opnfv_tests')
-rw-r--r--functest/opnfv_tests/openstack/snaps/smoke.py2
-rwxr-xr-xfunctest/opnfv_tests/openstack/vping/vping_base.py43
-rwxr-xr-xfunctest/opnfv_tests/vnf/ims/vims.py51
3 files changed, 38 insertions, 58 deletions
diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py
index f66c17ff..691f8138 100644
--- a/functest/opnfv_tests/openstack/snaps/smoke.py
+++ b/functest/opnfv_tests/openstack/snaps/smoke.py
@@ -33,7 +33,7 @@ class SnapsSmoke(PyTestSuiteRunner):
# SNAPS repository and are found relative to that path
if use_fip:
snaps_dir = ft_utils.get_functest_config(
- 'general.directories.dir_repo_snaps') + '/snaps'
+ 'general.dir.dir_repo_snaps') + '/snaps'
os.chdir(snaps_dir)
test_suite_builder.add_openstack_integration_tests(
diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py
index e467dd9f..a5309bd4 100755
--- a/functest/opnfv_tests/openstack/vping/vping_base.py
+++ b/functest/opnfv_tests/openstack/vping/vping_base.py
@@ -12,43 +12,38 @@ import pprint
import time
from datetime import datetime
-import functest.utils.functest_utils as ft_utils
-import functest.utils.functest_constants as ft_constants
-import functest.utils.openstack_utils as os_utils
import functest.core.testcase_base as testcase_base
+import functest.utils.openstack_utils as os_utils
+from functest.utils.constants import CONST
class VPingBase(testcase_base.TestcaseBase):
def __init__(self):
- def get_conf(parameter):
- return ft_utils.get_functest_config(parameter)
-
super(VPingBase, self).__init__()
self.logger = None
- self.functest_repo = ft_constants.FUNCTEST_REPO_DIR
- self.repo = get_conf('general.directories.dir_vping')
- self.vm1_name = get_conf('vping.vm_name_1')
- self.vm2_name = get_conf('vping.vm_name_2')
+ self.functest_repo = CONST.dir_repo_functest
+ self.repo = CONST.dir_vping
+ self.vm1_name = CONST.vping_vm_name_1
+ self.vm2_name = CONST.vping_vm_name_2
self.vm_boot_timeout = 180
self.vm_delete_timeout = 100
- self.ping_timeout = get_conf('vping.ping_timeout')
+ self.ping_timeout = CONST.vping_ping_timeout
- self.image_name = get_conf('vping.image_name')
- self.image_filename = get_conf('general.openstack.image_file_name')
- self.image_format = get_conf('general.openstack.image_disk_format')
- self.image_path = ("%s/%s" %
- (get_conf('general.directories.dir_functest_data'),
- self.image_filename))
+ self.image_name = CONST.vping_image_name
+ self.image_filename = CONST.openstack_image_file_name
+ self.image_format = CONST.openstack_image_disk_format
+ self.image_path = os.path.join(CONST.dir_functest_data,
+ self.image_filename)
- self.flavor_name = get_conf('vping.vm_flavor')
+ self.flavor_name = CONST.vping_vm_flavor
# NEUTRON Private Network parameters
- self.private_net_name = get_conf('vping.vping_private_net_name')
- self.private_subnet_name = get_conf('vping.vping_private_subnet_name')
- self.private_subnet_cidr = get_conf('vping.vping_private_subnet_cidr')
- self.router_name = get_conf('vping.vping_router_name')
- self.sg_name = get_conf('vping.vping_sg_name')
- self.sg_desc = get_conf('vping.vping_sg_descr')
+ self.private_net_name = CONST.vping_private_net_name
+ self.private_subnet_name = CONST.vping_private_subnet_name
+ self.private_subnet_cidr = CONST.vping_private_subnet_cidr
+ self.router_name = CONST.vping_router_name
+ self.sg_name = CONST.vping_sg_name
+ self.sg_desc = CONST.vping_sg_desc
self.neutron_client = os_utils.get_neutron_client()
self.glance_client = os_utils.get_glance_client()
self.nova_client = os_utils.get_nova_client()
diff --git a/functest/opnfv_tests/vnf/ims/vims.py b/functest/opnfv_tests/vnf/ims/vims.py
index fe888b69..15981f51 100755
--- a/functest/opnfv_tests/vnf/ims/vims.py
+++ b/functest/opnfv_tests/vnf/ims/vims.py
@@ -19,10 +19,7 @@ import subprocess
import time
import argparse
-import keystoneclient.v2_0.client as ksclient
-import novaclient.client as nvclient
import requests
-from neutronclient.v2_0 import client as ntclient
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
@@ -242,17 +239,15 @@ def main():
if not os.path.exists(VIMS_DATA_DIR):
os.makedirs(VIMS_DATA_DIR)
- ks_creds = os_utils.get_credentials("keystone")
- nv_creds = os_utils.get_credentials("nova")
- nt_creds = os_utils.get_credentials("neutron")
+ creds = os_utils.get_credentials()
logger.info("Prepare OpenStack plateform (create tenant and user)")
- keystone = ksclient.Client(**ks_creds)
+ keystone = os_utils.get_keystone_client()
- user_id = os_utils.get_user_id(keystone, ks_creds['username'])
+ user_id = os_utils.get_user_id(keystone, creds['username'])
if user_id == '':
step_failure("init", "Error : Failed to get id of " +
- ks_creds['username'])
+ creds['username'])
tenant_id = os_utils.create_tenant(
keystone, VIMS_TENANT_NAME, VIMS_TENANT_DESCRIPTION)
@@ -271,7 +266,7 @@ def main():
if not os_utils.add_role_user(keystone, user_id, role_id, tenant_id):
logger.error("Error : Failed to add %s on tenant" %
- ks_creds['username'])
+ creds['username'])
user_id = os_utils.create_user(
keystone, VIMS_TENANT_NAME, VIMS_TENANT_NAME, None, tenant_id)
@@ -279,18 +274,10 @@ def main():
logger.error("Error : Failed to create %s user" % VIMS_TENANT_NAME)
logger.info("Update OpenStack creds informations")
- ks_creds.update({
+ creds.update({
"username": VIMS_TENANT_NAME,
"password": VIMS_TENANT_NAME,
- "tenant_name": VIMS_TENANT_NAME,
- })
-
- nt_creds.update({
- "tenant_name": VIMS_TENANT_NAME,
- })
-
- nv_creds.update({
- "project_id": VIMS_TENANT_NAME,
+ "tenant": VIMS_TENANT_NAME,
})
logger.info("Upload some OS images if it doesn't exist")
@@ -314,10 +301,8 @@ def main():
"Error : Failed to find or upload required OS "
"image for this deployment")
- nova = nvclient.Client("2", **nv_creds)
-
logger.info("Update security group quota for this tenant")
- neutron = ntclient.Client(**nt_creds)
+ neutron = os_utils.get_neutron_client(creds)
if not os_utils.update_sg_quota(neutron, tenant_id, 50, 100):
step_failure(
"init",
@@ -325,17 +310,22 @@ def main():
VIMS_TENANT_NAME)
# ############### CLOUDIFY INITIALISATION ################
- public_auth_url = keystone.service_catalog.url_for(
- service_type='identity', endpoint_type='publicURL')
+ public_auth_url = os_utils.get_endpoint('identity')
cfy = Orchestrator(VIMS_DATA_DIR, CFY_INPUTS)
- cfy.set_credentials(username=ks_creds['username'], password=ks_creds[
- 'password'], tenant_name=ks_creds['tenant_name'],
+ if 'tenant_name' in creds.keys():
+ tenant_name = creds['tenant_name']
+ elif 'project_name' in creds.keys():
+ tenant_name = creds['project_name']
+
+ cfy.set_credentials(username=creds['username'],
+ password=creds['password'],
+ tenant_name=tenant_name,
auth_url=public_auth_url)
logger.info("Collect flavor id for cloudify manager server")
- nova = nvclient.Client("2", **nv_creds)
+ nova = os_utils.get_nova_client(creds)
flavor_name = "m1.large"
flavor_id = os_utils.get_flavor_id(nova, flavor_name)
@@ -416,7 +406,6 @@ def main():
cw = Clearwater(CW_INPUTS, cfy, logger)
logger.info("Collect flavor id for all clearwater vm")
- nova = nvclient.Client("2", **nv_creds)
flavor_name = "m1.small"
flavor_id = os_utils.get_flavor_id(nova, flavor_name)
@@ -490,10 +479,6 @@ def main():
if args.noclean:
exit(0)
- ks_creds = os_utils.get_credentials("keystone")
-
- keystone = ksclient.Client(**ks_creds)
-
logger.info("Removing %s tenant .." % CFY_INPUTS['keystone_tenant_name'])
tenant_id = os_utils.get_tenant_id(
keystone, CFY_INPUTS['keystone_tenant_name'])