| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 1 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 2 | # you may not use this file except in compliance with the License. |
| 3 | # You may obtain a copy of the License at |
| 4 | # |
| 5 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | # |
| 7 | # Unless required by applicable law or agreed to in writing, software |
| 8 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 9 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 10 | # See the License for the specific language governing permissions and |
| 11 | # limitations under the License |
| 12 | |
| 13 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 14 | Documentation [SOL003-01] Sol003 Api testing |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 15 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 16 | Library OperatingSystem |
| 17 | Library String |
| 18 | Library Collections |
| 19 | Library RequestsLibrary |
| 20 | Library yaml |
| 21 | Library JsonValidator |
| 22 | Library JSONLibrary |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 23 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/sol003_common_lib.robot |
| 25 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 26 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 27 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 28 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vim_lib.robot |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 29 | |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 30 | Force Tags sol003_01 cluster_sol003 daily |
| 31 | |
| 32 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 33 | |
| 34 | |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 35 | *** Variables *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 36 | ${vnfd_pkg} hackfest_basic_metrics_vnf |
| 37 | ${vnfd_name} hackfest_basic_metrics-vnf |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 38 | |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 39 | |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 40 | *** Test Cases *** |
| 41 | Create VNF package from JSON file descriptor |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 42 | [Documentation] Test case to create a VNF Identifier |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 43 | Get VNFDs List |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 44 | ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' |
| 45 | Set Suite Variable ${vnfid} ${id} |
| 46 | ${created_vim_account_id}= Get VIM Target ID %{VIM_TARGET} |
| 47 | Set Suite Variable ${created_vim_account_id} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 48 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 49 | ${json_path}= Read Directory |
| 50 | ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 51 | ${json_obj}= Get Variable Value ${json_obj['data'][0]} |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 52 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} |
| 53 | Log ${updated_json_obj} |
| 54 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} |
| 55 | Log ${updated_json_obj} |
| 56 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} |
| 57 | Log ${updated_json_obj} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 58 | Set Test Variable ${updated_json_obj} |
| 59 | Post API Request ${vnf_instance_uri} |
| 60 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed |
| 61 | ${id}= Get Value From Json ${request_response.json()} $..id |
| 62 | Set Suite Variable ${createid} ${id[0]} |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 63 | Get VNFDs List |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 64 | |
| 65 | Instantiate VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 66 | [Documentation] Test case to Instantiate a VNF |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 67 | Get Ns List |
| 68 | Get Vnf List |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 69 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 70 | ${json_path}= Read Directory |
| 71 | ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 72 | ${json_obj}= Get Variable Value ${json_obj['data'][1]} |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 73 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} |
| 74 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..vnfId ${createid} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 75 | Set Test Variable ${updated_json_obj} |
| 76 | Post API Request ${vnf_instantiate_uri}/${createid}/instantiate |
| 77 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed |
| 78 | ${id}= Get Value From Json ${request_response.json()} $..id |
| 79 | Set Suite Variable ${instantiateid} ${id[0]} |
| 80 | Sleep 12s |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 81 | Get Ns List |
| 82 | Get Vnf List |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 83 | |
| 84 | Query VNF Instances |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 85 | [Documentation] Test case to query VNF Instance |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 86 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 87 | Get Api Request ${vnf_instance_uri} |
| 88 | ${value}= Get ID nsState |
| 89 | Should Be Equal ${value} INSTANTIATED |
| 90 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed |
| 91 | ${id}= Get Value From Json ${request_response.json()} $.._id |
| 92 | Set Suite Variable ${Queryid} ${id[0]} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 93 | |
| 94 | Query VNF Instance ID |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 95 | [Documentation] Test case to query Vnf instance ID |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 96 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 97 | Get Api Request ${vnf_instance_uri}/${Queryid} |
| 98 | ${value}= Get ID nsState |
| 99 | Should Be Equal ${value} INSTANTIATED |
| 100 | Should Be Equal As Strings ${RequestResponse.status_code} 200 |
| 101 | ${id}= Get Value From Json ${request_response.json()} $.._id |
| 102 | Set Suite Variable ${Instanceid} ${id[0]} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 103 | |
| 104 | Query VNF LCM Ops |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 105 | [Documentation] Test case to Query VNF LCM operation |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 106 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 107 | Get Api Request ${vnf_instance_lcm_ops} |
| 108 | ${ID1}= Get Value From Json ${request_response.json()} $.._id |
| 109 | Set Suite Variable ${lcmops} ${ID1[0]} |
| 110 | FOR ${Index} IN RANGE 0 15 |
| 111 | Get Api Request ${vnf_instance_lcm_ops} |
| 112 | ${value}= Get ID operationState |
| 113 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 114 | Run Keyword If ${status} Exit For Loop |
| 115 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 116 | END |
| 117 | |
| 118 | Query VNF LCM Ops ID |
| 119 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 120 | Get Api Request ${vnf_instance_lcm_ops}/${lcmops} |
| 121 | ${ID1}= Get Value From Json ${request_response.json()} $.._id |
| 122 | Set Suite Variable ${lcmopsid} ${ID1[0]} |
| 123 | FOR ${Index} IN RANGE 0 15 |
| 124 | Get Api Request ${vnf_instance_lcm_ops}/${lcmops} |
| 125 | ${value}= Get ID operationState |
| 126 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 127 | Run Keyword If ${status} Exit For Loop |
| 128 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 129 | END |
| 130 | |
| 131 | Scale VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 132 | [Documentation] Test case to Scale out VNF |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 133 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 134 | ${json_path}= Read Directory |
| 135 | ${updated_json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 136 | ${updated_json_obj}= Get Variable Value ${updated_json_obj['data'][2]} |
| 137 | Set Test Variable ${updated_json_obj} |
| 138 | Post API Request ${vnf_instance_uri}/${createid}/scale |
| 139 | ${value}= Get ID id |
| 140 | ${ID1}= Get Value From Json ${request_response.json()} $..id |
| 141 | Set Suite Variable ${scaleoutid} ${ID1[0]} |
| 142 | Get Api Request ${vnf_instance_lcm_ops}/${scaleoutid} |
| 143 | ${LcmopsScale}= Get Value From Json ${request_response.json()} $.._id |
| 144 | Set Suite Variable ${lcmopsscaleid} ${LcmopsScale[0]} |
| 145 | FOR ${Index} IN RANGE 0 15 |
| 146 | Get Api Request ${vnf_instance_lcm_ops}/${scaleoutid} |
| 147 | ${value}= Get ID operationState |
| 148 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 149 | Run Keyword If ${status} Exit For Loop |
| 150 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 151 | END |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 152 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Scale VNF instance completed |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 153 | |
| 154 | Terminate VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 155 | [Documentation] Test case to terminate the VNF |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 156 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 157 | ${json_path}= Read Directory |
| 158 | ${updated_json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 159 | ${updated_json_obj}= Get Variable Value ${updated_json_obj['data'][3]} |
| 160 | Set Suite Variable ${updated_json_obj} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 161 | Post API Request ${vnf_instance_uri}/${createid}/terminate |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 162 | ${id}= Get Value From Json ${request_response.json()} $..id |
| 163 | Set Suite Variable ${terminateid} ${id[0]} |
| 164 | Get Api Request ${vnf_instance_lcm_ops}/${terminateid} |
| 165 | ${LcmopsTerminate}= Get Value From Json ${request_response.json()} $.._id |
| 166 | Set Suite Variable ${lcmopsscaleid} ${LcmopsTerminate[0]} |
| 167 | FOR ${Index} IN RANGE 0 15 |
| 168 | Get Api Request ${vnf_instance_lcm_ops}/${terminateid} |
| 169 | ${value}= Get ID operationState |
| 170 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 171 | Run Keyword If ${status} Exit For Loop |
| 172 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 173 | END |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 174 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Terminate VNF instance completed |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 175 | |
| 176 | Delete VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 177 | [Documentation] Test case to delete VNF |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 178 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 179 | Create Session APISession ${HOST} |
| 180 | &{Headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${AccessToken} |
| 181 | ${resp}= DELETE On Session APISession ${vnf_instance_uri}/${createid} headers=${Headers} |
| 182 | Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete VNF Instance completed |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 183 | |
| 184 | Delete VNF Descriptor Test |
| 185 | [Tags] cleanup |
| 186 | |
| 187 | Delete VNFD ${vnfd_name} |
| 188 | |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 189 | |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 190 | *** Keywords *** |
| 191 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 192 | [Documentation] Test Suit Cleanup: Deleting Descriptor |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 193 | |
| 194 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 195 | |