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