diff options
Diffstat (limited to 'functest/core')
-rw-r--r-- | functest/core/feature.py (renamed from functest/core/feature_base.py) | 4 | ||||
-rw-r--r-- | functest/core/vnf_base.py | 26 |
2 files changed, 17 insertions, 13 deletions
diff --git a/functest/core/feature_base.py b/functest/core/feature.py index f7f3e460..325c10d4 100644 --- a/functest/core/feature_base.py +++ b/functest/core/feature.py @@ -6,10 +6,10 @@ import functest.utils.functest_logger as ft_logger from functest.utils.constants import CONST -class FeatureBase(base.TestCase): +class Feature(base.TestCase): def __init__(self, project='functest', case='', repo='', cmd=''): - super(FeatureBase, self).__init__() + super(Feature, self).__init__() self.project_name = project self.case_name = case self.cmd = cmd diff --git a/functest/core/vnf_base.py b/functest/core/vnf_base.py index c374c491..3f0adcc6 100644 --- a/functest/core/vnf_base.py +++ b/functest/core/vnf_base.py @@ -7,15 +7,14 @@ # which accompanies this distribution, and is available at # http://www.apache.org/licenses/LICENSE-2.0 -import time - import inspect +import time +import functest.core.testcase as base +from functest.utils.constants import CONST import functest.utils.functest_logger as ft_logger -import functest.utils.openstack_utils as os_utils import functest.utils.functest_utils as ft_utils -import testcase as base -from functest.utils.constants import CONST +import functest.utils.openstack_utils as os_utils class VnfOnBoardingBase(base.TestCase): @@ -29,7 +28,7 @@ class VnfOnBoardingBase(base.TestCase): self.case_name = case self.cmd = cmd self.details = {} - self.data_dir = CONST.dir_functest_data + self.result_dir = CONST.dir_results self.details['orchestrator'] = {} self.details['vnf'] = {} self.details['test_vnf'] = {} @@ -39,14 +38,14 @@ class VnfOnBoardingBase(base.TestCase): 'vnf_{}_tenant_name'.format(self.case_name)) self.tenant_description = CONST.__getattribute__( 'vnf_{}_tenant_description'.format(self.case_name)) - except: + except Exception: # raise Exception("Unknown VNF case=" + self.case_name) self.logger.error("Unknown VNF case={}".format(self.case_name)) try: self.images = CONST.__getattribute__( 'vnf_{}_tenant_images'.format(self.case_name)) - except: + except Exception: self.logger.warn("No tenant image defined for this VNF") def execute(self): @@ -234,7 +233,12 @@ class VnfOnBoardingBase(base.TestCase): def step_failure(self, error_msg): part = inspect.stack()[1][3] - self.details[part]['status'] = 'FAIL' - self.details[part]['result'] = error_msg - self.logger.error("Step failure:{}".format(error_msg)) + self.logger.error("Step '%s' failed: %s", part, error_msg) + try: + part_info = self.details[part] + except KeyError: + self.details[part] = {} + part_info = self.details[part] + part_info['status'] = 'FAIL' + part_info['result'] = error_msg raise Exception(error_msg) |