| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [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 | |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 15 | *** Settings *** |
| 16 | Documentation [BASIC-30] NS with a single VNF and two VDU linked by a VLD with ipv6-profile. |
| 17 | |
| 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library SSHLibrary |
| 22 | Library JSONLibrary |
| 23 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 24 | Resource ../lib/vnf_lib.resource |
| 25 | Resource ../lib/vnfd_lib.resource |
| 26 | Resource ../lib/nsd_lib.resource |
| 27 | Resource ../lib/ns_lib.resource |
| 28 | Resource ../lib/ssh_lib.resource |
| 29 | Resource ../lib/openstack_lib.resource |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 30 | |
| garciadeblas | 166c891 | 2023-12-16 10:51:48 +0100 | [diff] [blame] | 31 | Test Tags basic_30 cluster_main daily regression |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 32 | |
| 33 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 34 | |
| 35 | |
| 36 | *** Variables *** |
| 37 | # NS and VNF descriptor package folder and ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 38 | ${VNFD_PKG} ubuntu_4ifaces_vnf |
| 39 | ${VNFD_NAME} ubuntu_4ifaces-vnf |
| 40 | ${NSD_PKG} ubuntu_4ifaces_ipv6_ns |
| 41 | ${NSD_NAME} ubuntu_4ifaces-ipv6-ns |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 42 | |
| 43 | # NS instance name and configuration |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 44 | ${NS_NAME} basic_30 |
| 45 | ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 46 | |
| 47 | # SSH keys and username to be used |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 48 | ${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub |
| 49 | ${PRIVATEKEY} %{HOME}/.ssh/id_rsa |
| 50 | ${USERNAME} ubuntu |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 51 | |
| 52 | # VNFs data |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 53 | ${VNF_MEMBER_INDEX_1} vnf1 |
| 54 | ${VNF_MEMBER_INDEX_2} vnf2 |
| 55 | ${IFACE1_NAME} eth1 |
| 56 | ${DATANET1_PREFIX} ^2001:db8::* |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 57 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 58 | ${SUCCESS_RETURN_CODE} 0 |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 59 | |
| 60 | |
| 61 | *** Test Cases *** |
| 62 | Create VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 63 | [Documentation] Upload VNF package for the testsuite. |
| 64 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 65 | |
| 66 | Create NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 67 | [Documentation] Upload NS package for the testsuite. |
| 68 | Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 69 | |
| 70 | Instantiate Network Service |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 71 | [Documentation] Instantiate NS for the testsuite. |
| 72 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} |
| 73 | Set Suite Variable ${NS_ID} ${id} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 74 | |
| 75 | Get Vnfs Info |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 76 | [Documentation] Get information from the two VNF of the NS, specifically VNF instance id and mgmt IP address. |
| 77 | Variable Should Exist ${NS_ID} msg=Network service instance is not available |
| 78 | @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 79 | Log List ${vnfr_list} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 80 | Set Suite Variable ${VNF_ID1} ${vnfr_list}[0] |
| 81 | Set Suite Variable ${VNF_ID2} ${vnfr_list}[1] |
| 82 | ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} |
| 83 | Set Suite Variable ${VNF1_IPMGMT} ${ip} |
| 84 | Log ${VNF1_IPMGMT} |
| 85 | ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2} |
| 86 | Set Suite Variable ${VNF2_IPMGMT} ${ip} |
| 87 | Log ${VNF2_IPMGMT} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 88 | |
| 89 | Check Vnf1 IPs |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 90 | [Documentation] Check whether IP addresses of the first VNF in the VNF record meet the expected CIDR. |
| 91 | Variable Should Exist ${VNF_ID1} msg=VNF1 is not available |
| 92 | ${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"' |
| 93 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 94 | Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} |
| 95 | Set Suite Variable ${VNF1_IP1} ${stdout} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 96 | |
| 97 | Check Vnf2 IPs |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 98 | [Documentation] Check whether IP addresses of the second VNF in the VNF record meet the expected CIDR. |
| 99 | Variable Should Exist ${VNF_ID2} msg=VNF2 is not available |
| 100 | ${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"' |
| 101 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 102 | Should Match Regexp ${stdout} ${DATANET1_PREFIX} msg=${stdout} doesn't match subnet's regexp ${DATANET1_PREFIX} |
| 103 | Set Suite Variable ${VNF2_IP1} ${stdout} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 104 | |
| 105 | Verify Vnf1 Interfaces |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 106 | [Documentation] Check whether IP addresses of the first VNF configured inside the VM meet the expected CIDR. |
| 107 | Variable Should Exist ${VNF1_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_1}' is not available |
| 108 | Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 109 | Sleep 120 seconds Wait for SSH daemon to be up |
| garciadeblas | 9f2d28a | 2024-10-02 15:44:44 +0200 | [diff] [blame] | 110 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} sudo timeout 30s dhclient -v -6 ens4 |
| 111 | Log ${stdout} |
| 112 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF1_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 113 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 114 | @{ip}= Split String ${stdout} |
| 115 | Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 116 | |
| 117 | Verify Vnf2 Interfaces |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 118 | [Documentation] Check whether IP addresses of the second VNF configured inside the VM meet the expected CIDR. |
| 119 | Variable Should Exist ${VNF2_IPMGMT} msg=IP address of the data VNF '${VNF_MEMBER_INDEX_2}' is not available |
| 120 | Variable Should Exist ${PRIVATEKEY} msg=SSH private key not available |
| garciadeblas | 9f2d28a | 2024-10-02 15:44:44 +0200 | [diff] [blame] | 121 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} sudo timeout 30s dhclient -v -6 ens4 |
| 122 | Log ${stdout} |
| 123 | ${stdout}= Execute Remote Command Check Rc Return Output ${VNF2_IPMGMT} ${USERNAME} ${EMPTY} ${PRIVATEKEY} ip --brief addr show up | grep -v "^lo" | awk '{print $3}' |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 124 | Log ${stdout} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 125 | @{ip}= Split String ${stdout} |
| 126 | Should Match Regexp ${ip}[1] ${DATANET1_PREFIX} msg=${ip}[1] doesn't match subnet's regexp ${DATANET1_PREFIX} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 127 | |
| 128 | Check that ipv6 address_mode and ra_mode are set |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 129 | [Documentation] Check that IPv6 address mode and RA mode are set and equal to dhcpv6-stateful. |
| 130 | ${rc} ${vim_info}= Run And Return RC And Output osm vnf-show ${VNF_ID1} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq -r '.vim_info[].interfaces[].vim_info' |
| 131 | Log ${rc},${vim_info} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 132 | ${subnet_id}= Get Regexp Matches ${vim_info} {ip_address: '2001:db8::.*', subnet_id: ([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})} 1 |
| 133 | ${subnet_info}= Get Subnet ${subnet_id}[0] |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 134 | ${json_object}= Convert String To JSON ${subnet_info} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 135 | ${address_mode}= Get From Dictionary ${json_object} ipv6_address_mode |
| 136 | ${ra_mode}= Get From Dictionary ${json_object} ipv6_ra_mode |
| 137 | Should Be Equal ${address_mode} dhcpv6-stateful msg=ipv6_address_mode does not equal dhcpv6-stateful |
| 138 | Should Be Equal ${ra_mode} dhcpv6-stateful msg=ipv6_ra_mode does not equal dhcpv6-stateful |
| 139 | |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 140 | Delete NS Instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 141 | [Documentation] Delete NS instance. |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 142 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 143 | Delete NS ${NS_NAME} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 144 | |
| 145 | Delete NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 146 | [Documentation] Delete NS package from OSM. |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 147 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 148 | Delete NSD ${NSD_NAME} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 149 | |
| 150 | Delete VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 151 | [Documentation] Delete VNF package from OSM. |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 152 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 153 | Delete VNFD ${VNFD_NAME} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 154 | |
| 155 | |
| 156 | *** Keywords *** |
| 157 | Suite Cleanup |
| 158 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| 159 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 160 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 161 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 162 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |