| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| aguilard | b19f27f | 2021-06-30 12:21:18 +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 | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 15 | *** Settings *** |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 16 | Documentation [BASIC-19] NS with a single VNF and two VDU linked by a VLD with ip-profile. |
| aguilard | b19f27f | 2021-06-30 12:21:18 +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 | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 27 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 28 | Test Tags basic_19 cluster_main daily regression |
| aguilard | b19f27f | 2021-06-30 12:21:18 +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} ipprofile_2vm_vnf |
| 36 | ${VNFD_NAME} ipprofile_2vm-vnf |
| 37 | ${NSD_PKG} ipprofile_2vm_ns |
| 38 | ${NSD_NAME} ipprofile_2vm-ns |
| aguilard | b19f27f | 2021-06-30 12:21:18 +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_19 |
| 42 | ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 43 | |
| garciadeblas | 61bbf92 | 2022-06-25 18:12:53 +0200 | [diff] [blame] | 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 | ${USERNAME} ubuntu |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 47 | |
| 48 | # VNFs data |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 49 | ${VNF_MEMBER_INDEX_1} vnf |
| 50 | ${INTERNAL_PREFIX} ^192.168.200.* |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 51 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 52 | ${SUCCESS_RETURN_CODE} 0 |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 53 | |
| 54 | |
| 55 | *** Test Cases *** |
| 56 | Create VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 57 | [Documentation] Upload VNF package for the testsuite. |
| 58 | Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}' |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 59 | |
| 60 | Create NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 61 | [Documentation] Upload NS package for the testsuite. |
| 62 | Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}' |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 63 | |
| 64 | Instantiate Network Service |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 65 | [Documentation] Instantiate NS for the testsuite. |
| 66 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} |
| 67 | Set Suite Variable ${NS_ID} ${id} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 68 | |
| 69 | Get Vnf Info |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 70 | [Documentation] Get VNF information, specifically the VNF instance id and the mgmt IP address. |
| 71 | Variable Should Exist ${NS_ID} msg=Network service instance is not available |
| 72 | @{vnfr_list}= Get Ns Vnfr Ids ${NS_ID} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 73 | Log List ${vnfr_list} |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 74 | Set Suite Variable ${VNF_ID} ${vnfr_list}[0] |
| 75 | ${ip}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1} |
| 76 | Set Suite Variable ${VNF_IPMGMT} ${ip} |
| 77 | Log ${VNF_IPMGMT} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 78 | |
| 79 | Check Vnf IPs |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 80 | [Documentation] Check whether IP addresses are syntactically valid. |
| 81 | Variable Should Exist ${VNF_ID} msg=VNF is not available |
| 82 | ${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"' |
| 83 | Should Be Equal As Integers ${rc} ${SUCCESS_RETURN_CODE} msg=${stdout} values=False |
| 84 | Should Match Regexp ${stdout} ${INTERNAL_PREFIX} msg=${stdout} doesn't match subnet's regexp ${INTERNAL_PREFIX} |
| 85 | ${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"' |
| 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} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 88 | |
| 89 | Delete NS Instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 90 | [Documentation] Delete NS instance. |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 91 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 92 | Delete NS ${NS_NAME} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 93 | |
| 94 | Delete NS Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 95 | [Documentation] Delete NS package from OSM. |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 96 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 97 | Delete NSD ${NSD_NAME} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 98 | |
| 99 | Delete VNF Descriptor |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 100 | [Documentation] Delete VNF package from OSM. |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 101 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 102 | Delete VNFD ${VNFD_NAME} |
| aguilard | b19f27f | 2021-06-30 12:21:18 +0200 | [diff] [blame] | 103 | |
| 104 | |
| 105 | *** Keywords *** |
| 106 | Suite Cleanup |
| garciadeblas | f4ebaa8 | 2022-06-23 13:33:26 +0200 | [diff] [blame] | 107 | [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 108 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 109 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 110 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |