diff options
author | Moshe <moshehoa@amdocs.com> | 2018-04-08 21:37:43 +0300 |
---|---|---|
committer | Moshe <moshehoa@amdocs.com> | 2018-05-14 18:05:32 +0300 |
commit | 82aeca18c66dc4c312a57f24ed3c4c33a2063070 (patch) | |
tree | 9fad6581a0722e866b937cf3955b1e2d2cd6d4fa /vnftest/core | |
parent | dcfc64ef46b52769f03b6ed06e23b455c8ed69e5 (diff) |
Refactor api definition yamls to support jinja2
Issue-ID: VNFSDK-181
Change-Id: Ibff00e985f95b400f08d4de4021dc3a8ab235ad7
Signed-off-by: Moshe <moshehoa@amdocs.com>
Support creation of multiple vf-modules per vnf
Issue-ID: VNFSDK-264
Change-Id: I45054bc4bb721d7df89653e99fafe61297939504
Signed-off-by: Moshe <moshehoa@amdocs.com>
fix tests
Issue-ID: VNFSDK-264
Change-Id: I077289bfcd4c68b0191fd74c4e02e07a67f5104f
Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/core')
-rw-r--r-- | vnftest/core/task.py | 10 | ||||
-rw-r--r-- | vnftest/core/testcase.py | 5 |
2 files changed, 10 insertions, 5 deletions
diff --git a/vnftest/core/task.py b/vnftest/core/task.py index 8ce897b..939696c 100644 --- a/vnftest/core/task.py +++ b/vnftest/core/task.py @@ -73,7 +73,7 @@ class Task(object): # pragma: no cover output_config['DEFAULT']['dispatcher'] = out_types def start(self, args, **kwargs): - Context.load_vnf_descriptor(args.vnfdescriptor) + Context.initialize(args.vnfdescriptor) atexit.register(self.atexit_handler) task_id = getattr(args, 'task_id') @@ -120,10 +120,12 @@ class Task(object): # pragma: no cover # parse task_files for i in range(0, len(task_files)): one_task_start_time = time.time() + # the output of the previous task is the input of the new task + inputs = copy.deepcopy(self.outputs) 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]) + task_args_fnames[i], inputs) self.context = ret_context @@ -426,16 +428,18 @@ 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): + def parse_task(self, task_id, task_args=None, task_args_file=None, 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() diff --git a/vnftest/core/testcase.py b/vnftest/core/testcase.py index ef3e535..ea07243 100644 --- a/vnftest/core/testcase.py +++ b/vnftest/core/testcase.py @@ -74,8 +74,9 @@ class Testcase(object): return record def _parse_testcase(self, testcase_info): - - rendered_testcase = TaskTemplate.render(testcase_info) + kw = {} + kw['vnf_descriptor'] = {} + rendered_testcase = TaskTemplate.render(testcase_info, **kw) testcase_cfg = yaml_load(rendered_testcase) test_precondition = testcase_cfg.get('precondition', {}) |