| 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 | 68eac4a | 2023-06-27 11:21:05 +0200 | [diff] [blame] | 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/rest_lib.robot |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 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 | faaa026 | 2023-06-27 12:19:31 +0200 | [diff] [blame] | 30 | Force Tags sol003_01 cluster_osm_rest daily |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 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 | 68eac4a | 2023-06-27 11:21:05 +0200 | [diff] [blame] | 36 | # SOL003 API URI paths |
| 37 | ${vnf_instance_uri} /osm/vnflcm/v1/vnf_instances |
| 38 | ${vnf_instantiate_uri} /osm/vnflcm/v1/vnf_instances |
| 39 | ${vnf_instance_lcm_ops} /osm/vnflcm/v1/vnf_lcm_op_occs |
| 40 | |
| 41 | # NS and VNF descriptor package folder and ids |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 42 | ${vnfd_pkg} hackfest_basic_metrics_vnf |
| 43 | ${vnfd_name} hackfest_basic_metrics-vnf |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 44 | |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 45 | |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 46 | *** Test Cases *** |
| 47 | Create VNF package from JSON file descriptor |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 48 | [Documentation] Test case to create a VNF Identifier |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 49 | Get VNFDs List |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 50 | ${id}= Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' |
| 51 | Set Suite Variable ${vnfid} ${id} |
| 52 | ${created_vim_account_id}= Get VIM Target ID %{VIM_TARGET} |
| 53 | Set Suite Variable ${created_vim_account_id} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 54 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 55 | ${json_path}= Read Directory |
| 56 | ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 57 | ${json_obj}= Get Variable Value ${json_obj['data'][0]} |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 58 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} |
| 59 | Log ${updated_json_obj} |
| 60 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-desc[0][id] %{VIM_MGMT_NET} |
| 61 | Log ${updated_json_obj} |
| 62 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..additionalParams.virtual-link-profile-id %{VIM_MGMT_NET} |
| 63 | Log ${updated_json_obj} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 64 | Set Test Variable ${updated_json_obj} |
| 65 | Post API Request ${vnf_instance_uri} |
| 66 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed |
| 67 | ${id}= Get Value From Json ${request_response.json()} $..id |
| 68 | Set Suite Variable ${createid} ${id[0]} |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 69 | Get VNFDs List |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 70 | |
| 71 | Instantiate VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 72 | [Documentation] Test case to Instantiate a VNF |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 73 | Get Ns List |
| 74 | Get Vnf List |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 75 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 76 | ${json_path}= Read Directory |
| 77 | ${json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 78 | ${json_obj}= Get Variable Value ${json_obj['data'][1]} |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 79 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${json_obj} $..vimAccountId ${created_vim_account_id} |
| 80 | ${updated_json_obj}= JSONLibrary.Update Value To Json ${updated_json_obj} $..vnfId ${createid} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 81 | Set Test Variable ${updated_json_obj} |
| 82 | Post API Request ${vnf_instantiate_uri}/${createid}/instantiate |
| 83 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Instantiate VNF Instance completed |
| 84 | ${id}= Get Value From Json ${request_response.json()} $..id |
| 85 | Set Suite Variable ${instantiateid} ${id[0]} |
| 86 | Sleep 12s |
| garciadeblas | 43f3448 | 2023-02-23 17:37:47 +0100 | [diff] [blame] | 87 | Get Ns List |
| 88 | Get Vnf List |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 89 | |
| 90 | Query VNF Instances |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 91 | [Documentation] Test case to query VNF Instance |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 92 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 93 | Get Api Request ${vnf_instance_uri} |
| 94 | ${value}= Get ID nsState |
| 95 | Should Be Equal ${value} INSTANTIATED |
| 96 | Pass Execution If ${request_response.status_code} in ${success_status_code_list} Query VNF Instance completed |
| 97 | ${id}= Get Value From Json ${request_response.json()} $.._id |
| 98 | Set Suite Variable ${Queryid} ${id[0]} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 99 | |
| 100 | Query VNF Instance ID |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 101 | [Documentation] Test case to query Vnf instance ID |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 102 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 103 | Get Api Request ${vnf_instance_uri}/${Queryid} |
| 104 | ${value}= Get ID nsState |
| 105 | Should Be Equal ${value} INSTANTIATED |
| 106 | Should Be Equal As Strings ${RequestResponse.status_code} 200 |
| 107 | ${id}= Get Value From Json ${request_response.json()} $.._id |
| 108 | Set Suite Variable ${Instanceid} ${id[0]} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 109 | |
| 110 | Query VNF LCM Ops |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 111 | [Documentation] Test case to Query VNF LCM operation |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 112 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 113 | Get Api Request ${vnf_instance_lcm_ops} |
| 114 | ${ID1}= Get Value From Json ${request_response.json()} $.._id |
| 115 | Set Suite Variable ${lcmops} ${ID1[0]} |
| 116 | FOR ${Index} IN RANGE 0 15 |
| 117 | Get Api Request ${vnf_instance_lcm_ops} |
| 118 | ${value}= Get ID operationState |
| 119 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 120 | Run Keyword If ${status} Exit For Loop |
| 121 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 122 | END |
| 123 | |
| 124 | Query VNF LCM Ops ID |
| 125 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 126 | Get Api Request ${vnf_instance_lcm_ops}/${lcmops} |
| 127 | ${ID1}= Get Value From Json ${request_response.json()} $.._id |
| 128 | Set Suite Variable ${lcmopsid} ${ID1[0]} |
| 129 | FOR ${Index} IN RANGE 0 15 |
| 130 | Get Api Request ${vnf_instance_lcm_ops}/${lcmops} |
| 131 | ${value}= Get ID operationState |
| 132 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 133 | Run Keyword If ${status} Exit For Loop |
| 134 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 135 | END |
| 136 | |
| 137 | Scale VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 138 | [Documentation] Test case to Scale out VNF |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 139 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 140 | ${json_path}= Read Directory |
| 141 | ${updated_json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 142 | ${updated_json_obj}= Get Variable Value ${updated_json_obj['data'][2]} |
| 143 | Set Test Variable ${updated_json_obj} |
| 144 | Post API Request ${vnf_instance_uri}/${createid}/scale |
| 145 | ${value}= Get ID id |
| 146 | ${ID1}= Get Value From Json ${request_response.json()} $..id |
| 147 | Set Suite Variable ${scaleoutid} ${ID1[0]} |
| 148 | Get Api Request ${vnf_instance_lcm_ops}/${scaleoutid} |
| 149 | ${LcmopsScale}= Get Value From Json ${request_response.json()} $.._id |
| 150 | Set Suite Variable ${lcmopsscaleid} ${LcmopsScale[0]} |
| 151 | FOR ${Index} IN RANGE 0 15 |
| 152 | Get Api Request ${vnf_instance_lcm_ops}/${scaleoutid} |
| 153 | ${value}= Get ID operationState |
| 154 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 155 | Run Keyword If ${status} Exit For Loop |
| 156 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 157 | END |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 158 | 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] | 159 | |
| 160 | Terminate VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 161 | [Documentation] Test case to terminate the VNF |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 162 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 163 | ${json_path}= Read Directory |
| 164 | ${updated_json_obj}= Load JSON From File ${json_path}/sol003_01-vnf-lifecycle-management.json |
| 165 | ${updated_json_obj}= Get Variable Value ${updated_json_obj['data'][3]} |
| 166 | Set Suite Variable ${updated_json_obj} |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 167 | Post API Request ${vnf_instance_uri}/${createid}/terminate |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 168 | ${id}= Get Value From Json ${request_response.json()} $..id |
| 169 | Set Suite Variable ${terminateid} ${id[0]} |
| 170 | Get Api Request ${vnf_instance_lcm_ops}/${terminateid} |
| 171 | ${LcmopsTerminate}= Get Value From Json ${request_response.json()} $.._id |
| 172 | Set Suite Variable ${lcmopsscaleid} ${LcmopsTerminate[0]} |
| 173 | FOR ${Index} IN RANGE 0 15 |
| 174 | Get Api Request ${vnf_instance_lcm_ops}/${terminateid} |
| 175 | ${value}= Get ID operationState |
| 176 | ${status}= Run Keyword And Return Status Should Be Equal ${value} COMPLETED |
| 177 | Run Keyword If ${status} Exit For Loop |
| 178 | ... ELSE Sleep 10s |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 179 | END |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 180 | 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] | 181 | |
| 182 | Delete VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 183 | [Documentation] Test case to delete VNF |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 184 | Get Auth Token |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 185 | Create Session APISession ${HOST} |
| 186 | &{Headers} Create Dictionary Content-Type=application/json Accept=application/json Authorization=Bearer ${AccessToken} |
| 187 | ${resp}= DELETE On Session APISession ${vnf_instance_uri}/${createid} headers=${Headers} |
| 188 | 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] | 189 | |
| 190 | Delete VNF Descriptor Test |
| 191 | [Tags] cleanup |
| 192 | |
| 193 | Delete VNFD ${vnfd_name} |
| 194 | |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 195 | |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 196 | *** Keywords *** |
| 197 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 198 | [Documentation] Test Suit Cleanup: Deleting Descriptor |
| dhanasekaran | 6f0aed3 | 2022-05-17 14:12:40 +0200 | [diff] [blame] | 199 | |
| 200 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} |
| garciadeblas | d7f75d7 | 2022-06-25 18:38:32 +0200 | [diff] [blame] | 201 | |