diff options
author | Moshe <moshehoa@amdocs.com> | 2018-03-06 18:50:02 +0200 |
---|---|---|
committer | Moshe <moshehoa@amdocs.com> | 2018-03-06 18:51:42 +0200 |
commit | 976c2a916ea810effc34c5838b80b83bc9f8e6e0 (patch) | |
tree | 432fb4af11e213f759d3156414e9958f4dc12ff3 /vnftest/onap/steps | |
parent | 0bb532c41e89568966ca2bfae259737e8830249b (diff) |
handle results format
Issue-ID: VNFSDK-195
Change-Id: I31f07515b252247fe777791d883d37ba9ba1bd6a
Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/onap/steps')
-rw-r--r-- | vnftest/onap/steps/onap_api_call.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/vnftest/onap/steps/onap_api_call.py b/vnftest/onap/steps/onap_api_call.py index ecb2ce3..ec53455 100644 --- a/vnftest/onap/steps/onap_api_call.py +++ b/vnftest/onap/steps/onap_api_call.py @@ -18,6 +18,8 @@ import time import os import yaml import copy + +from vnftest.common.exceptions import MandatoryKeyException from vnftest.onap.steps import base from vnftest.common import rest_client from vnftest.common import constants as consts @@ -45,16 +47,17 @@ class OnapApiCall(base.Step): self.output = options.get("output") self.setup_done = True - def run(self, args): + def run(self, result): if not self.setup_done: self.setup() + result['output'] = {} params = copy.deepcopy(consts.component_constants) for input_parameter in self.input: param_name = input_parameter['parameter_name'] param_value = input_parameter['value'] params[param_name] = param_value - result = self.execute_operation(params) - result_body = result['body'] + execution_result = self.execute_operation(params) + result_body = execution_result['body'] for output_parameter in self.output: param_name = output_parameter['parameter_name'] param_path = output_parameter['path'] @@ -62,7 +65,12 @@ class OnapApiCall(base.Step): param_value = result_body for path_element in path_list: param_value = param_value[path_element] - self.context_cfg[param_name] = param_value + if param_value is None: + raise MandatoryKeyException( + key_name='param_path', class_name=str(result_body)) + self.context_cfg[param_name] = param_value + result['output'][param_name] = param_value + result['status'] = 'PASS' def execute_operation(self, params, attempt=0): try: |