| aguilard | f848c14 | 2021-06-28 15:47:54 +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 [BASIC-18] NS with a VLD with a virtual link profile. |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 15 | |
| 16 | Library OperatingSystem |
| 17 | Library String |
| 18 | Library Collections |
| 19 | Library SSHLibrary |
| 20 | |
| 21 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot |
| 22 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot |
| 23 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot |
| 24 | Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot |
| 25 | |
| 26 | Force Tags basic_18 cluster_main daily regression |
| 27 | |
| 28 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 29 | |
| 30 | |
| 31 | *** Variables *** |
| 32 | # NS and VNF descriptor package folder and ids |
| 33 | ${vnfd_pkg} ubuntu_4ifaces_vnf |
| 34 | ${vnfd_name} ubuntu_4ifaces-vnf |
| 35 | ${nsd_pkg} ubuntu_4ifaces_ns |
| 36 | ${nsd_name} ubuntu_4ifaces-ns |
| 37 | |
| 38 | # NS instance name and configuration |
| 39 | ${ns_name} basic_18 |
| 40 | ${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| 41 | |
| 42 | # SSH keys and username to be used |
| 43 | ${publickey} %{HOME}/.ssh/id_rsa.pub |
| 44 | ${privatekey} %{HOME}/.ssh/id_rsa |
| 45 | ${username} ubuntu |
| 46 | |
| 47 | # VNFs data |
| 48 | ${vnf_member_index_1} vnf1 |
| 49 | ${vnf_member_index_2} vnf2 |
| garciadeblas | 6b32682 | 2022-06-08 13:15:19 +0200 | [diff] [blame] | 50 | ${iface1_name} eth1 |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 51 | ${iface2_name} eth2 |
| garciadeblas | 6b32682 | 2022-06-08 13:15:19 +0200 | [diff] [blame] | 52 | ${iface3_name} eth3 |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 53 | ${datanet1_prefix} ^192.168.10.* |
| 54 | ${datanet2_prefix} ^192.168.20.* |
| 55 | ${datanet3_prefix} ^192.168.30.* |
| 56 | |
| 57 | ${success_return_code} 0 |
| 58 | |
| 59 | |
| 60 | *** Test Cases *** |
| 61 | Create VNF Descriptor |
| 62 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 63 | Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}' |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 64 | |
| 65 | |
| 66 | Create NS Descriptor |
| 67 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 68 | Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}' |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 69 | |
| 70 | |
| 71 | Instantiate Network Service |
| 72 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 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 | |
| 77 | Get Vnfs Info |
| 78 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 79 | Variable Should Exist ${ns_id} msg=Network service instance is not available |
| 80 | @{vnfr_list}= Get Ns Vnfr Ids ${ns_id} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 81 | Log List ${vnfr_list} |
| 82 | Set Suite Variable ${vnf_id1} ${vnfr_list}[0] |
| 83 | Set Suite Variable ${vnf_id2} ${vnfr_list}[1] |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 84 | ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1} |
| 85 | Set Suite Variable ${vnf1_ipmgmt} ${ip} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 86 | Log ${vnf1_ipmgmt} |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 87 | ${ip} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2} |
| 88 | Set Suite Variable ${vnf2_ipmgmt} ${ip} |
| garciadeblas | 321726f | 2022-12-21 11:43:06 +0100 | [diff] [blame] | 89 | Log ${vnf2_ipmgmt} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 90 | |
| 91 | |
| 92 | Check Vnf1 IPs |
| 93 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 94 | Variable Should Exist ${vnf_id1} msg=VNF1 is not available |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 95 | ${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"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 96 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 97 | Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 98 | Set Suite Variable ${vnf1_ip1} ${stdout} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 99 | ${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"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 100 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 101 | Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 102 | Set Suite Variable ${vnf1_ip2} ${stdout} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 103 | ${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"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 104 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 105 | Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 106 | Set Suite Variable ${vnf1_ip3} ${stdout} |
| 107 | |
| 108 | |
| 109 | |
| 110 | Check Vnf2 IPs |
| 111 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 112 | Variable Should Exist ${vnf_id1} msg=VNF2 is not available |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 113 | ${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"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 114 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 115 | Should Match Regexp ${stdout} ${datanet1_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet1_prefix} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 116 | Set Suite Variable ${vnf2_ip1} ${stdout} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 117 | ${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"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 118 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 119 | Should Match Regexp ${stdout} ${datanet2_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet2_prefix} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 120 | Set Suite Variable ${vnf2_ip2} ${stdout} |
| garciadeblas | 9553b6f | 2023-06-19 12:00:49 +0200 | [diff] [blame] | 121 | ${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"' |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 122 | Should Be Equal As Integers ${rc} ${success_return_code} msg=${stdout} values=False |
| 123 | Should Match Regexp ${stdout} ${datanet3_prefix} msg=${stdout} doesn't match subnet's regexp ${datanet3_prefix} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 124 | Set Suite Variable ${vnf2_ip3} ${stdout} |
| 125 | |
| 126 | |
| aguilard | c5468a1 | 2022-06-10 12:58:09 +0200 | [diff] [blame] | 127 | Verify Vnf1 Interfaces |
| 128 | |
| 129 | Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available |
| 130 | Variable Should Exist ${privatekey} msg=SSH private key not available |
| 131 | Sleep 10 seconds Wait for SSH daemon to be up |
| 132 | ${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] | 133 | Log ${stdout} |
| aguilard | c5468a1 | 2022-06-10 12:58:09 +0200 | [diff] [blame] | 134 | @{ip} = Split String ${stdout} |
| 135 | Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} |
| 136 | Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix} |
| 137 | Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix} |
| 138 | |
| 139 | |
| 140 | Verify Vnf2 Interfaces |
| 141 | |
| 142 | Variable Should Exist ${vnf2_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available |
| 143 | Variable Should Exist ${privatekey} msg=SSH private key not available |
| 144 | ${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] | 145 | Log ${stdout} |
| aguilard | c5468a1 | 2022-06-10 12:58:09 +0200 | [diff] [blame] | 146 | @{ip} = Split String ${stdout} |
| 147 | Should Match Regexp ${ip}[1] ${datanet1_prefix} msg=${ip}[1] doesn't match subnet's regexp ${datanet1_prefix} |
| 148 | Should Match Regexp ${ip}[2] ${datanet2_prefix} msg=${ip}[2] doesn't match subnet's regexp ${datanet2_prefix} |
| 149 | Should Match Regexp ${ip}[3] ${datanet3_prefix} msg=${ip}[3] doesn't match subnet's regexp ${datanet3_prefix} |
| 150 | |
| 151 | |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 152 | Ping from Vnf1 to Vnf2 |
| 153 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 154 | Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_1}' is not available |
| 155 | Variable Should Exist ${privatekey} msg=SSH private key not available |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 156 | ${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] | 157 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 158 | ${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] | 159 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 160 | ${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] | 161 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 162 | ${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] | 163 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 164 | |
| 165 | |
| 166 | Ping from Vnf2 to Vnf1 |
| 167 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 168 | Variable Should Exist ${vnf1_ipmgmt} msg=IP address of the data VNF '${vnf_member_index_2}' is not available |
| 169 | Variable Should Exist ${privatekey} msg=SSH private key not available |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 170 | ${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] | 171 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 172 | ${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] | 173 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 174 | ${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] | 175 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 176 | ${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] | 177 | Log ${stdout} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 178 | |
| 179 | |
| 180 | Delete NS Instance |
| 181 | [Tags] cleanup |
| 182 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 183 | Delete NS ${ns_name} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 184 | |
| 185 | |
| 186 | Delete NS Descriptor |
| 187 | [Tags] cleanup |
| 188 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 189 | Delete NSD ${nsd_name} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 190 | |
| 191 | |
| 192 | Delete VNF Descriptor |
| 193 | [Tags] cleanup |
| 194 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 195 | Delete VNFD ${vnfd_name} |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 196 | |
| 197 | |
| 198 | *** Keywords *** |
| 199 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 200 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| aguilard | f848c14 | 2021-06-28 15:47:54 +0200 | [diff] [blame] | 201 | |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 202 | Run Keyword If Any Tests Failed Delete NS ${ns_name} |
| 203 | Run Keyword If Any Tests Failed Delete NSD ${nsd_name} |
| 204 | Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name} |