diff options
Diffstat (limited to 'vnftest')
-rw-r--r-- | vnftest/cmd/commands/task.py | 2 | ||||
-rw-r--r-- | vnftest/common/constants.py | 22 | ||||
-rw-r--r-- | vnftest/common/rest_client.py | 19 | ||||
-rw-r--r-- | vnftest/common/utils.py | 31 | ||||
-rw-r--r-- | vnftest/contexts/base.py | 20 | ||||
-rw-r--r-- | vnftest/core/__init__.py | 2 | ||||
-rw-r--r-- | vnftest/core/task.py | 59 | ||||
-rw-r--r-- | vnftest/core/testcase.py | 1 | ||||
-rw-r--r-- | vnftest/onap/onboard/v1/upload_package_v1.yaml | 4 | ||||
-rw-r--r-- | vnftest/onap/onboard/v2/upload_package_v2.yaml | 4 | ||||
-rw-r--r-- | vnftest/steps/rest_call.py | 14 | ||||
-rw-r--r-- | vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml | 16 | ||||
-rw-r--r-- | vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml | 4 | ||||
-rw-r--r-- | vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml | 3 | ||||
-rw-r--r-- | vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml | 6 | ||||
-rw-r--r-- | vnftest/tests/unit/core/test_task.py | 2 | ||||
-rw-r--r-- | vnftest/tests/unit/onap/test_rest_call.py | 2 |
17 files changed, 107 insertions, 104 deletions
diff --git a/vnftest/cmd/commands/task.py b/vnftest/cmd/commands/task.py index e0bf7e5..e10ac30 100644 --- a/vnftest/cmd/commands/task.py +++ b/vnftest/cmd/commands/task.py @@ -29,8 +29,6 @@ class TaskCommands(object): # pragma: no cover Set of commands to manage benchmark tasks. """ - @cliargs("environment", type=str, help="path to environment file", metavar="environment") - @cliargs("vnfdescriptor", type=str, help="path to vnf descriptor file", metavar="vnf-descriptor") @cliargs("inputfile", type=str, help="path to task or suite file", metavar="input-file") @cliargs("--task-args", dest="task_args", help="Input task args (dict in json). These args are used" diff --git a/vnftest/common/constants.py b/vnftest/common/constants.py index acf14ea..9996ca6 100644 --- a/vnftest/common/constants.py +++ b/vnftest/common/constants.py @@ -82,23 +82,23 @@ if not SERVER_IP: # dir -CONF_DIR = get_param('dir.conf', join(VNFTEST_ROOT_PATH, 'etc/vnftest')) -IMAGE_DIR = get_param('dir.images', join(VNFTEST_ROOT_PATH, 'home/onap/images/')) -PACKAGE_DIR = get_param('dir.packages', join(VNFTEST_ROOT_PATH, 'home/onap/packages/')) +CONF_DIR = get_param('dir.conf', '/etc/vnftest') +IMAGE_DIR = get_param('dir.images', join(VNFTEST_ROOT_PATH, '../../images/')) +PACKAGE_DIR = get_param('dir.packages', join(VNFTEST_ROOT_PATH, '../../packages/')) CONF_FILE = join(CONF_DIR, 'vnftest.conf') -REPOS_DIR = get_param('dir.repos', join(VNFTEST_ROOT_PATH, 'home/onap/repos/vnftest')) -LOG_DIR = get_param('dir.log', join(VNFTEST_ROOT_PATH, 'var/log/vnftest/')) +REPOS_DIR = get_param('dir.repos', join(VNFTEST_ROOT_PATH, '..')) +LOG_DIR = get_param('dir.log', '/var/log/vnftest/') -TASK_LOG_DIR = get_param('dir.tasklog', join(VNFTEST_ROOT_PATH, 'var/log/vnftest/')) +TASK_LOG_DIR = get_param('dir.tasklog', '/var/log/vnftest/') CONF_SAMPLE_DIR = join(REPOS_DIR, 'etc/vnftest/') SAMPLE_CASE_DIR = join(REPOS_DIR, 'samples') -TESTCASE_DIR = join(REPOS_DIR, 'vnftest/test_config/onap/test_cases/') -TESTSUITE_DIR = join(REPOS_DIR, 'vnftest/test_config/onap/test_suites/') +TESTCASE_DIR = join(VNFTEST_ROOT_PATH, 'vnftest/test_config/onap/test_cases/') +TESTSUITE_DIR = join(VNFTEST_ROOT_PATH, 'vnftest/test_config/onap/test_suites/') # file -DEFAULT_OUTPUT_FILE = get_param('file.output_file', join(VNFTEST_ROOT_PATH, 'tmp/vnftest.out')) -DEFAULT_HTML_FILE = get_param('file.html_file', join(VNFTEST_ROOT_PATH, 'tmp/vnftest.htm')) -REPORTING_FILE = get_param('file.reporting_file', join(VNFTEST_ROOT_PATH, 'tmp/report.html')) +DEFAULT_OUTPUT_FILE = get_param('file.output_file', '/tmp/vnftest.out') +DEFAULT_HTML_FILE = get_param('file.html_file', '/tmp/vnftest.htm') +REPORTING_FILE = get_param('file.reporting_file', '/tmp/report.html') # api API_PORT = 5000 diff --git a/vnftest/common/rest_client.py b/vnftest/common/rest_client.py index 051f5dd..bd938e4 100644 --- a/vnftest/common/rest_client.py +++ b/vnftest/common/rest_client.py @@ -19,7 +19,8 @@ import logging import os import urllib2 import requests - +import sys +import traceback from vnftest.common import utils logger = logging.getLogger(__name__) @@ -39,8 +40,9 @@ def call(url, method, headers, data, logger): f = urllib2.urlopen(req) return_code = f.code response_body = f.read() - headers = f.headers - content_type = headers.dict['content-type'] if 'content-type' in headers.dict else 'application/json' + headers = f.headers.dict + + content_type = headers['content-type'] if 'content-type' in headers else 'application/json' f.close() if len(str(response_body)) == 0: response_body = "{}" @@ -48,9 +50,12 @@ def call(url, method, headers, data, logger): response_body = utils.xml_to_dict(response_body) else: response_body = json.loads(response_body) - result = {'return_code': return_code, 'body': response_body} + result = {'return_code': return_code, 'body': response_body, 'headers': headers} return result - + except urllib2.HTTPError as e: + error_message = e.read() + logger.exception(error_message) + raise RuntimeError(error_message) except Exception as e: message = "Cannot read content from {}, exception: {}".format(url, e) logger.exception(message) @@ -64,8 +69,8 @@ def upload_file(url, headers, file, logger): logger.debug("Upload file. URL: {}".format(url)) response = None try: - response = requests.post(url, headers=headers, files=file) - return {'return_code': response.status_code, 'body': response.json()} + response = requests.post(url, headers=headers, files=file, verify=False) + return {'return_code': response.status_code, 'body': response.json(), 'headers': response.headers} except Exception as e: message = "Error while uploading file to {}, exception: {}".format(url, e) logger.exception(message) diff --git a/vnftest/common/utils.py b/vnftest/common/utils.py index 9e2496e..eaf184a 100644 --- a/vnftest/common/utils.py +++ b/vnftest/common/utils.py @@ -156,7 +156,7 @@ def get_port_mac(sshclient, port): def get_port_ip(sshclient, port): cmd = "ifconfig %s |grep 'inet addr' |awk '{print $2}' " \ - "|cut -d ':' -f2 " % port + "|cut -d ':' -f2 " % port status, stdout, stderr = sshclient.execute(cmd) if status: @@ -483,24 +483,37 @@ def load_resource(path): return pkg_resources.resource_stream(package, split_path[1]) -def format(st, params): - if not isinstance(st, basestring): - return st +def format(in_obj, params): + if isinstance(in_obj, list): + ret_list = [] + for item in in_obj: + item = format(item, params) + ret_list.append(item) + return ret_list + if isinstance(in_obj, dict): + ret_dict = {} + for k, v in in_obj.items(): + v = format(v, params) + ret_dict[k] = v + return ret_dict + if not isinstance(in_obj, basestring): + return in_obj + dotdict(params) ret_str = "" ret_obj = None for literal_text, field_name, format_spec, conversion in \ - Formatter().parse(st): + Formatter().parse(in_obj): if field_name is None: ret_str = ret_str + literal_text else: - dict = ret_obj or params + tmp_dict = ret_obj or params try: - value = dict[field_name] + value = tmp_dict[field_name] except KeyError: - dict = dotdict(dict) + tmp_dict = dotdict(tmp_dict) field_name = '{' + field_name + '}' - value = field_name.format(**dict) + value = field_name.format(**tmp_dict) if isinstance(value, basestring): ret_str = ret_str + value else: diff --git a/vnftest/contexts/base.py b/vnftest/contexts/base.py index c6f3992..538a2d6 100644 --- a/vnftest/contexts/base.py +++ b/vnftest/contexts/base.py @@ -20,29 +20,11 @@ import yaml import logging LOG = logging.getLogger(__name__) + @six.add_metaclass(abc.ABCMeta) class Context(object): """Class that represents a context in the logical model""" list = [] - vnf_descriptor = {} - onap_env_config = {} - creds = {} - - @classmethod - def initialize(cls, vnf_descriptor_path, environment_path): - LOG.info('vnf descriptor path: %s', str(vnf_descriptor_path)) - LOG.info('environment path: %s', str(environment_path)) - with open(vnf_descriptor_path) as f: - cls.vnf_descriptor = yaml.safe_load(f) - with open(environment_path) as f: - environment_config = yaml.safe_load(f) - openstack_env_config = environment_config['openstack'] - openstack_utils.initialize(openstack_env_config) - cls.onap_env_config = environment_config['onap'] - - cls.creds = openstack_utils.get_credentials() - - @staticmethod def split_name(name, sep='.'): diff --git a/vnftest/core/__init__.py b/vnftest/core/__init__.py index d734360..c204f9d 100644 --- a/vnftest/core/__init__.py +++ b/vnftest/core/__init__.py @@ -25,8 +25,6 @@ class Param(object): def __init__(self, kwargs): # list - self.environment = kwargs.get('environment') - self.vnfdescriptor = kwargs.get('vnfdescriptor') self.inputfile = kwargs.get('inputfile') self.task_args = kwargs.get('task-args') self.task_args_file = kwargs.get('task-args-file') diff --git a/vnftest/core/task.py b/vnftest/core/task.py index 91e3d3c..065ad7e 100644 --- a/vnftest/core/task.py +++ b/vnftest/core/task.py @@ -72,7 +72,6 @@ class Task(object): # pragma: no cover output_config['DEFAULT']['dispatcher'] = out_types def start(self, args, **kwargs): - Context.initialize(args.vnfdescriptor, args.environment) atexit.register(self.atexit_handler) task_id = getattr(args, 'task_id') @@ -102,15 +101,15 @@ class Task(object): # pragma: no cover if args.suite: # 1.parse suite, return suite_params info - task_files, task_args, task_args_fnames = \ + task_files, task_args_list, task_args_fnames = \ parser.parse_suite() else: task_files = [parser.path] - task_args = [args.task_args] + task_args_list = [args.task_args] task_args_fnames = [args.task_args_file] - LOG.debug("task_files:%s, task_args:%s, task_args_fnames:%s", - task_files, task_args, task_args_fnames) + LOG.debug("task_files:%s, task_args_list:%s, task_args_fnames:%s", + task_files, task_args_list, task_args_fnames) if args.parse_only: sys.exit(0) @@ -121,10 +120,18 @@ class Task(object): # pragma: no cover one_task_start_time = time.time() # the output of the previous task is the input of the new task inputs = copy.deepcopy(self.outputs) + task_args_file = task_args_fnames[i] + task_args = task_args_list[i] + try: + if task_args_file: + with open(task_args_file) as f: + inputs.update(parse_task_args("task_args_file", f.read())) + inputs.update(parse_task_args("task_args", task_args)) + except TypeError: + raise TypeError() parser.path = task_files[i] steps, run_in_parallel, meet_precondition, ret_context = \ - parser.parse_task(self.task_id, task_args[i], - task_args_fnames[i], inputs) + parser.parse_task(self.task_id, inputs) self.context = ret_context @@ -135,7 +142,7 @@ class Task(object): # pragma: no cover case_name = os.path.splitext(os.path.basename(task_files[i]))[0] try: - data = self._run(steps, run_in_parallel, args.output_file) + data = self._run(steps, run_in_parallel, args.output_file, inputs) except KeyboardInterrupt: raise except Exception: @@ -256,7 +263,7 @@ class Task(object): # pragma: no cover for dispatcher in dispatchers: dispatcher.flush_result_data(result) - def _run(self, steps, run_in_parallel, output_file): + def _run(self, steps, run_in_parallel, output_file, inputs): """Deploys context and calls runners""" if self.context: self.context.deploy() @@ -266,14 +273,14 @@ class Task(object): # pragma: no cover # Start all background steps for step in filter(_is_background_step, steps): step["runner"] = dict(type="Duration", duration=1000000000) - runner = self.run_one_step(step, output_file) + runner = self.run_one_step(step, output_file, inputs) background_runners.append(runner) runners = [] if run_in_parallel: for step in steps: if not _is_background_step(step): - runner = self.run_one_step(step, output_file) + runner = self.run_one_step(step, output_file, inputs) runners.append(runner) # Wait for runners to finish @@ -287,7 +294,7 @@ class Task(object): # pragma: no cover # run serially for step in steps: if not _is_background_step(step): - runner = self.run_one_step(step, output_file) + runner = self.run_one_step(step, output_file, inputs) status = runner_join(runner, background_runners, self.outputs, result) if status != 0: LOG.error('Step NO.%s: "%s" ERROR!', @@ -331,7 +338,7 @@ class Task(object): # pragma: no cover else: return op - def run_one_step(self, step_cfg, output_file): + def run_one_step(self, step_cfg, output_file, inputs): """run one step using context""" # default runner is Iteration if 'runner' not in step_cfg: @@ -344,8 +351,8 @@ class Task(object): # pragma: no cover LOG.info("Starting runner of type '%s'", runner_cfg["type"]) # Previous steps output is the input of the next step. - input_params = copy.deepcopy(self.outputs) - runner.run(step_cfg, self.context, input_params) + inputs.update(self.outputs) + runner.run(step_cfg, self.context, inputs) return runner @@ -388,12 +395,13 @@ class TaskParser(object): # pragma: no cover with open(self.path) as stream: cfg = yaml_load(stream) except IOError as ioerror: - sys.exit(ioerror) + LOG.error("Open suite file failed", ioerror) + raise self._check_schema(cfg["schema"], "suite") LOG.info("\nStarting step:%s", cfg["name"]) - cur_pod = os.environ.get('NODE_NAME', None) + cur_pod = os.environ.get('NODE_NAME', "default") cur_installer = os.environ.get('INSTALLER_TYPE', None) valid_task_files = [] @@ -420,21 +428,10 @@ class TaskParser(object): # pragma: no cover return valid_task_files, valid_task_args, valid_task_args_fnames - def parse_task(self, task_id, task_args=None, task_args_file=None, inputs=None): + def parse_task(self, task_id, inputs=None): """parses the task file and return an context and step instances""" LOG.info("Parsing task config: %s", self.path) - - try: - kw = {} - kw.update(inputs) - if task_args_file: - with open(task_args_file) as f: - kw.update(parse_task_args("task_args_file", f.read())) - kw.update(parse_task_args("task_args", task_args)) - kw['vnf_descriptor'] = Context.vnf_descriptor - except TypeError: - raise TypeError() - + kw = inputs try: with utils.load_resource(self.path) as f: try: @@ -460,7 +457,7 @@ class TaskParser(object): # pragma: no cover name_suffix = '-{}'.format(task_id[:8]) try: context_cfg['name'] = '{}{}'.format(context_cfg['name'], - name_suffix) + name_suffix) except KeyError: pass # default to CSAR context diff --git a/vnftest/core/testcase.py b/vnftest/core/testcase.py index 2cb22ec..2c5c4b4 100644 --- a/vnftest/core/testcase.py +++ b/vnftest/core/testcase.py @@ -77,7 +77,6 @@ class Testcase(object): def _parse_testcase(self, testcase_info): kw = {} - kw['vnf_descriptor'] = {} rendered_testcase = TaskTemplate.render(testcase_info, **kw) testcase_cfg = yaml_load(rendered_testcase) diff --git a/vnftest/onap/onboard/v1/upload_package_v1.yaml b/vnftest/onap/onboard/v1/upload_package_v1.yaml index 33f1b6a..c87ee5c 100644 --- a/vnftest/onap/onboard/v1/upload_package_v1.yaml +++ b/vnftest/onap/onboard/v1/upload_package_v1.yaml @@ -19,4 +19,6 @@ headers: Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== USER_ID: {{sdc_designer_user}} Accept: application/json -file: {{package_file_path}}
\ No newline at end of file +file: + key: "upload" + path: {{package_file_path}}
\ No newline at end of file diff --git a/vnftest/onap/onboard/v2/upload_package_v2.yaml b/vnftest/onap/onboard/v2/upload_package_v2.yaml index e623438..dc168a8 100644 --- a/vnftest/onap/onboard/v2/upload_package_v2.yaml +++ b/vnftest/onap/onboard/v2/upload_package_v2.yaml @@ -19,4 +19,6 @@ headers: Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== USER_ID: {{sdc_designer_user}} Accept: application/json -file: {{package_file_path}}
\ No newline at end of file +file: + key: "upload" + path: {{package_file_path}}
\ No newline at end of file diff --git a/vnftest/steps/rest_call.py b/vnftest/steps/rest_call.py index f8b1cf7..7b034ec 100644 --- a/vnftest/steps/rest_call.py +++ b/vnftest/steps/rest_call.py @@ -54,10 +54,6 @@ class RestCall(base.Step): self.input_cfg = options.get("input", {}) self.output_cfg = options.get("output", {}) self.sla_cfg = self.step_cfg.get('sla', {'retries': 0}) - context_dict = {} - context_dict['creds'] = dotdict(self.context.creds) - context_dict['vnf_descriptor'] = dotdict(self.context.vnf_descriptor) - self.input_params['context'] = dotdict(context_dict) self.setup_done = True def eval_input(self, params): @@ -90,10 +86,12 @@ class RestCall(base.Step): def run_impl(self, result): if not self.setup_done: self.setup() - params = copy.deepcopy(self.context.onap_env_config) + params = {} + params.update(copy.deepcopy(self.input_params)) self.eval_input(params) execution_result = self.execute_operation(params) result_body = execution_result['body'] + result_body['headers'] = execution_result.get('headers', {}) output = Crawler.crawl(result_body, self.output_cfg) result.update(output) return output @@ -122,9 +120,9 @@ class RestCall(base.Step): LOG.info(headers) LOG.info(body) if 'file' in operation: - file_path = operation['file'] - LOG.info(file_path) - files = {'upload': open(file_path)} + file_conf = operation['file'] + LOG.info(file_conf) + files = {file_conf['key']: open(file_conf['path'])} result = rest_client.upload_file(url, headers, files, LOG) else: result = rest_client.call(url, diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml index addee64..c58659f 100644 --- a/vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_instantiate-v1.yaml @@ -40,7 +40,11 @@ description: > {% set resource_model_customization_name = resource_model_customization_name or '\"\u007Bresource_model_customization_name\u007D\"' %} {% set distributed_service_id = distributed_service_id or '\"\u007Bdistributed_service_id\u007D\"' %} {% set resource_instance_model_name = resource_instance_model_name or '\"\u007Bresource_instance_model_name\u007D\"' %} +{% set vf_modules = vf_modules or {} %} {% set vf_modules_list = vf_modules_list or {}%} +{% set tenant_id = tenant_id or none %} +{% set tenant_name = tenant_name or none %} + steps: - @@ -53,10 +57,10 @@ steps: value: {{cloud_owner}} - parameter_name: "tenant_id" - value: "{context.creds.tenant_id}" + value: {{tenant_id}} - parameter_name: "tenant_name" - value: "{context.creds.tenant_name}" + value: {{tenant_name}} runner: type: Iteration run_step: "setup,run" @@ -82,7 +86,7 @@ steps: value: {{cloud_owner}} - parameter_name: "tenant_id" - value: "{context.creds.tenant_id}" + value: {{tenant_id}} - type: RestCall options: @@ -169,7 +173,7 @@ steps: value: {{resource_model_customization_name}} - parameter_name: "tenant_id" - value: "{context.creds.tenant_id}" + value: {{tenant_id}} - parameter_name: "service_model_name" value: {{service_model_name}} @@ -216,7 +220,7 @@ steps: type: Iteration run_step: "setup,run" -{% for vf_module_definition in vnf_descriptor.vf_modules %} +{% for vf_module_definition in vf_modules %} {% set vf_module = vf_modules_list[vf_module_definition.module_name] %} {% set vnf_name = ['test_vnf_', rnd, '_', vf_module_definition.module_name ]|join %} - @@ -284,7 +288,7 @@ steps: value: {{vf_module.customizationUUID}} - parameter_name: "tenant_id" - value: "{context.creds.tenant_id}" + value: {{tenant_id}} - parameter_name: "service_model_name" value: {{service_model_name}} diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml index c0fcc84..421ee6e 100644 --- a/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v1.yaml @@ -23,6 +23,8 @@ description: > {% set service_name = service_name or ['test_service_', rnd ]|join %} {% set resource_instance_name = resource_instance_name or ["test_resource_instance_", rnd ]|join %} {% set resource_instance_unique_id = resource_instance_unique_id or ['\"\u007Bresource_version_id\u007D_', rnd, '\"']|join %} +{% set vnf_package_location = vnf_package_location or none %} + steps: - type: RestCall @@ -90,7 +92,7 @@ steps: value: "{vsp_id}" - parameter_name: "package_file_path" - value: "{context.vnf_descriptor.package_location}" + value: {{vnf_package_location}} runner: type: Iteration run_step: "setup,run" diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml index 931974e..8891917 100644 --- a/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_onboard-v2.yaml @@ -23,6 +23,7 @@ description: > {% set service_name = service_name or ['test_service_', rnd ]|join %} {% set resource_instance_name = resource_instance_name or ["test_resource_instance_", rnd ]|join %} {% set resource_instance_unique_id = resource_instance_unique_id or ['\"\u007Bresource_version_id\u007D_', rnd, '\"']|join %} +{% set vnf_package_location = vnf_package_location or none %} steps: - type: RestCall @@ -91,7 +92,7 @@ steps: value: "{vsp_version_id}" - parameter_name: "package_file_path" - value: "{context.vnf_descriptor.package_location}" + value: {{vnf_package_location}} runner: type: Iteration run_step: "setup,run" diff --git a/vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml b/vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml index 59aed7b..c930046 100644 --- a/vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml +++ b/vnftest/test_config/onap/test_cases/onap_vnftest_terminate.yaml @@ -22,10 +22,12 @@ description: > {% set vnf_instance_id = vnf_instance_id or '\"\u007Bvnf_instance_id\u007D\"' %} {% set vf_module_instance_id = vf_module_instance_id or '\"\u007Bvf_module_instance_id\u007D\"' %} {% set service_model_customization_id = service_model_customization_id or '\"\u007Bservice_model_customization_id\u007D\"' %} +{% set vf_modules = vf_modules or {} %} {% set vf_modules_list = vf_modules_list or {}%} +{% set tenant_id = tenant_id or none %} steps: -{% for vf_module_definition in vnf_descriptor.vf_modules %} +{% for vf_module_definition in vf_modules %} {% set vf_module = vf_modules_list[vf_module_definition.module_name] %} - type: RestCall @@ -58,7 +60,7 @@ steps: value: {{service_model_customization_id}} - parameter_name: "tenant_id" - value: "{context|creds|tenant_id}" + value: {{tenant_id}} output: - diff --git a/vnftest/tests/unit/core/test_task.py b/vnftest/tests/unit/core/test_task.py index 21947c9..d554951 100644 --- a/vnftest/tests/unit/core/test_task.py +++ b/vnftest/tests/unit/core/test_task.py @@ -64,7 +64,7 @@ class TaskTestCase(unittest.TestCase): runner.get_output.return_value = {} runner.get_result.return_value = [] mock_base_runner.Runner.get.return_value = runner - t._run([step], False, "vnftest.out") + t._run([step], False, "vnftest.out", {}) self.assertTrue(runner.run.called) def test_parse_suite_no_constraint_no_args(self): diff --git a/vnftest/tests/unit/onap/test_rest_call.py b/vnftest/tests/unit/onap/test_rest_call.py index ec3c88f..13aced7 100644 --- a/vnftest/tests/unit/onap/test_rest_call.py +++ b/vnftest/tests/unit/onap/test_rest_call.py @@ -54,5 +54,5 @@ class RestCallTestCase(testtools.TestCase): context = Context.get("CSAR") context.init(context_cfg) t.context = context - output = t._run([RestCallTestCase.step], False, "vnftest.out") + output = t._run([RestCallTestCase.step], False, "vnftest.out", {}) self.assertEquals(output[0]['data']['output1'], 'output1') |