| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [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 | |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 15 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 16 | Documentation [BASIC-18] NS with a VLD with a virtual link profile. |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 17 | |
| 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library SSHLibrary |
| 22 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 23 | Resource ../lib/vnfd_lib.resource |
| 24 | Resource ../lib/nsd_lib.resource |
| 25 | Resource ../lib/ns_lib.resource |
| 26 | Resource ../lib/ssh_lib.resource |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 27 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 28 | Test Tags basic_18 cluster_main daily regression |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 29 | |
| 30 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 31 | |
| 32 | |
| 33 | *** Variables *** |
| 34 | # NS and VNF descriptor package folder and ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 35 | ${VNFD_PKG} ubuntu_4ifaces_vnf |
| 36 | ${VNFD_NAME} ubuntu_4ifaces-vnf |
| 37 | ${NSD_PKG} ubuntu_4ifaces_ns |
| 38 | ${NSD_NAME} ubuntu_4ifaces-ns |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 39 | |
| 40 | # NS instance name and configuration |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 41 | ${NS_NAME} basic_18 |
| 42 | ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 43 | |
| 44 | # SSH keys and username to be used |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 45 | ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub |
| 46 | ${PRIVATEKEY} %{HOME}/.ssh/id_rsa |
| 47 | ${USERNAME} ubuntu |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 48 | |
| 49 | # VNFs data |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 50 | ${VNF_MEMBER_INDEX_1} vnf1 |
| 51 | ${VNF_MEMBER_INDEX_2} vnf2 |
| 52 | ${IFACE1_NAME} eth1 |
| 53 | ${IFACE2_NAME} eth2 |
| 54 | ${IFACE3_NAME} eth3 |
| 55 | ${DATANET1_PREFIX} ^192.168.10.* |
| 56 | ${DATANET2_PREFIX} ^192.168.20.* |
| 57 | ${DATANET3_PREFIX} ^192.168.30.* |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 58 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 59 | ${SUCCESS_RETURN_CODE} 0 |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 60 | |
| 61 | |
| 62 | *** Test Cases *** |
| 63 | Create VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 64 | [Documentation] Upload VNF package for the testsuite. |
| 65 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 66 | |
| 67 | Create NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 68 | [Documentation] Upload NS package for the testsuite. |
| 69 | Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 70 | |
| 71 | Instantiate Network Service |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 72 | [Documentation] Instantiate NS for the testsuite. |
| 73 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} |
| 74 | Set Suite Variable ${NS_ID} ${id} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 75 | |
| 76 | Get Vnfs Info |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 77 | [Documentation] Get information from the two VNF of the Ns, specifically the VNF instance id and the mgmt IP address. |
| 78 | Variable Should Exist ${NS_ID} msg=Network service instance is not available |
| 79 | @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 80 | Log List ${vnfr_list} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 81 | Set Suite Variable ${VNF_ID1} ${vnfr_list}[0] |
| 82 | Set Suite Variable ${VNF_ID2} ${vnfr_list}[1] |
| 83 | ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} |
| 84 | Set Suite Variable ${VNF1_IPMGMT} ${ip} |
| 85 | Log ${VNF1_IPMGMT} |
| 86 | ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} |
| 87 | Set Suite Variable ${VNF2_IPMGMT} ${ip} |
| 88 | Log ${VNF2_IPMGMT} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 89 | |
| 90 | Check Vnf1 IPs |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 91 | [Documentation] Check whether IP addresses of the first VNF in the VNF record meet the expected CIDR. |
| 92 | Variable Should Exist ${VNF_ID1} msg=VNF1 is not available |
| 93 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"' |
| 94 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 95 | Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} |
| 96 | Set Suite Variable ${VNF1_IP1} ${stdout} |
| 97 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE2_NAME}")' | yq -r '."ip-address"' |
| 98 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 99 | Should Match Regexp ${stdout} ${DATANET2_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET2_PREFIX} |
| 100 | Set Suite Variable ${VNF1_IP2} ${stdout} |
| 101 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE3_NAME}")' | yq -r '."ip-address"' |
| 102 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 103 | Should Match Regexp ${stdout} ${DATANET3_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET3_PREFIX} |
| 104 | Set Suite Variable ${VNF1_IP3} ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 105 | |
| 106 | Check Vnf2 IPs |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 107 | [Documentation] Check whether IP addresses of the second VNF in the VNF record meet the expected CIDR. |
| 108 | Variable Should Exist ${VNF_ID1} msg=VNF2 is not available |
| 109 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE1_NAME}")' | yq -r '."ip-address"' |
| 110 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 111 | Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} |
| 112 | Set Suite Variable ${VNF2_IP1} ${stdout} |
| 113 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE2_NAME}")' | yq -r '."ip-address"' |
| 114 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 115 | Should Match Regexp ${stdout} ${DATANET2_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET2_PREFIX} |
| 116 | Set Suite Variable ${VNF2_IP2} ${stdout} |
| 117 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID2} --literal | yq '.vdur[0].interfaces[] | select(.name == "${IFACE3_NAME}")' | yq -r '."ip-address"' |
| 118 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 119 | Should Match Regexp ${stdout} ${DATANET3_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET3_PREFIX} |
| 120 | Set Suite Variable ${VNF2_IP3} ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 121 | |
| aguilard | c5468a1 | 2022-06-10 12:58:09 +0200 | [diff] [blame] | 122 | Verify Vnf1 Interfaces |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 123 | [Documentation] Check whether IP addresses of the first VNF configured inside the VM meet the expected CIDR. |
| 124 | Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available |
| 125 | Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available |
| aguilard | c5468a1 | 2022-06-10 12:58:09 +0200 | [diff] [blame] | 126 | Sleep 10 seconds Wait for SSH daemon to be up |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 127 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 128 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 129 | @{ip}= Split String ${stdout} |
| 130 | Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} |
| 131 | Should Match Regexp ${ip}[2] ${DATANET2_PREFIX} msg=${ip}[2] doesn't match subnet's regexp ${DATANET2_PREFIX} |
| 132 | Should Match Regexp ${ip}[3] ${DATANET3_PREFIX} msg=${ip}[3] doesn't match subnet's regexp ${DATANET3_PREFIX} |
| aguilard | c5468a1 | 2022-06-10 12:58:09 +0200 | [diff] [blame] | 133 | |
| 134 | Verify Vnf2 Interfaces |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 135 | [Documentation] Check whether IP addresses of the second VNF configured inside the VM meet the expected CIDR. |
| 136 | Variable Should Exist ${VNF2_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available |
| 137 | Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available |
| 138 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 139 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 140 | @{ip}= Split String ${stdout} |
| 141 | Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} |
| 142 | Should Match Regexp ${ip}[2] ${DATANET2_PREFIX} msg=${ip}[2] doesn't match subnet's regexp ${DATANET2_PREFIX} |
| 143 | Should Match Regexp ${ip}[3] ${DATANET3_PREFIX} msg=${ip}[3] doesn't match subnet's regexp ${DATANET3_PREFIX} |
| aguilard | c5468a1 | 2022-06-10 12:58:09 +0200 | [diff] [blame] | 144 | |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 145 | Ping from Vnf1 to Vnf2 |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 146 | [Documentation] Check connectivity from the first VNF to the second VNF using ping. |
| 147 | Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available |
| 148 | Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available |
| 149 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF2_IPMGMT} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 150 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 151 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP1} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 152 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 153 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP2} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 154 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 155 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ping -c 5 ${VNF2_IP3} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 156 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 157 | |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 158 | Ping from Vnf2 to Vnf1 |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 159 | [Documentation] Check connectivity from the second VNF to the first VNF using ping. |
| 160 | Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available |
| 161 | Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available |
| 162 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IPMGMT} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 163 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 164 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP1} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 165 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 166 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP2} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 167 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 168 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip addr ; ping -c 5 ${VNF1_IP3} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 169 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 170 | |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 171 | Delete NS Instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 172 | [Documentation] Delete NS instance. |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 173 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 174 | Delete NS ${NS_NAME} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 175 | |
| 176 | Delete NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 177 | [Documentation] Delete NS package from OSM. |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 178 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 179 | Delete NSD ${NSD_NAME} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 180 | |
| 181 | Delete VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 182 | [Documentation] Delete VNF package from OSM. |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 183 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 184 | Delete VNFD ${VNFD_NAME} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 185 | |
| 186 | |
| 187 | *** Keywords *** |
| 188 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 189 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 190 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 191 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 192 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |