summaryrefslogtreecommitdiffstats
path: root/functest
diff options
context:
space:
mode:
Diffstat (limited to 'functest')
-rwxr-xr-xfunctest/ci/prepare_env.py53
-rwxr-xr-xfunctest/ci/run_tests.py2
-rwxr-xr-xfunctest/ci/tier_builder.py2
-rwxr-xr-xfunctest/ci/tier_handler.py6
-rw-r--r--functest/cli/commands/cli_env.py2
-rw-r--r--functest/cli/commands/cli_os.py2
-rw-r--r--functest/cli/commands/cli_testcase.py2
-rw-r--r--functest/cli/commands/cli_tier.py2
-rwxr-xr-xfunctest/opnfv_tests/sdn/odl/odl.py2
-rw-r--r--functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py2
-rw-r--r--functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py2
-rw-r--r--functest/opnfv_tests/vnf/ims/clearwater.py2
-rw-r--r--functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py2
-rwxr-xr-xfunctest/utils/functest_logger.py2
-rw-r--r--functest/utils/functest_utils.py7
-rw-r--r--functest/utils/openstack_tacker.py5
16 files changed, 55 insertions, 40 deletions
diff --git a/functest/ci/prepare_env.py b/functest/ci/prepare_env.py
index 80bcfc7db..bec60d13e 100755
--- a/functest/ci/prepare_env.py
+++ b/functest/ci/prepare_env.py
@@ -1,18 +1,11 @@
#!/usr/bin/env python
#
-# Author: Jose Lausuch (jose.lausuch@ericsson.com)
-#
-# Installs the Functest framework within the Docker container
-# and run the tests automatically
-#
-#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
-
import argparse
import json
import os
@@ -44,7 +37,7 @@ with open(CONFIG_PATCH_PATH) as f:
functest_patch_yaml = yaml.safe_load(f)
-class PrepareEnvParser():
+class PrepareEnvParser(object):
def __init__(self):
self.parser = argparse.ArgumentParser()
@@ -224,20 +217,19 @@ def install_rally():
"Deployment %s does not exist."
% CONST.rally_deployment_name),
verbose=False)
+
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={}"
+ "--file=rally_conf.json --name={0}"
.format(CONST.rally_deployment_name))
- ft_utils.execute_command(cmd,
- error_msg=("Problem while creating "
- "Rally deployment"))
+ error_msg = "Problem while creating Rally deployment"
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
cmd = "rally deployment check"
- ft_utils.execute_command(cmd,
- error_msg=("OpenStack not responding or "
- "faulty Rally deployment."))
+ error_msg = "OpenStack not responding or faulty Rally deployment."
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
cmd = "rally deployment list"
ft_utils.execute_command(cmd,
@@ -252,19 +244,30 @@ def install_rally():
def install_tempest():
logger.info("Installing tempest from existing repo...")
- cmd = ("rally verify create-verifier --source {0} "
- "--name {1} --type tempest"
- .format(CONST.dir_repo_tempest, CONST.tempest_deployment_name))
- ft_utils.execute_command(cmd,
- error_msg="Problem while installing Tempest.")
+ cmd = ("rally verify list-verifiers | "
+ "grep '{0}' | wc -l".format(CONST.tempest_deployment_name))
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
+ while p.poll() is None:
+ line = p.stdout.readline().rstrip()
+ if str(line) == '0':
+ logger.debug("Tempest %s does not exist" %
+ CONST.tempest_deployment_name)
+ cmd = ("rally verify create-verifier --source {0} "
+ "--name {1} --type tempest"
+ .format(CONST.dir_repo_tempest,
+ CONST.tempest_deployment_name))
+ error_msg = "Problem while installing Tempest."
+ ft_utils.execute_command_raise(cmd, error_msg=error_msg)
def create_flavor():
- os_utils.get_or_create_flavor('m1.tiny',
- '512',
- '1',
- '1',
- public=True)
+ _, flavor_id = os_utils.get_or_create_flavor('m1.tiny',
+ '512',
+ '1',
+ '1',
+ public=True)
+ if flavor_id is None:
+ raise Exception('Failed to create flavor')
def check_environment():
diff --git a/functest/ci/run_tests.py b/functest/ci/run_tests.py
index 93518de0b..f920e70d8 100755
--- a/functest/ci/run_tests.py
+++ b/functest/ci/run_tests.py
@@ -48,7 +48,7 @@ class BlockingTestFailed(Exception):
pass
-class RunTestsParser():
+class RunTestsParser(object):
def __init__(self):
self.parser = argparse.ArgumentParser()
diff --git a/functest/ci/tier_builder.py b/functest/ci/tier_builder.py
index e1c3e49e6..dae7c73e8 100755
--- a/functest/ci/tier_builder.py
+++ b/functest/ci/tier_builder.py
@@ -11,7 +11,7 @@ import tier_handler as th
import yaml
-class TierBuilder:
+class TierBuilder(object):
def __init__(self, ci_installer, ci_scenario, testcases_file):
self.ci_installer = ci_installer
diff --git a/functest/ci/tier_handler.py b/functest/ci/tier_handler.py
index 1eadfba50..127986bf3 100755
--- a/functest/ci/tier_handler.py
+++ b/functest/ci/tier_handler.py
@@ -28,7 +28,7 @@ def split_text(text, max_len):
return lines
-class Tier:
+class Tier(object):
def __init__(self, name, order, ci_loop, description=""):
self.tests_array = []
@@ -102,7 +102,7 @@ class Tier:
return out
-class TestCase:
+class TestCase(object):
def __init__(self, name, dependency, criteria, blocking, description=""):
self.name = name
@@ -160,7 +160,7 @@ class TestCase:
return out
-class Dependency:
+class Dependency(object):
def __init__(self, installer, scenario):
self.installer = installer
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index 9423631bf..14ad01bfc 100644
--- a/functest/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -16,7 +16,7 @@ from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
-class CliEnv:
+class CliEnv(object):
def __init__(self):
pass
diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py
index aeb34974f..f85f4041f 100644
--- a/functest/cli/commands/cli_os.py
+++ b/functest/cli/commands/cli_os.py
@@ -18,7 +18,7 @@ import functest.utils.openstack_clean as os_clean
import functest.utils.openstack_snapshot as os_snapshot
-class CliOpenStack:
+class CliOpenStack(object):
def __init__(self):
self.os_auth_url = CONST.OS_AUTH_URL
diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py
index b6566245a..6644a0c29 100644
--- a/functest/cli/commands/cli_testcase.py
+++ b/functest/cli/commands/cli_testcase.py
@@ -19,7 +19,7 @@ import functest.utils.functest_utils as ft_utils
import functest.utils.functest_vacation as vacation
-class CliTestcase:
+class CliTestcase(object):
def __init__(self):
self.tiers = tb.TierBuilder(CONST.INSTALLER_TYPE,
diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py
index b9d25b6d0..012b11d0e 100644
--- a/functest/cli/commands/cli_tier.py
+++ b/functest/cli/commands/cli_tier.py
@@ -18,7 +18,7 @@ from functest.utils.constants import CONST
import functest.utils.functest_utils as ft_utils
-class CliTier:
+class CliTier(object):
def __init__(self):
self.tiers = tb.TierBuilder(CONST.INSTALLER_TYPE,
diff --git a/functest/opnfv_tests/sdn/odl/odl.py b/functest/opnfv_tests/sdn/odl/odl.py
index 9bff324f1..69818f5a5 100755
--- a/functest/opnfv_tests/sdn/odl/odl.py
+++ b/functest/opnfv_tests/sdn/odl/odl.py
@@ -186,7 +186,7 @@ class ODLTests(testcase_base.TestcaseBase):
return self.main(suites, **kwargs)
-class ODLParser():
+class ODLParser(object):
def __init__(self):
self.parser = argparse.ArgumentParser()
diff --git a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
index fadaa4783..c21986902 100644
--- a/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
+++ b/functest/opnfv_tests/sdn/onos/sfc/sfc_onos.py
@@ -18,7 +18,7 @@ ACCEPTED = 202
NO_CONTENT = 204
-class SfcOnos:
+class SfcOnos(object):
"""Defines all the def function of SFC."""
def __init__(self):
diff --git a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
index bf2c4302c..2bef5cc6e 100644
--- a/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
+++ b/functest/opnfv_tests/sdn/onos/teston/adapters/foundation.py
@@ -21,7 +21,7 @@ import functest.utils.functest_constants as ft_constants
import functest.utils.functest_utils as ft_utils
-class Foundation:
+class Foundation(object):
def __init__(self):
diff --git a/functest/opnfv_tests/vnf/ims/clearwater.py b/functest/opnfv_tests/vnf/ims/clearwater.py
index eb0abacdc..32c6dc5c9 100644
--- a/functest/opnfv_tests/vnf/ims/clearwater.py
+++ b/functest/opnfv_tests/vnf/ims/clearwater.py
@@ -12,7 +12,7 @@
########################################################################
-class Clearwater:
+class Clearwater(object):
def __init__(self, inputs={}, orchestrator=None, logger=None):
self.config = inputs
diff --git a/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py b/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py
index 775b71c8a..82a9dca05 100644
--- a/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py
+++ b/functest/opnfv_tests/vnf/ims/orchestrator_cloudify.py
@@ -21,7 +21,7 @@ from git import Repo
import functest.utils.functest_logger as ft_logger
-class Orchestrator:
+class Orchestrator(object):
def __init__(self, testcase_dir, inputs={}):
self.testcase_dir = testcase_dir
diff --git a/functest/utils/functest_logger.py b/functest/utils/functest_logger.py
index 6dc46ef25..022211cb7 100755
--- a/functest/utils/functest_logger.py
+++ b/functest/utils/functest_logger.py
@@ -29,7 +29,7 @@ import json
from functest.utils.constants import CONST
-class Logger:
+class Logger(object):
def __init__(self, logger_name):
self.setup_logging()
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index b2c36cff9..78831c113 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -291,6 +291,13 @@ def get_ci_envvars():
return ci_env_var
+def execute_command_raise(cmd, info=False, error_msg="",
+ verbose=True, output_file=None):
+ ret = execute_command(cmd, info, error_msg, verbose, output_file)
+ if ret != 0:
+ raise Exception(error_msg)
+
+
def execute_command(cmd, info=False, error_msg="",
verbose=True, output_file=None):
if not error_msg:
diff --git a/functest/utils/openstack_tacker.py b/functest/utils/openstack_tacker.py
index 07acc8b3a..8327fdbe2 100644
--- a/functest/utils/openstack_tacker.py
+++ b/functest/utils/openstack_tacker.py
@@ -176,6 +176,11 @@ def wait_for_vnf(tacker_client, vnf_id=None, vnf_name=None, timeout=60):
elif vnf['status'] == 'PENDING_CREATE':
time.sleep(3)
timeout -= 3
+ vnf = get_vnf(tacker_client, vnf_id, vnf_name)
+
+ if (timeout < 0):
+ raise Exception('Timeout when booting vnf %s' % vnf['id'])
+
return vnf['id']
except Exception, e:
logger.error("error [wait_for_vnf(tacker_client, '%s', '%s')]: %s"