summaryrefslogtreecommitdiffstats
path: root/vnftest/onap/steps
diff options
context:
space:
mode:
authorMoshe <moshehoa@amdocs.com>2018-03-11 16:18:20 +0200
committerMoshe <moshehoa@amdocs.com>2018-03-11 16:18:38 +0200
commite01f70617a2f22b71cfce912b72a1dbb77f3f969 (patch)
tree3970cadfaba013fbc0f27ec42006a1744abdc88f /vnftest/onap/steps
parent976c2a916ea810effc34c5838b80b83bc9f8e6e0 (diff)
add checkin+submit vlm steps to test case
Issue-ID: VNFSDK-195 Change-Id: I92dbf0c3abfbde2d6667588289c7a4ca2ccb4726 Signed-off-by: Moshe <moshehoa@amdocs.com>
Diffstat (limited to 'vnftest/onap/steps')
-rw-r--r--vnftest/onap/steps/onap_api_call.py49
-rw-r--r--vnftest/onap/steps/onboard/checkin_vlm.yaml24
-rw-r--r--vnftest/onap/steps/onboard/submit_vlm.yaml24
3 files changed, 80 insertions, 17 deletions
diff --git a/vnftest/onap/steps/onap_api_call.py b/vnftest/onap/steps/onap_api_call.py
index ec53455..e03e00a 100644
--- a/vnftest/onap/steps/onap_api_call.py
+++ b/vnftest/onap/steps/onap_api_call.py
@@ -19,10 +19,11 @@ import os
import yaml
import copy
-from vnftest.common.exceptions import MandatoryKeyException
+from vnftest.common.exceptions import MandatoryKeyException, InputParameterMissing
from vnftest.onap.steps import base
from vnftest.common import rest_client
from vnftest.common import constants as consts
+from vnftest.onap.contexts.csar import CSARContext
LOG = logging.getLogger(__name__)
@@ -31,11 +32,12 @@ class OnapApiCall(base.Step):
__step_type__ = "OnapApiCall"
- def __init__(self, step_cfg, context_cfg):
+ def __init__(self, step_cfg, context_cfg, input_params):
self.step_cfg = step_cfg
self.context_cfg = context_cfg
- self.input = None
- self.output = None
+ self.input_params = input_params
+ self.input_cfg = None
+ self.output_cfg = None
self.rest_def_file = None
self.setup_done = False
self.curr_path = os.path.dirname(os.path.abspath(__file__))
@@ -43,22 +45,36 @@ class OnapApiCall(base.Step):
def setup(self):
options = self.step_cfg['options']
self.rest_def_file = options.get("file")
- self.input = options.get("input")
- self.output = options.get("output")
+ self.input_cfg = options.get("input", {})
+ self.output_cfg = options.get("output", {})
self.setup_done = True
+ def eval_input(self, params):
+ for input_parameter in self.input_cfg:
+ param_name = input_parameter['parameter_name']
+ value = None
+ if 'value' in input_parameter:
+ value = input_parameter['value']
+ elif 'source' in input_parameter:
+ source = input_parameter['source']
+ if source == 'prev_step':
+ if param_name in self.input_params:
+ value = self.input_params[param_name]
+ else:
+ raise InputParameterMissing(param_name=param_name, source='input parameters')
+ if value is None:
+ raise InputParameterMissing(param_name=param_name, source="task configuration")
+ params[param_name] = value
+
def run(self, result):
if not self.setup_done:
self.setup()
- result['output'] = {}
+ 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
+ self.eval_input(params)
execution_result = self.execute_operation(params)
result_body = execution_result['body']
- for output_parameter in self.output:
+ for output_parameter in self.output_cfg:
param_name = output_parameter['parameter_name']
param_path = output_parameter['path']
path_list = param_path.split("|")
@@ -66,11 +82,10 @@ class OnapApiCall(base.Step):
for path_element in path_list:
param_value = param_value[path_element]
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'
+ raise MandatoryKeyException(key_name='param_path', class_name=str(result_body))
+ result[param_name] = param_value
+ output[param_name] = param_value
+ return output
def execute_operation(self, params, attempt=0):
try:
diff --git a/vnftest/onap/steps/onboard/checkin_vlm.yaml b/vnftest/onap/steps/onboard/checkin_vlm.yaml
new file mode 100644
index 0000000..93fdd07
--- /dev/null
+++ b/vnftest/onap/steps/onboard/checkin_vlm.yaml
@@ -0,0 +1,24 @@
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.0 (the"License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# software distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and limitations under
+# the License
+##############################################################################
+
+---
+method: "PUT"
+url: "http://{sdc_ip}:{sdc_port}/onboarding-api/v1.0/vendor-license-models/{vendor_id}/versions/0.1/actions"
+headers: {
+ "Content-Type": "application/json",
+ "Authorization": "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "USER_ID": "{sdc_designer_user}",
+ "Accept": "application/json"
+ }
+body: {"action":"Checkin"}
diff --git a/vnftest/onap/steps/onboard/submit_vlm.yaml b/vnftest/onap/steps/onboard/submit_vlm.yaml
new file mode 100644
index 0000000..eb1683a
--- /dev/null
+++ b/vnftest/onap/steps/onboard/submit_vlm.yaml
@@ -0,0 +1,24 @@
+##############################################################################
+# Copyright 2018 EuropeanSoftwareMarketingLtd.
+# ===================================================================
+# Licensed under the ApacheLicense, Version2.0 (the"License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# software distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and limitations under
+# the License
+##############################################################################
+
+---
+method: "PUT"
+url: "http://{sdc_ip}:{sdc_port}/onboarding-api/v1.0/vendor-license-models/{vendor_id}/versions/0.1/actions"
+headers: {
+ "Content-Type": "application/json",
+ "Authorization": "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==",
+ "USER_ID": "{sdc_designer_user}",
+ "Accept": "application/json"
+ }
+body: {"action":"Submit"}