| 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-29] 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_29 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} ipv6profile_2vm_vnf |
| 39 | ${VNFD_NAME} ipv6profile_2vm-vnf |
| 40 | ${NSD_PKG} ipv6profile_2vm_ns |
| 41 | ${NSD_NAME} ipv6profile_2vm-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_29 |
| 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 | ${USERNAME} ubuntu |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 50 | |
| 51 | # VNFs data |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 52 | ${VNF_MEMBER_INDEX_1} vnf |
| 53 | ${INTERNAL_PREFIX} ^2001:db8::* |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 54 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 55 | ${SUCCESS_RETURN_CODE} 0 |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 56 | |
| 57 | |
| 58 | *** Test Cases *** |
| 59 | Create VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 60 | [Documentation] Upload VNF package for the testsuite. |
| 61 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 62 | |
| 63 | Create NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 64 | [Documentation] Upload NS package for the testsuite. |
| 65 | Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 66 | |
| 67 | Instantiate Network Service |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 68 | [Documentation] Instantiate NS for the testsuite. |
| 69 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} |
| 70 | Set Suite Variable ${NS_ID} ${id} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 71 | |
| 72 | Get Vnf Info |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 73 | [Documentation] Get VNF information, specifically VNF instance id and mgmt IP address. |
| 74 | Variable Should Exist ${NS_ID} msg=Network service instance is not available |
| 75 | @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 76 | Log List ${vnfr_list} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 77 | Set Suite Variable ${VNF_ID} ${vnfr_list}[0] |
| 78 | ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} |
| 79 | Set Suite Variable ${VNF_IPMGMT} ${ip} |
| 80 | Log ${VNF_IPMGMT} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 81 | |
| 82 | Check Vnf IPs |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 83 | [Documentation] Check whether IP addresses are syntactically valid. |
| 84 | Variable Should Exist ${VNF_ID} msg=VNF is not available |
| 85 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[0].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' |
| 86 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 87 | Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX} |
| 88 | ${rc} ${stdout}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[1].interfaces[] | select(."vnf-vld-id" == "internal")' | yq -r '."ip-address"' |
| 89 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 90 | Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 91 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 92 | Check That Ipv6 Address_mode And Ra_mode Are Set |
| 93 | [Documentation] Check that IPv6 address mode and RA mode are set and equal to dhcpv6-stateful. |
| 94 | ${rc} ${vim_info}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq '.vdur[] | select(."count-index" == 0)' | yq -r '.vim_info[].interfaces[].vim_info' |
| 95 | Log ${rc},${vim_info} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 96 | ${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 |
| 97 | ${subnet_info}= Get Subnet ${subnet_id}[0] |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 98 | ${json_object}= Convert String To JSON ${subnet_info} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 99 | ${address_mode}= Get From Dictionary ${json_object} ipv6_address_mode |
| 100 | ${ra_mode}= Get From Dictionary ${json_object} ipv6_ra_mode |
| 101 | Should Be Equal ${address_mode} dhcpv6-stateful msg=ipv6_address_mode does not equals to dhcpv6-stateful |
| 102 | Should Be Equal ${ra_mode} dhcpv6-stateful msg=ipv6_ra_mode does not equals to dhcpv6-stateful |
| 103 | |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 104 | Delete NS Instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 105 | [Documentation] Delete NS instance. |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 106 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 107 | Delete NS ${NS_NAME} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 108 | |
| 109 | Delete NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 110 | [Documentation] Delete NS package from OSM. |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 111 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 112 | Delete NSD ${NSD_NAME} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 113 | |
| 114 | Delete VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 115 | [Documentation] Delete VNF package from OSM. |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 116 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 117 | Delete VNFD ${VNFD_NAME} |
| Gabriel Cuba | 245b04f | 2023-05-09 12:37:29 -0500 | [diff] [blame] | 118 | |
| 119 | |
| 120 | *** Keywords *** |
| 121 | Suite Cleanup |
| 122 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 123 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 124 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 125 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |