| 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 |
| sritharan | 9e5450f | 2023-12-26 07:04:44 +0000 | [diff] [blame] | 31 | Resource ../lib/nsd_lib.resource |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 32 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 33 | Test Tags sol003_02 cluster_osm_rest daily |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 34 | |
| 35 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 36 | |
| 37 | |
| 38 | *** Variables *** |
| 39 | # SOL003 API URI paths |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 40 | ${VNF_INSTANCE_URI} /osm/vnflcm/v1/vnf_instances |
| 41 | ${VNF_INSTANCE_LCM_OPS} /osm/vnflcm/v1/vnf_lcm_op_occs |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 42 | |
| 43 | # NS and VNF descriptor package folder and ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 44 | ${VNFD_PKG} hackfest_basic_vnf |
| 45 | ${VNFD_NAME} hackfest_basic-vnf |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 46 | |
| 47 | |
| 48 | *** Test Cases *** |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 49 | Create VNFD Descriptor |
| 50 | [Documentation] Test case to create a VNF Identifier |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 51 | ${VNFD_ID}= Create VNFD %{PACKAGES_FOLDER}/${VNFD_PKG} |
| 52 | Set Suite Variable ${VNFD_ID} |
| 53 | ${CREATED_VIM_ACCOUNT_ID}= Get VIM Target ID %{VIM_TARGET} |
| 54 | Set Suite Variable ${CREATED_VIM_ACCOUNT_ID} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 55 | Get Auth Token |
| 56 | ${json_path}= Read Directory |
| rarik | 7d7628b | 2023-12-14 07:14:53 +0000 | [diff] [blame] | 57 | ${json_obj}= Load JSON From File ${json_path}/sol003_02-dualstack_ip_vnfm.json |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 58 | ${json_obj}= Get Variable Value ${json_obj['data'][0]} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 59 | ${NS_NAME}= Get Variable Value ${json_obj['vnfInstanceName']} |
| 60 | Set Suite Variable ${NS_NAME} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 61 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} |
| 62 | Log ${UPDATED_JSON_OBJ} |
| 63 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} |
| 64 | Log ${UPDATED_JSON_OBJ} |
| 65 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} |
| 66 | Log ${UPDATED_JSON_OBJ} |
| 67 | Set Test Variable ${UPDATED_JSON_OBJ} |
| 68 | Post Api Request ${VNF_INSTANCE_URI} ${UPDATED_JSON_OBJ} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 69 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed |
| 70 | ${id}= Get Value From Json ${request_response.json()} $..id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 71 | Set Suite Variable ${CREATEID} ${id[0]} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 72 | Get VNFDs List |
| 73 | |
| 74 | Instantiate VNF |
| 75 | [Documentation] Test case to Instantiate a VNF |
| 76 | Get Ns List |
| 77 | Get Vnf List |
| 78 | Get Auth Token |
| 79 | ${json_path}= Read Directory |
| rarik | 7d7628b | 2023-12-14 07:14:53 +0000 | [diff] [blame] | 80 | ${json_obj}= Load JSON From File ${json_path}/sol003_02-dualstack_ip_vnfm.json |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 81 | ${json_obj}= Get Variable Value ${json_obj['data'][1]} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 82 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${CREATED_VIM_ACCOUNT_ID} |
| 83 | ${UPDATED_JSON_OBJ}= JSONLibrary.Update Value To Json ${UPDATED_JSON_OBJ} $..vnfId ${CREATEID} |
| 84 | Set Test Variable ${UPDATED_JSON_OBJ} |
| 85 | Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/instantiate ${UPDATED_JSON_OBJ} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 86 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed |
| 87 | ${id}= Get Value From Json ${request_response.json()} $..id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 88 | Set Suite Variable ${VNF_INSTANCE_ID} ${id[0]} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 89 | Sleep 12s |
| sritharan | 9e5450f | 2023-12-26 07:04:44 +0000 | [diff] [blame] | 90 | Check For NS Instance For Failure ${ns_name} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 91 | Get Ns List |
| 92 | Get Vnf List |
| 93 | |
| 94 | Get Ns Id |
| sritharan | 9e5450f | 2023-12-26 07:04:44 +0000 | [diff] [blame] | 95 | [Documentation] Get the NS instance id |
| 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 | |
| sritharan | 9e5450f | 2023-12-26 07:04:44 +0000 | [diff] [blame] | 99 | Get Ip From The NSD |
| 100 | [Documentation] Get the IP address from the NSD |
| 101 | ${id}= Get NSD ID From The NS ${NS_ID} |
| 102 | Set Suite Variable ${NSD_ID} ${id} |
| 103 | ${Nsd_IP}= Get NSD Ip ${NSD_ID} |
| 104 | Log ${Nsd_IP} |
| 105 | ${Nsd_IP}= Split String ${Nsd_IP} |
| 106 | Set Suite Variable ${IPV6NSD} ${Nsd_IP}[0] |
| 107 | Set Suite Variable ${IPV4NSD} ${Nsd_IP}[1] |
| 108 | Log ${IPV4NSD} |
| 109 | Log ${IPV6NSD} |
| 110 | |
| 111 | Get Dual Ip |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 112 | [Documentation] Get the IP address from the NS |
| sritharan | 9e5450f | 2023-12-26 07:04:44 +0000 | [diff] [blame] | 113 | ${Ns_IP}= Get Dual Ip ${NS_ID} |
| 114 | Log ${Ns_IP} |
| 115 | ${Ns_IP}= Split String ${Ns_IP} |
| 116 | Set Suite Variable ${IPV6NS} ${Ns_IP}[0] |
| 117 | Set Suite Variable ${IPV4NS} ${Ns_IP}[1] |
| 118 | Log ${IPV4NS} |
| 119 | Log ${IPV6NS} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 120 | |
| 121 | Verify Dual Ip |
| sritharan | 9e5450f | 2023-12-26 07:04:44 +0000 | [diff] [blame] | 122 | [Documentation] Test case to validate the IP address. |
| 123 | Should Be Equal ${IPV4NS} ${IPV4NSD} |
| 124 | Should Be Equal ${IPV6NS} ${IPV6NSD} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 125 | |
| 126 | Terminate VNF |
| 127 | [Documentation] Test case to terminate the VNF |
| 128 | Get Auth Token |
| 129 | ${json_path}= Read Directory |
| rarik | 7d7628b | 2023-12-14 07:14:53 +0000 | [diff] [blame] | 130 | ${UPDATED_JSON_OBJ}= Load JSON From File ${json_path}/sol003_02-dualstack_ip_vnfm.json |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 131 | ${UPDATED_JSON_OBJ}= Get Variable Value ${UPDATED_JSON_OBJ['data'][3]} |
| 132 | Set Suite Variable ${UPDATED_JSON_OBJ} |
| 133 | Post Api Request ${VNF_INSTANCE_URI}/${CREATEID}/terminate ${UPDATED_JSON_OBJ} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 134 | ${id}= Get Value From Json ${request_response.json()} $..id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 135 | ${terminateid}= Set Variable ${id[0]} |
| 136 | Get Api Request ${VNF_INSTANCE_LCM_OPS}/${terminateid} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 137 | ${LcmopsTerminate}= Get Value From Json ${request_response.json()} $.._id |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 138 | Log ${LcmopsTerminate[0]} |
| 139 | FOR ${index} IN RANGE 0 15 |
| 140 | Log ${index} |
| 141 | Get Api Request ${VNF_INSTANCE_LCM_OPS}/${terminateid} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 142 | ${value}= Get ID operationState |
| 143 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 144 | IF ${status} |
| 145 | BREAK |
| 146 | ELSE |
| 147 | Sleep 10s |
| 148 | END |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 149 | END |
| 150 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Terminate VNF instance completed |
| 151 | |
| 152 | Delete VNF |
| 153 | [Documentation] Test case to delete VNF |
| 154 | Get Auth Token |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 155 | Create Session APISession ${REST_API_HOST} |
| 156 | &{Headers}= Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${AccessToken} |
| 157 | ${resp}= DELETE On Session APISession ${VNF_INSTANCE_URI}/${CREATEID} headers=${Headers} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 158 | Pass Execution If ${resp.status_code} in ${success_status_code_list} Delete VNF Instance completed |
| 159 | |
| 160 | Delete VNF Descriptor Test |
| sritharan | 9e5450f | 2023-12-26 07:04:44 +0000 | [diff] [blame] | 161 | [Documentation] Test case to delete the VNF descriptor. |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 162 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 163 | Delete VNFD ${VNFD_NAME} |
| rarik | bbae1a7 | 2023-11-20 22:58:32 +0530 | [diff] [blame] | 164 | |
| 165 | |
| 166 | *** Keywords *** |
| 167 | Suite Cleanup |
| 168 | [Documentation] Test Suit Cleanup: Deleting Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 169 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |