diff options
author | helenyao <yaohelan@huawei.com> | 2017-03-16 20:24:56 +0800 |
---|---|---|
committer | helenyao <yaohelan@huawei.com> | 2017-03-29 10:45:10 +0800 |
commit | 443757aa99ccfcb743b132e14f36d61aef2de282 (patch) | |
tree | e838ea2db9585b7837683cb67218a463366c904e /functest/core/vnf_base.py | |
parent | 0385fdaa5b8b39c2cbc75c7d7719d872b317e0b9 (diff) |
Added test case for opera vims
1. Created a ImsOnBoardingBase to wrap up all common ims operations
2. Created test case to test opera vims onboarding
Change-Id: Idf3a82e10661271ad413f4dd5795c80ca4421d73
Signed-off-by: helenyao <yaohelan@huawei.com>
Diffstat (limited to 'functest/core/vnf_base.py')
-rw-r--r-- | functest/core/vnf_base.py | 26 |
1 files changed, 15 insertions, 11 deletions
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) |