| melian | 8b1834b | 2020-05-19 10:54:18 +0000 | [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 *** |
| 16 | Library OperatingSystem |
| 17 | Library String |
| 18 | Library Collections |
| 19 | Library Process |
| 20 | Library SSHLibrary |
| 21 | |
| 22 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 23 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nst_lib.robot |
| 25 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsi_lib.robot |
| 26 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 27 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/connectivity_lib.robot |
| 28 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot |
| 29 | |
| 30 | Variables %{ROBOT_DEVOPS_FOLDER}/resources/shared_network_slicing_data.py |
| 31 | |
| 32 | Suite Teardown Run Keyword And Ignore Error Test Cleanup |
| 33 | |
| 34 | |
| 35 | *** Variables *** |
| 36 | |
| 37 | ${ns_id} ${EMPTY} |
| 38 | ${username} osm |
| 39 | ${password} osm4u |
| 40 | ${vnf_member_index} 1 |
| 41 | ${vnf_ip_addr} ${EMPTY} |
| 42 | ${nst_config} {netslice-vld: [ {name: slice_vld_mgmt, vim-network-name: %{VIM_MGMT_NET}} ] } |
| 43 | |
| 44 | |
| 45 | *** Test Cases *** |
| 46 | |
| 47 | Create Slice VNF Descriptors |
| 48 | [Documentation] Onboards all the VNFDs required for the test: vnfd1_pkg and vnfd2_pkg (in the variables file) |
| 49 | |
| 50 | [Tags] shared_network_slicing SLICING-02 |
| 51 | |
| 52 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd1_pkg}' |
| 53 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd2_pkg}' |
| 54 | |
| 55 | |
| 56 | Create Slice NS Descriptors |
| 57 | [Documentation] Onboards all the NSDs required for the test: nsd1_pkg and nsd2_pkg (in the variables file) |
| 58 | |
| 59 | [Tags] shared_network_slicing SLICING-02 |
| 60 | |
| 61 | Create NSD '%{PACKAGES_FOLDER}/${nsd1_pkg}' |
| 62 | Create NSD '%{PACKAGES_FOLDER}/${nsd2_pkg}' |
| 63 | |
| 64 | Create Slice Templates |
| 65 | [Documentation] Onboards the Network Slice Templates: nst, nst2 (in the variables file) |
| 66 | |
| 67 | [Tags] shared_network_slicing SLICING-02 |
| 68 | |
| 69 | Create NST '%{PACKAGES_FOLDER}/${nst}' |
| 70 | Create NST '%{PACKAGES_FOLDER}/${nst2}' |
| 71 | |
| 72 | Network Slice One Instance Test |
| 73 | [Documentation] Instantiates the first NST recently onboarded (nst_name) and sets the instantiation id as a suite variable (nsi_id) |
| 74 | ... The slice contains 3 NS (1 shared) |
| 75 | |
| 76 | [Tags] shared_network_slicing SLICING-02 |
| 77 | |
| 78 | ${id}= Create Network Slice ${nst_name} %{VIM_TARGET} ${slice_name} ${nst_config} ${publickey} |
| 79 | Set Suite Variable ${nsi_id} ${id} |
| 80 | |
| 81 | |
| 82 | Network Slice Two Instance Test |
| 83 | [Documentation] Instantiates the second NST recently onboarded (nst2_name) and sets the instantiation id as a suite variable (nsi2_id) |
| 84 | ... The slice contains 2 NS (1 shared) |
| 85 | |
| 86 | [Tags] shared_network_slicing SLICING-02 |
| 87 | |
| 88 | ${id}= Create Network Slice ${nst2_name} %{VIM_TARGET} ${slice2_name} ${nst_config} ${publickey} |
| 89 | Set Suite Variable ${nsi2_id} ${id} |
| 90 | |
| 91 | |
| 92 | First Network Slice Ns Count |
| 93 | [Documentation] Counts the NS in both slice instances and shoul be equal to 4 |
| 94 | |
| 95 | [Tags] shared_network_slicing SLICING-02 |
| 96 | |
| 97 | ${slice1_count}= Get Slice Ns Count ${slice_name} |
| 98 | ${slice2_count}= Get Slice Ns Count ${slice2_name} |
| 99 | ${together}= Evaluate ${slice1_count} + ${slice2_count} |
| 100 | Should Be Equal As Integers ${together} 4 |
| 101 | |
| 102 | |
| 103 | Get Middle Vnf Management Ip |
| 104 | [Documentation] Obtains the management IP of the shared NS main (only) VNF and sets it as a suite variable (mgmt_vnf_ip) |
| 105 | |
| 106 | [Tags] shared_network_slicing SLICING-02 |
| 107 | |
| 108 | ${middle_ns_id}= Run and Return RC and Output osm ns-list | grep ${middle_ns_name} | awk '{print $4}' 2>&1 |
| 109 | ${vnf_ip} Get Vnf Management Ip Address ${middle_ns_id}[1] ${vnf_member_index} |
| 110 | Set Suite Variable ${mgmt_vnf_ip} ${vnf_ip} |
| 111 | |
| 112 | |
| 113 | Get First Slice Vnf IPs |
| 114 | [Documentation] Obtains the list of IPs addresses in the first slice and sets the list as a suite variable (slice1_vnfs_ips) |
| 115 | |
| 116 | [Tags] shared_network_slicing SLICING-02 |
| 117 | |
| 118 | # Get all the ns_id in the slice except the middle one |
| 119 | @{ip_list} Get Slice Vnf Ip Addresses ${slice_name} |
| 120 | Set Suite Variable ${slice1_vnfs_ips} ${ip_list} |
| 121 | |
| 122 | |
| 123 | Test Middle Ns Ping |
| 124 | [Documentation] Pings the slice middle vnf (mgmt_vnf_ip) |
| 125 | |
| 126 | [Tags] shared_network_slicing SLICING-02 |
| 127 | |
| 128 | Sleep 60s Waiting for the network to be up |
| 129 | # Ping to the middle VNF |
| 130 | Test Connectivity ${mgmt_vnf_ip} |
| 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 | |
| 136 | [Tags] shared_network_slicing SLICING-02 |
| 137 | |
| 138 | Sleep 30s Waiting ssh daemon to be up |
| 139 | Test SSH Connection ${mgmt_vnf_ip} ${username} ${password} ${privatekey} |
| 140 | |
| 141 | |
| 142 | Test First Slice Connectivity |
| 143 | [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file |
| 144 | ... and pings all the IP addresses in the list (slice1_vnfs_ips) |
| 145 | |
| 146 | [Tags] shared_network_slicing SLICING-02 |
| 147 | |
| 148 | Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice1_vnfs_ips} |
| 149 | |
| 150 | |
| 151 | Stop Slice One Instance |
| 152 | [Documentation] Stops the slice instance (slice_name) |
| 153 | |
| 154 | [Tags] shared_network_slicing SLICING-02 cleanup |
| 155 | |
| 156 | Delete NSI ${slice_name} |
| 157 | |
| 158 | |
| 159 | Second Network Slice Ns Count |
| 160 | [Documentation] Counts the NS in both slice instances and should be equal to 2 |
| 161 | |
| 162 | [Tags] shared_network_slicing SLICING-02 |
| 163 | |
| 164 | ${slice1_count}= Get Slice Ns Count ${slice_name} |
| 165 | ${slice2_count}= Get Slice Ns Count ${slice2_name} |
| 166 | ${together}= Evaluate ${slice1_count} + ${slice2_count} |
| 167 | Should Be Equal As Integers ${together} 2 |
| 168 | |
| 169 | Get Second Slice Vnf IPs |
| 170 | [Documentation] Obtains the list of IPs addresses in the second slice and sets the list as a suite variable (slice2_vnfs_ips) |
| 171 | |
| 172 | [Tags] shared_network_slicing SLICING-02 |
| 173 | |
| 174 | # Get all the ns_id in the slice |
| 175 | @{ip_list} Get Slice Vnf Ip Addresses ${slice2_name} |
| 176 | Set Suite Variable ${slice2_vnfs_ips} ${ip_list} |
| 177 | |
| 178 | |
| 179 | Test Second Slice Connectivity |
| 180 | [Documentation] SSH access to the slice middle vnf (mgmt_vnf_ip) with the credentials provided in the variables file |
| 181 | ... and pings all the IP addresses in the list (slice2_vnfs_ips) |
| 182 | |
| 183 | [Tags] shared_network_slicing SLICING-02 |
| 184 | |
| 185 | Ping Many ${mgmt_vnf_ip} ${username} ${password} ${privatekey} @{slice2_vnfs_ips} |
| 186 | |
| 187 | |
| 188 | Stop Slice Two Instance |
| 189 | [Documentation] Stops the slice instance (slice2_name) |
| 190 | |
| 191 | [Tags] shared_network_slicing SLICING-02 cleanup |
| 192 | |
| 193 | Delete NSI ${slice2_name} |
| 194 | |
| 195 | |
| 196 | Delete Slice One Template |
| 197 | [Documentation] Deletes the NST (nst_name) from OSM |
| 198 | |
| 199 | [Tags] shared_network_slicing SLICING-02 cleanup |
| 200 | |
| 201 | Delete NST ${nst_name} |
| 202 | |
| 203 | |
| 204 | Delete Slice Two Template |
| 205 | [Documentation] Deletes the NST (nst2_name) from OSM |
| 206 | |
| 207 | [Tags] shared_network_slicing SLICING-02 cleanup |
| 208 | |
| 209 | Delete NST ${nst2_name} |
| 210 | |
| 211 | |
| 212 | Delete NS Descriptors |
| 213 | [Documentation] Deletes all the NSDs created for the test: nsd1_name, nsd2_name |
| 214 | |
| 215 | [Tags] shared_network_slicing SLICING-02 cleanup |
| 216 | |
| 217 | Delete NSD ${nsd1_name} |
| 218 | Delete NSD ${nsd2_name} |
| 219 | |
| 220 | |
| 221 | Delete VNF Descriptors |
| 222 | [Documentation] Deletes all the VNFDs created for the test: vnfd1_name, vnfd2_name |
| 223 | |
| 224 | [Tags] shared_network_slicing SLICING-02 cleanup |
| 225 | |
| 226 | Delete VNFD ${vnfd1_name} |
| 227 | Delete VNFD ${vnfd2_name} |
| 228 | |
| 229 | |
| 230 | *** Keywords *** |
| 231 | Test Cleanup |
| 232 | [Documentation] Test Suit Cleanup: Deleting Descriptors, instance and templates |
| 233 | |
| 234 | Run Keyword If Test Failed Delete NST ${nst_name} |
| 235 | Run Keyword If Test Failed Delete NST ${nst2_name} |
| 236 | |
| 237 | Run Keyword If Test Failed Delete NSD ${nsd1_name} |
| 238 | Run Keyword If Test Failed Delete NSD ${nsd2_name} |
| 239 | |
| 240 | Run Keyword If Test Failed Delete VNFD ${vnfd1_name} |
| 241 | Run Keyword If Test Failed Delete VNFD ${vnfd2_name} |
| 242 | |
| 243 | |
| 244 | |