| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 1 | # Copyright 2020 Atos |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 16 | Documentation [SLICE-01] Network Slicing. |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 17 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library Process |
| 22 | Library SSHLibrary |
| 23 | Library yaml |
| 24 | |
| 25 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 26 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 27 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot |
| 28 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot |
| 29 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 30 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot |
| 31 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot |
| 32 | |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 33 | Force Tags slice_01 cluster_slices daily regression |
| 34 | |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 35 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 36 | |
| 37 | |
| 38 | *** Variables *** |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 39 | # NS and VNF descriptor package files |
| 40 | ${vnfd1_pkg} slice_basic_vnf |
| 41 | ${vnfd2_pkg} slice_basic_middle_vnf |
| 42 | ${nsd1_pkg} slice_basic_ns |
| 43 | ${nsd2_pkg} slice_basic_middle_ns |
| 44 | ${nst} slice_basic_nst/slice_basic_nst.yaml |
| aguilarherna | 576487e | 2021-05-05 15:47:11 +0000 | [diff] [blame] | 45 | |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 46 | # Descriptor names |
| 47 | ${nst_name} slice_basic_nst |
| 48 | ${vnfd1_name} slice_basic_vnf |
| 49 | ${vnfd2_name} slice_basic_middle_vnf |
| 50 | ${nsd1_name} slice_basic_ns |
| 51 | ${nsd2_name} slice_basic_middle_ns |
| 52 | |
| 53 | # Instance names |
| 54 | ${slice_name} slicebasic |
| 55 | ${middle_ns_name} slicebasic.slice_basic_nsd_2 |
| 56 | |
| 57 | # SSH keys and username to be used |
| 58 | ${publickey} %{HOME}/.ssh/id_rsa.pub |
| 59 | ${privatekey} %{HOME}/.ssh/id_rsa |
| aguilarherna | c0b3a8e | 2021-05-12 08:56:23 +0000 | [diff] [blame] | 60 | ${username} ubuntu |
| 61 | ${password} ${EMPTY} |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 62 | |
| 63 | ${ns_id} ${EMPTY} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 64 | ${vnf_member_index} middle |
| 65 | ${vnf_ip_addr} ${EMPTY} |
| 66 | ${mgmt_vnf_ip} ${EMPTY} |
| 67 | ${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } |
| 68 | |
| aguilarherna | c0b3a8e | 2021-05-12 08:56:23 +0000 | [diff] [blame] | 69 | |
| almagia | b4697d3 | 2021-05-25 08:56:17 +0200 | [diff] [blame] | 70 | *** Test Cases *** |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 71 | Create Slice VNF Descriptors |
| 72 | [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file) |
| 73 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 74 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}' |
| 75 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}' |
| 76 | |
| 77 | |
| 78 | Create Slice NS Descriptors |
| 79 | [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file) |
| 80 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 81 | Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}' |
| 82 | Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}' |
| 83 | |
| 84 | Create Slice Template |
| 85 | [Documentation] Onboards the Network Slice Template: nst (in the variables file) |
| 86 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 87 | Create NST '%{PACKAGES_FOLDER}/${nst}' |
| 88 | |
| 89 | Network Slice Instance Test |
| 90 | [Documentation] Instantiates the NST recently onboarded and sets the instantiation id as a suite variable (nsi_id) |
| 91 | |
| garciadeblas | 6e121fd | 2022-05-20 13:13:01 +0200 | [diff] [blame] | 92 | ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 93 | Set Suite Variable ${nsi_id} ${id} |
| 94 | |
| 95 | |
| 96 | Get Middle Vnf Management Ip |
| 97 | [Documentation] Obtains the management IP of the slice middle VNF (name in the reources file) and sets the ip as a suite variable (mgmt_vnf_ip) |
| 98 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 99 | ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1 |
| 100 | ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 101 | Run Keyword If '${vnf_ip}' == '${EMPTY}' Fatal Error Variable \$\{ vnf_ip\} Empty |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 102 | Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip} |
| 103 | |
| 104 | |
| 105 | Get Slice Vnf Ip Addresses |
| 106 | [Documentation] Obtains the list of IPs addresses in the slice and sets the list as a suite variable (slice_vnfs_ips) |
| 107 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 108 | # Get all the ns_id in the slice except the middle one to avoid self ping |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 109 | @{slice_ns_list} Get Slice Ns List Except One ${slice_name} ${middle_ns_name} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 110 | log many @{slice_ns_list} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 111 | @{temp_list}= Create List |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 112 | # For each ns_id in the list, get all the vnf_id and their IP addresses |
| 113 | FOR ${ns_id} IN @{slice_ns_list} |
| 114 | log ${ns_id} |
| 115 | @{vnf_id_list} Get Ns Vnf List ${ns_id} |
| 116 | # For each vnf_id in the list, get all its IP addresses |
| 117 | @{ns_ip_list} Get Ns Ip List @{vnf_id_list} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 118 | @{temp_list}= Combine Lists ${temp_list} ${ns_ip_list} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 119 | END |
| 120 | Log List ${temp_list} |
| 121 | Set Suite Variable ${slice_vnfs_ips} ${temp_list} |
| 122 | |
| 123 | |
| 124 | Test Middle Ns Ping |
| 125 | [Documentation] Pings the slice middle vnf (mgmt_vnf_ip) |
| 126 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 127 | Sleep 60s Waiting for the network to be up |
| 128 | # Ping to the middle VNF |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 129 | log ${mgmt_vnf_ip} |
| 130 | Test Connectivity ${mgmt_vnf_ip} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 131 | |
| 132 | |
| 133 | Test Middle Vnf SSH Access |
| 134 | [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file |
| 135 | |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 136 | Sleep 30s Waiting ssh daemon to be up |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 137 | Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 138 | |
| 139 | |
| 140 | Test Slice Connectivity |
| 141 | [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 142 | ... and pings all the IP addresses in the list (slice_vnfs_ips) |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 143 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 144 | Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice_vnfs_ips} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 145 | |
| 146 | |
| garciadeblas | 1508145 | 2020-10-02 20:50:49 +0000 | [diff] [blame] | 147 | Delete Slice Instance |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 148 | [Documentation] Stops the slice instance (slice_name) |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 149 | [Tags] cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 150 | |
| 151 | Delete NSI ${slice_name} |
| 152 | |
| 153 | |
| 154 | Delete Slice Template |
| 155 | [Documentation] Deletes the NST (nst_name) from OSM |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 156 | [Tags] cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 157 | |
| 158 | Delete NST ${nst_name} |
| 159 | |
| 160 | |
| 161 | Delete NS Descriptors |
| 162 | [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 163 | [Tags] cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 164 | |
| 165 | Delete NSD ${nsd1_name} |
| 166 | Delete NSD ${nsd2_name} |
| 167 | |
| 168 | |
| 169 | Delete VNF Descriptors |
| 170 | [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name |
| garciadeblas | 4cf45d7 | 2021-04-08 13:52:22 +0200 | [diff] [blame] | 171 | [Tags] cleanup |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 172 | |
| 173 | Delete VNFD ${vnfd1_name} |
| 174 | Delete VNFD ${vnfd2_name} |
| 175 | |
| 176 | |
| 177 | *** Keywords *** |
| garciadeblas | d225e55 | 2020-10-02 16:10:14 +0000 | [diff] [blame] | 178 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 179 | [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and template |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 180 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 181 | Run Keyword If Any Tests Failed Delete NSI ${slice_name} |
| garciadeblas | 1508145 | 2020-10-02 20:50:49 +0000 | [diff] [blame] | 182 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 183 | Run Keyword If Any Tests Failed Delete NST ${nst_name} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 184 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 185 | Run Keyword If Any Tests Failed Delete NSD ${nsd1_name} |
| 186 | Run Keyword If Any Tests Failed Delete NSD ${nsd2_name} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 187 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame^] | 188 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd1_name} |
| 189 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd2_name} |
| Felipe Vicens | f96bb45 | 2020-06-22 08:12:30 +0200 | [diff] [blame] | 190 | |
| 191 | |
| 192 | |