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