From 43f34481b4c5ccfda407a7f82a124012aab0dccc Mon Sep 17 00:00:00 2001 From: garciadeblas Date: Thu, 23 Feb 2023 17:37:47 +0100 Subject: [PATCH] Fix bug 2220 to solve sol003_01 test Change-Id: Ic4376067a8b42e470c09ba0668c545db8ce08e55 Signed-off-by: garciadeblas --- robot-systest/lib/ns_lib.robot | 7 ++ robot-systest/lib/sol003_common_lib.robot | 4 +- robot-systest/lib/vnf_lib.robot | 7 ++ .../sol003_01-vnf-lifecycle-management.json | 76 +++++++++---------- .../sol003_01-vnf-lifecycle-management.robot | 21 +++-- 5 files changed, 70 insertions(+), 45 deletions(-) diff --git a/robot-systest/lib/ns_lib.robot b/robot-systest/lib/ns_lib.robot index e67636c..36ecd57 100644 --- a/robot-systest/lib/ns_lib.robot +++ b/robot-systest/lib/ns_lib.robot @@ -97,6 +97,13 @@ Get Ns Id [Return] ${stdout} +Get Ns List + ${rc} ${stdout}= Run and Return RC and Output osm ns-list 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + Get Ns Vnf List [Arguments] ${ns_id} diff --git a/robot-systest/lib/sol003_common_lib.robot b/robot-systest/lib/sol003_common_lib.robot index 7262161..d233498 100644 --- a/robot-systest/lib/sol003_common_lib.robot +++ b/robot-systest/lib/sol003_common_lib.robot @@ -35,7 +35,7 @@ ${vnf_instance_lcm_ops} /osm/vnflcm/v1/vnf_lcm_op_occs Get Auth Token [Tags] auth_token Get Hostname - Create Session osmhit ${HOST} + Create Session osmhit ${HOST} disable_warnings=1 &{headers} Create Dictionary Content-Type=application/json Accept=application/json &{data} Create Dictionary username=${osm_user} password=${osm_password} project-id=${osm_project} ${resp}= Post On Session osmhit ${auth_token_uri} json=${data} headers=${headers} @@ -89,7 +89,7 @@ Update Json Value [Arguments] ${JsonInput} ${key} ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/${JsonInput} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..${key} ${created_vim_account_id} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..${key} ${created_vim_account_id} Set Suite Variable ${updated_json_obj} Get Api Request diff --git a/robot-systest/lib/vnf_lib.robot b/robot-systest/lib/vnf_lib.robot index 78f971d..b3d4aa7 100644 --- a/robot-systest/lib/vnf_lib.robot +++ b/robot-systest/lib/vnf_lib.robot @@ -15,6 +15,13 @@ ${success_return_code} 0 *** Keywords *** +Get Vnf List + ${rc} ${stdout}= Run and Return RC and Output osm vnf-list 2>&1 + Log ${stdout} + Should Be Equal As Integers ${rc} ${success_return_code} + [Return] ${stdout} + + Get VNF VIM ID [Arguments] ${vnf_id} diff --git a/robot-systest/resources/sol003_01-vnf-lifecycle-management.json b/robot-systest/resources/sol003_01-vnf-lifecycle-management.json index 267dd03..70bfbe1 100644 --- a/robot-systest/resources/sol003_01-vnf-lifecycle-management.json +++ b/robot-systest/resources/sol003_01-vnf-lifecycle-management.json @@ -1,38 +1,38 @@ -{ - "data":[ - { - "vnfdId":"hackfest_basic_metrics-vnf", - "vnfInstanceName":"sol003-instance", - "vnfInstanceDescription":"Test vnfm instance description", - "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5", - "additionalParams":{ - "virtual-link-desc":[ - { - "id":"mgmtnet", - "mgmt-network":true - } - ], - "constituent-cpd-id":"vnf-cp0-ext", - "virtual-link-profile-id":"mgmtnet" - } - }, - { - "vnfName":"sol003-instance", - "vnfDescription":"vnf package", - "vnfId":"70b47595-fafa-4f63-904b-fc3ada60eebb", - "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5" - }, - { - "type":"SCALE_OUT", - "aspectId":"vdu_autoscale", - "numberOfSteps":"1", - "additionalParams":{ - "member-vnf-index":"1" - } - }, - { - "terminationType":"GRACEFUL", - "gracefulTerminationTimeout":"5" - } - ] -} +{ + "data":[ + { + "vnfdId":"hackfest_basic_metrics-vnf", + "vnfInstanceName":"sol003-instance", + "vnfInstanceDescription":"Test vnfm instance description", + "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5", + "additionalParams":{ + "virtual-link-desc":[ + { + "id":"mgmtnet", + "mgmt-network":true + } + ], + "constituent-cpd-id":"vnf-cp0-ext", + "virtual-link-profile-id":"mgmtnet" + } + }, + { + "vnfName":"sol003-instance", + "vnfDescription":"vnf package", + "vnfId":"70b47595-fafa-4f63-904b-fc3ada60eebb", + "vimAccountId":"8dc2f11d-e08a-4ec7-920c-6b8a88bff1e5" + }, + { + "type":"SCALE_OUT", + "aspectId":"vdu_autoscale", + "numberOfSteps":"1", + "additionalParams":{ + "member-vnf-index":"1" + } + }, + { + "terminationType":"GRACEFUL", + "gracefulTerminationTimeout":"5" + } + ] +} diff --git a/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot b/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot index dcae4f4..750ea84 100644 --- a/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot +++ b/robot-systest/testsuite/sol003_01-vnf-lifecycle-management.robot @@ -23,6 +23,8 @@ Library JSONLibrary Resource %{ROBOT_DEVOPS_FOLDER}/lib/sol003_common_lib.robot Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot +Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot Force Tags sol003_01 cluster_sol003 daily @@ -38,6 +40,7 @@ ${vnfd_name} hackfest_basic_metrics-vnf *** Test Cases *** Create VNF package from JSON file descriptor [Documentation] Test case to create a VNF Identifier + Get VNFDs List ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' Set Suite Variable ${vnfid} ${id} ${created_vim_account_id}= Get VIM Target ID %{VIM_TARGET} @@ -46,29 +49,37 @@ Create VNF package from JSON file descriptor ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json ${json_obj}= Get Variable Value ${json_obj['data'][0]} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - ${updated_json_obj} JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} - ${updated_json_obj} JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} + Log ${updated_json_obj} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} + Log ${updated_json_obj} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} + Log ${updated_json_obj} Set Test Variable ${updated_json_obj} Post API Request ${vnf_instance_uri} Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id Set Suite Variable ${createid} ${id[0]} + Get VNFDs List Instantiate VNF [Documentation] Test case to Instantiate a VNF + Get Ns List + Get Vnf List Get Auth Token ${json_path}= Read Directory ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json ${json_obj}= Get Variable Value ${json_obj['data'][1]} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} - ${updated_json_obj} JSONLibrary.Update Value To Json ${json_obj} $..vnfId ${createid} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} + ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..vnfId ${createid} Set Test Variable ${updated_json_obj} Post API Request ${vnf_instantiate_uri}/${createid}/instantiate Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed ${id}= Get Value From Json ${request_response.json()} $..id Set Suite Variable ${instantiateid} ${id[0]} Sleep 12s + Get Ns List + Get Vnf List Query VNF Instances [Documentation] Test case to query VNF Instance -- 2.25.1