| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 1 | *** Comments *** |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [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 | |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 15 | *** Settings *** |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 16 | Documentation [Sol003-02] Sol003 Dual Stack IP in VNFM NB interface |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 17 | |
| 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library RequestsLibrary |
| 22 | Library yaml |
| 23 | Library JsonValidator |
| 24 | Library JSONLibrary |
| 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 |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 31 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 32 | Test Tags sol003_02 cluster_osm_rest daily |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 33 | |
| 34 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 35 | |
| 36 | |
| 37 | *** Variables *** |
| 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 |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [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_vnf |
| 44 | ${VNFD_NAME} hackfest_basic-vnf |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 45 | |
| 46 | |
| 47 | *** Test Cases *** |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 48 | Create VNFD Descriptor |
| 49 | [Documentation] Test case to create a VNF Identifier |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 50 | ${VNFD_ID}= Create VNFD %{PACKAGES_FOLDER}/${VNFD_PKG} |
| 51 | Set Suite Variable ${VNFD_ID} |
| 52 | ${CREATED_VIM_ACCOUNT_ID}= Get VIM Target ID %{VIM_TARGET} |
| 53 | Set Suite Variable ${CREATED_VIM_ACCOUNT_ID} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 54 | Get Auth Token |
| 55 | ${json_path}= Read Directory |
| 56 | ${json_obj}= Load JSON From File ${json_path}/sol003_DualStackip.json |
| 57 | ${json_obj}= Get Variable Value ${json_obj['data'][0]} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 58 | ${NS_NAME}= Get Variable Value ${json_obj['vnfInstanceName']} |
| 59 | Set Suite Variable ${NS_NAME} |
| 60 | ${VALUE1}= Get Variable Value ${json_obj['additionalParams']['ip-address']} |
| 61 | Set Suite Variable ${VALUE1} |
| 62 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} |
| 63 | Log ${UPDATED_JSON_OBJ} |
| 64 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} |
| 65 | Log ${UPDATED_JSON_OBJ} |
| 66 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} |
| 67 | Log ${UPDATED_JSON_OBJ} |
| 68 | Set Test Variable ${UPDATED_JSON_OBJ} |
| 69 | Post Api Request ${VNF_INSTANCE_URI} ${UPDATED_JSON_OBJ} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 70 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed |
| 71 | ${id}= Get Value From Json ${request_response.json()} $..id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 72 | Set Suite Variable ${CREATEID} ${id[0]} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 73 | Get VNFDs List |
| 74 | |
| 75 | Instantiate VNF |
| 76 | [Documentation] Test case to Instantiate a VNF |
| 77 | Get Ns List |
| 78 | Get Vnf List |
| 79 | Get Auth Token |
| 80 | ${json_path}= Read Directory |
| 81 | ${json_obj}= Load JSON From File ${json_path}/sol003_DualStackip.json |
| 82 | ${json_obj}= Get Variable Value ${json_obj['data'][1]} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 83 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} |
| 84 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..vnfId ${CREATEID} |
| 85 | Set Test Variable ${UPDATED_JSON_OBJ} |
| 86 | Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/instantiate ${UPDATED_JSON_OBJ} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 87 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed |
| 88 | ${id}= Get Value From Json ${request_response.json()} $..id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 89 | Set Suite Variable ${VNF_INSTANCE_ID} ${id[0]} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 90 | Sleep 12s |
| 91 | Get Ns List |
| 92 | Get Vnf List |
| 93 | |
| 94 | Get Ns Id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 95 | [Documentation] Get the NS identifier |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 96 | ${id}= Get Ns Id ${ns_name} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 97 | Set Suite Variable ${NS_ID} ${id} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 98 | |
| 99 | Get Dual Ip |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 100 | [Documentation] Get the IP address from the NS |
| 101 | ${id}= Get Dual Ip ${NS_ID} |
| 102 | Set Suite Variable ${DUAL_IP} ${id} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 103 | |
| 104 | Query VNF Instances |
| 105 | [Documentation] Test case to query VNF Instance |
| 106 | Get Auth Token |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 107 | Get Api Request ${VNF_INSTANCE_URI} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 108 | ${value}= Get ID nsState |
| 109 | Should Be Equal ${value} INSTANTIATED |
| 110 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed |
| 111 | ${id}= Get Value From Json ${request_response.json()} $.._id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 112 | Set Suite Variable ${QUERY_ID} ${id[0]} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 113 | |
| 114 | Query VNF Instance ID |
| 115 | [Documentation] Test case to query Vnf instance ID |
| 116 | Get Auth Token |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 117 | Get Api Request ${VNF_INSTANCE_URI}/${QUERY_ID} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 118 | ${value}= Get ID nsState |
| 119 | Should Be Equal ${value} INSTANTIATED |
| 120 | Should Be Equal As Strings ${RequestResponse.status_code} 200 |
| 121 | ${id}= Get Value From Json ${request_response.json()} $.._id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 122 | Log ${id[0]} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 123 | |
| 124 | Query VNF LCM Ops |
| 125 | [Documentation] Test case to Query VNF LCM operation |
| 126 | Get Auth Token |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 127 | Get Api Request ${VNF_INSTANCE_LCM_OPS} |
| 128 | ${id1}= Get Value From Json ${request_response.json()} $.._id |
| 129 | Set Suite Variable ${LCM_OP_ID} ${id1[0]} |
| 130 | FOR ${index} IN RANGE 0 15 |
| 131 | Log ${index} |
| 132 | Get Api Request ${VNF_INSTANCE_LCM_OPS} |
| 133 | ${value}= Get ID operationState |
| 134 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 135 | IF ${status} |
| 136 | BREAK |
| 137 | ELSE |
| 138 | Sleep 10s |
| 139 | END |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 140 | END |
| 141 | |
| 142 | Query VNF LCM Ops ID |
| 143 | [Documentation] Test case to Query VNF LCM operation id |
| 144 | Get Auth Token |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 145 | Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCM_OP_ID} |
| 146 | ${id1}= Get Value From Json ${request_response.json()} $.._id |
| 147 | Log ${id1[0]} |
| 148 | FOR ${index} IN RANGE 0 15 |
| 149 | Log ${index} |
| 150 | Get Api Request ${VNF_INSTANCE_LCM_OPS}/${LCM_OP_ID} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 151 | ${value}= Get ID operationState |
| 152 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 153 | IF ${status} |
| 154 | BREAK |
| 155 | ELSE |
| 156 | Sleep 10s |
| 157 | END |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 158 | END |
| 159 | |
| 160 | Verify Dual Ip |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 161 | [Documentation] Test case to terminate the VNF |
| 162 | Should Be Equal ${DUAL_IP} ${VALUE1} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 163 | |
| 164 | Terminate VNF |
| 165 | [Documentation] Test case to terminate the VNF |
| 166 | Get Auth Token |
| 167 | ${json_path}= Read Directory |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 168 | ${UPDATED_JSON_OBJ}= Load JSON From File ${json_path}/sol003_DualStackip.json |
| 169 | ${UPDATED_JSON_OBJ}= Get Variable Value ${UPDATED_JSON_OBJ['data'][3]} |
| 170 | Set Suite Variable ${UPDATED_JSON_OBJ} |
| 171 | Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/terminate ${UPDATED_JSON_OBJ} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 172 | ${id}= Get Value From Json ${request_response.json()} $..id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 173 | ${terminateid}= Set Variable ${id[0]} |
| 174 | Get Api Request ${VNF_INSTANCE_LCM_OPS}/${terminateid} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 175 | ${LcmopsTerminate}= Get Value From Json ${request_response.json()} $.._id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 176 | Log ${LcmopsTerminate[0]} |
| 177 | FOR ${index} IN RANGE 0 15 |
| 178 | Log ${index} |
| 179 | Get Api Request ${VNF_INSTANCE_LCM_OPS}/${terminateid} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 180 | ${value}= Get ID operationState |
| 181 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 182 | IF ${status} |
| 183 | BREAK |
| 184 | ELSE |
| 185 | Sleep 10s |
| 186 | END |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 187 | END |
| 188 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Terminate VNF instance completed |
| 189 | |
| 190 | Delete VNF |
| 191 | [Documentation] Test case to delete VNF |
| 192 | Get Auth Token |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 193 | Create Session APISession ${REST_API_HOST} |
| 194 | &{Headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${AccessToken} |
| 195 | ${resp}= DELETE On Session APISession ${VNF_INSTANCE_URI}/${CREATEID} headers=${Headers} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 196 | Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete VNF Instance completed |
| 197 | |
| 198 | Delete VNF Descriptor Test |
| 199 | [Documentation] Test case to delete the VNF descriptor test |
| 200 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 201 | Delete VNFD ${VNFD_NAME} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 202 | |
| 203 | |
| 204 | *** Keywords *** |
| 205 | Suite Cleanup |
| 206 | [Documentation] Test Suit Cleanup: Deleting Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame^] | 207 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |