aboutsummaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
Diffstat (limited to 'functest')
-rwxr-xr-xfunctest/ci/check_os.sh29
-rwxr-xr-xfunctest/ci/config_functest.yaml2
-rwxr-xr-xfunctest/ci/prepare_env.py2
-rw-r--r--functest/opnfv_tests/features/odl_sfc.py6
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/refstack_client.py29
-rw-r--r--functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt16
-rw-r--r--functest/opnfv_tests/openstack/tempest/tempest.py2
-rwxr-xr-xfunctest/opnfv_tests/vnf/ims/orchestra_ims.py8
-rw-r--r--functest/tests/unit/utils/test_openstack_utils.py6
-rw-r--r--functest/utils/decorators.py9
-rw-r--r--functest/utils/functest_logger.py13
-rw-r--r--functest/utils/openstack_utils.py17
12 files changed, 108 insertions, 31 deletions
diff --git a/functest/ci/check_os.sh b/functest/ci/check_os.sh
index 2c5c021c..3920b7ac 100755
--- a/functest/ci/check_os.sh
+++ b/functest/ci/check_os.sh
@@ -26,6 +26,11 @@ verify_connectivity() {
return 1
}
+verify_SSL_connectivity() {
+ openssl s_client -connect $1:$2 &>/dev/null
+ return $?
+}
+
check_service() {
local service cmd
service=$1
@@ -63,10 +68,16 @@ fi
echo "Checking OpenStack endpoints:"
publicURL=$(openstack catalog show identity |awk '/public/ {print $4}')
-publicIP=$(echo $publicURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//')
+publicIP=$(echo $publicURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
publicPort=$(echo $publicURL|sed 's/^.*://'|sed 's/\/.*$//')
-echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..."
-verify_connectivity $publicIP $publicPort
+https_enabled=$(echo $publicURL | grep 'https')
+if [[ -n $https_enabled ]]; then
+ echo ">>Verifying SSL connectivity to the public endpoint $publicIP:$publicPort..."
+ verify_SSL_connectivity $publicIP $publicPort
+else
+ echo ">>Verifying connectivity to the public endpoint $publicIP:$publicPort..."
+ verify_connectivity $publicIP $publicPort
+fi
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "ERROR: Cannot talk to the public endpoint $publicIP:$publicPort ."
@@ -81,10 +92,16 @@ if [ -z ${adminURL} ]; then
openstack catalog show identity
exit 1
fi
-adminIP=$(echo $adminURL|sed 's/^.*http\:\/\///'|sed 's/.[^:]*$//')
+adminIP=$(echo $adminURL|sed 's/^.*http.*\:\/\///'|sed 's/.[^:]*$//')
adminPort=$(echo $adminURL|sed 's/^.*://'|sed 's/.[^\/]*$//')
-echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
-verify_connectivity $adminIP $adminPort
+https_enabled=$(echo $adminURL | grep 'https')
+if [[ -n $https_enabled ]]; then
+ echo ">>Verifying SSL connectivity to the admin endpoint $adminIP:$adminPort..."
+ verify_SSL_connectivity $adminIP $adminPort
+else
+ echo ">>Verifying connectivity to the admin endpoint $adminIP:$adminPort..."
+ verify_connectivity $adminIP $adminPort
+fi
RETVAL=$?
if [ $RETVAL -ne 0 ]; then
echo "ERROR: Cannot talk to the admin endpoint $adminIP:$adminPort ."
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index 4d5a6217..78f6257c 100755
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -200,4 +200,6 @@ example:
sg_desc: Example Security group
results:
+ # you can also set a dir (e.g. /home/opnfv/db) to dump results
+ # test_db_url: file:///home/opnfv/db
test_db_url: http://testresults.opnfv.org/test/api/v1
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index 724ea14d..e9a470f9 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -312,7 +312,7 @@ def install_tempest():
logger.debug("Tempest %s does not exist" %
CONST.tempest_deployment_name)
cmd = ("rally verify create-verifier --source {0} "
- "--name {1} --type tempest"
+ "--name {1} --type tempest --system-wide"
.format(CONST.dir_repo_tempest,
CONST.tempest_deployment_name))
error_msg = "Problem while installing Tempest."
diff --git a/functest/opnfv_tests/features/odl_sfc.py b/functest/opnfv_tests/features/odl_sfc.py
index 1956c9c8..431cd47e 100644
--- a/functest/opnfv_tests/features/odl_sfc.py
+++ b/functest/opnfv_tests/features/odl_sfc.py
@@ -8,6 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import functest.core.feature_base as base
+from sfc.tests.functest import run_tests
class OpenDaylightSFC(base.FeatureBase):
@@ -16,5 +17,6 @@ class OpenDaylightSFC(base.FeatureBase):
super(OpenDaylightSFC, self).__init__(project='sfc',
case='functest-odl-sfc',
repo='dir_repo_sfc')
- dir_sfc_functest = '{}/sfc/tests/functest'.format(self.repo)
- self.cmd = 'cd %s && python ./run_tests.py' % dir_sfc_functest
+
+ def execute(self):
+ return run_tests.main()
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
index 7d4c568a..4312b7f9 100755
--- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
+++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py
@@ -69,8 +69,8 @@ class RefstackClient(testcase_base.TestcaseBase):
self.defcorelist))
logger.info("Starting Refstack_defcore test case: '%s'." % cmd)
- header = ("Tempest environment:\n"
- " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" %
+ header = ("Refstack environment:\n"
+ " SUT: %s\n Scenario: %s\n Node: %s\n Date: %s\n" %
(CONST.INSTALLER_TYPE,
CONST.DEPLOY_SCENARIO,
CONST.NODE_NAME,
@@ -79,26 +79,23 @@ class RefstackClient(testcase_base.TestcaseBase):
f_stdout = open(
os.path.join(conf_utils.REFSTACK_RESULTS_DIR,
"refstack.log"), 'w+')
- f_stderr = open(
- os.path.join(conf_utils.REFSTACK_RESULTS_DIR,
- "refstack-error.log"), 'w+')
f_env = open(os.path.join(conf_utils.REFSTACK_RESULTS_DIR,
"environment.log"), 'w+')
f_env.write(header)
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE,
- stderr=f_stderr, bufsize=1)
+ stderr=subprocess.STDOUT, bufsize=1)
with p.stdout:
for line in iter(p.stdout.readline, b''):
if 'Tests' in line:
break
- logger.info(line.replace('\n', ''))
+ if re.search("\} tempest\.", line):
+ logger.info(line.replace('\n', ''))
f_stdout.write(line)
p.wait()
f_stdout.close()
- f_stderr.close()
f_env.close()
def parse_refstack_result(self):
@@ -110,12 +107,16 @@ class RefstackClient(testcase_base.TestcaseBase):
for match in re.findall("Ran: (\d+) tests in (\d+\.\d{4}) sec.",
output):
num_tests = match[0]
- for match in re.findall("- Passed: (\d+)", output):
- num_success = match
- for match in re.findall("- Skipped: (\d+)", output):
- num_skipped = match
- for match in re.findall("- Failed: (\d+)", output):
- num_failures = match
+ logger.info("Ran: %s tests in %s sec." % (num_tests, match[1]))
+ for match in re.findall("(- Passed: )(\d+)", output):
+ num_success = match[1]
+ logger.info("".join(match))
+ for match in re.findall("(- Skipped: )(\d+)", output):
+ num_skipped = match[1]
+ logger.info("".join(match))
+ for match in re.findall("(- Failed: )(\d+)", output):
+ num_failures = match[1]
+ logger.info("".join(match))
success_testcases = ""
for match in re.findall(r"\{0\}(.*?)[. ]*ok", output):
success_testcases += match + ", "
diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt
index fcdfe225..43edabc1 100644
--- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt
+++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt
@@ -55,3 +55,19 @@
- tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
- tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern
- tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern
+
+-
+ # https://bugs.launchpad.net/tempest/+bug/1577632
+ scenarios:
+ - os-odl_l2-nofeature-ha
+ - os-odl_l2-nofeature-noha
+ - os-odl_l2-sfc-ha
+ - os-odl_l2-sfc-noha
+ - os-odl_l2-bgpvpn-ha
+ - os-odl_l2-bgpvpn-noha
+ - os-odl_l3-nofeature-ha
+ - os-odl_l3-nofeature-noha
+ installers:
+ - fuel
+ tests:
+ - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops
diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py
index d3b15926..54556a32 100644
--- a/functest/opnfv_tests/openstack/tempest/tempest.py
+++ b/functest/opnfv_tests/openstack/tempest/tempest.py
@@ -116,7 +116,7 @@ class TempestCommon(testcase_base.TestcaseBase):
logger.info("Starting Tempest test suite: '%s'." % cmd_line)
header = ("Tempest environment:\n"
- " Installer: %s\n Scenario: %s\n Node: %s\n Date: %s\n" %
+ " SUT: %s\n Scenario: %s\n Node: %s\n Date: %s\n" %
(CONST.INSTALLER_TYPE,
CONST.DEPLOY_SCENARIO,
CONST.NODE_NAME,
diff --git a/functest/opnfv_tests/vnf/ims/orchestra_ims.py b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
index d13fe8fe..5c19be09 100755
--- a/functest/opnfv_tests/vnf/ims/orchestra_ims.py
+++ b/functest/opnfv_tests/vnf/ims/orchestra_ims.py
@@ -311,10 +311,16 @@ class ImsVnf(vnf_base.VnfOnBoardingBase):
creds = os_utils.get_credentials()
self.logger.info("PoP creds: %s" % creds)
+ project_id = os_utils.get_tenant_id(
+ os_utils.get_keystone_client(),
+ creds.get("project_name"))
+
+ self.logger.debug("project id: %s" % project_id)
+
vim_json = {
"name": "vim-instance",
"authUrl": creds.get("auth_url"),
- "tenant": os.environ.get("OS_PROJECT_ID"),
+ "tenant": project_id,
"username": creds.get("username"),
"password": creds.get("password"),
"securityGroups": [
diff --git a/functest/tests/unit/utils/test_openstack_utils.py b/functest/tests/unit/utils/test_openstack_utils.py
index ef3764cc..673ad5e2 100644
--- a/functest/tests/unit/utils/test_openstack_utils.py
+++ b/functest/tests/unit/utils/test_openstack_utils.py
@@ -28,7 +28,8 @@ class OSUtilsTesting(unittest.TestCase):
'OS_PROJECT_DOMAIN_NAME': os_prefix + 'project_domain_name',
'OS_PROJECT_NAME': os_prefix + 'project_name',
'OS_ENDPOINT_TYPE': os_prefix + 'endpoint_type',
- 'OS_REGION_NAME': os_prefix + 'region_name'}
+ 'OS_REGION_NAME': os_prefix + 'region_name',
+ 'OS_CACERT': os_prefix + 'https_cacert'}
def _get_os_env_vars(self):
return {'username': 'test_username', 'password': 'test_password',
@@ -37,7 +38,8 @@ class OSUtilsTesting(unittest.TestCase):
'project_domain_name': 'test_project_domain_name',
'project_name': 'test_project_name',
'endpoint_type': 'test_endpoint_type',
- 'region_name': 'test_region_name'}
+ 'region_name': 'test_region_name',
+ 'https_cacert': 'test_https_cacert'}
def setUp(self):
self.env_vars = ['OS_AUTH_URL', 'OS_USERNAME', 'OS_PASSWORD']
diff --git a/functest/utils/decorators.py b/functest/utils/decorators.py
index 99bcef3e..276235d9 100644
--- a/functest/utils/decorators.py
+++ b/functest/utils/decorators.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
+import errno
import mock
+import os
import requests.sessions
import urlparse
@@ -10,7 +12,12 @@ def can_dump_request_to_file(method):
def dump_preparedrequest(request, **kwargs):
parseresult = urlparse.urlparse(request.url)
if parseresult.scheme == "file":
- with open(parseresult.path.replace('/results', ''), 'a') as f:
+ try:
+ os.makedirs(parseresult.path)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise
+ with open(os.path.join(parseresult.path, 'dump.txt'), 'a') as f:
headers = ""
for key in request.headers:
headers += key + " " + request.headers[key] + "\n"
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py
index 022211cb..555e9c28 100644
--- a/functest/utils/functest_logger.py
+++ b/functest/utils/functest_logger.py
@@ -28,13 +28,24 @@ import json
from functest.utils.constants import CONST
+ignore = ["paramiko",
+ "stevedore.extension",
+ "keystoneauth.session",
+ "keystoneauth.identity.v3.base",
+ "novaclient.v2.client",
+ "neutronclient.v2_0.client",
+ "glanceclient.common.http",
+ "cinderclient.v2.client",
+ "cinderclient.client"]
+
class Logger(object):
def __init__(self, logger_name):
self.setup_logging()
self.logger = logging.getLogger(logger_name)
- logging.getLogger("paramiko").setLevel(logging.WARNING)
+ for module_name in ignore:
+ logging.getLogger(module_name).setLevel(logging.WARNING)
def getLogger(self):
return self.logger
diff --git a/functest/utils/openstack_utils.py b/functest/utils/openstack_utils.py
index e33af63b..ffc870f6 100644
--- a/functest/utils/openstack_utils.py
+++ b/functest/utils/openstack_utils.py
@@ -82,7 +82,8 @@ def get_env_cred_dict():
'OS_PROJECT_DOMAIN_NAME': 'project_domain_name',
'OS_PROJECT_NAME': 'project_name',
'OS_ENDPOINT_TYPE': 'endpoint_type',
- 'OS_REGION_NAME': 'region_name'
+ 'OS_REGION_NAME': 'region_name',
+ 'OS_CACERT': 'https_cacert'
}
return env_cred_dict
@@ -149,6 +150,11 @@ def get_credentials_for_rally():
if region_name is not None:
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
return rally_conf
@@ -168,7 +174,14 @@ def get_endpoint(service_type, endpoint_type='publicURL'):
def get_session(other_creds={}):
auth = get_session_auth(other_creds)
- return session.Session(auth=auth)
+ cacert = os.getenv('OS_CACERT')
+ if cacert is not None:
+ if not os.path.isfile(cacert):
+ raise Exception("The 'OS_CACERT' environment"
+ "variable is set to %s but the file"
+ "does not exist.", cacert)
+
+ return session.Session(auth=auth, verify=cacert)
# *********************************************