| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 1 | *** Comments *** |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -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 | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 15 | *** Settings *** |
| 16 | Documentation [BASIC-31] Basic NS with two multi-VDU VNF |
| 17 | |
| 18 | Library OperatingSystem |
| 19 | Library String |
| 20 | Library Collections |
| 21 | Library Process |
| 22 | Library SSHLibrary |
| 23 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 24 | Resource ../lib/vnfd_lib.resource |
| 25 | Resource ../lib/nsd_lib.resource |
| 26 | Resource ../lib/ns_lib.resource |
| 27 | Resource ../lib/connectivity_lib.resource |
| 28 | Resource ../lib/ssh_lib.resource |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 29 | |
| garciadeblas | 166c891 | 2023-12-16 10:51:48 +0100 | [diff] [blame] | 30 | Test Tags basic_31 cluster_main daily regression |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 31 | |
| 32 | Suite Teardown Run Keyword And Ignore Error Suite Cleanup |
| 33 | |
| 34 | |
| 35 | *** Variables *** |
| 36 | # NS and VNF descriptor package folder and ids |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 37 | ${VNFD_PKG} multivdu_multiattach_vnf |
| 38 | ${VNFD_NAME} multivdu_multiattach-vnf |
| 39 | ${NSD_PKG} multivdu_multiattach_ns |
| 40 | ${NSD_NAME} multivdu_multiattach-ns |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 41 | |
| 42 | # NS instance name and configuration |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 43 | ${NS_NAME} multivdu_multiattach |
| 44 | ${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] } |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 45 | |
| 46 | # SSH keys and username to be used |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 47 | ${VDU0_USERNAME} ubuntu |
| 48 | ${VDU0_PASSWORD} ${EMPTY} |
| 49 | ${VDU0_PUBLICKEY} %{HOME}/.ssh/id_rsa.pub |
| 50 | ${VDU0_PRIVATEKEY} %{HOME}/.ssh/id_rsa |
| 51 | ${VDU1_USERNAME} ubuntu |
| 52 | ${VDU1_PASSWORD} osmpass |
| 53 | ${VDU1_PUBLICKEY} ${EMPTY} |
| 54 | ${VDU1_PRIVATEKEY} ${EMPTY} |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 55 | |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 56 | ${NS_ID} ${EMPTY} |
| 57 | ${VNF_MEMBER_INDEX} vnf |
| 58 | ${VNF_IP_ADDR} ${EMPTY} |
| 59 | ${WAIT_GUARD_FOR_VM_BOOT} 50s |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 60 | |
| 61 | |
| 62 | *** Test Cases *** |
| vegall | 1d03986 | 2023-06-22 22:22:44 +0000 | [diff] [blame] | 63 | Create Multiattach 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}' |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 66 | |
| vegall | 1d03986 | 2023-06-22 22:22:44 +0000 | [diff] [blame] | 67 | Create Multiattach 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}' |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 70 | |
| 71 | Network Service Instance Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 72 | [Documentation] Instantiate NS for the testsuite. |
| 73 | ${status} ${message}= Run Keyword And Ignore Error Variable Should Exist ${VDU0_PUBLICKEY} |
| 74 | Log ${status} |
| 75 | Log ${message} |
| 76 | IF "${status}" == "FAIL" Set Global Variable ${VDU0_PUBLICKEY} ${EMPTY} |
| 77 | ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${VDU0_PUBLICKEY} |
| 78 | Set Suite Variable ${NS_ID} ${id} |
| 79 | Sleep ${WAIT_GUARD_FOR_VM_BOOT} Waiting for VM's daemons to be up and running |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 80 | |
| 81 | Get Vnf ID |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 82 | [Documentation] Get the VNF instance id from OSM. |
| 83 | ${vnf_id}= Get Vnf Id ${NS_ID} ${VNF_MEMBER_INDEX} |
| 84 | Set Suite Variable ${VNF_ID} ${vnf_id} |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 85 | |
| 86 | Get Vnf Management Ip Addresses |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 87 | [Documentation] Get the IP addresses of the two VDU of the VNF. |
| 88 | ${rc} ${vdu0_ip}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq -r '.vdur[0].interfaces[]."ip-address"' |
| 89 | Log ${rc},${vdu0_ip} |
| 90 | ${rc} ${vdu1_ip}= Run And Return RC And Output osm vnf-show ${VNF_ID} --literal | yq -r '.vdur[1].interfaces[]."ip-address"' |
| 91 | Log ${rc},${vdu1_ip} |
| 92 | Set Suite Variable ${MGMT_IP_ADDR_0} ${vdu0_ip} |
| 93 | Set Suite Variable ${MGMT_IP_ADDR_1} ${vdu1_ip} |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 94 | |
| 95 | Ensure that VDUs can share data |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 96 | [Documentation] Connect via SSH to the two VDUs of the VNF and check that the volume is shared as expected. |
| 97 | Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_0} ${VDU0_USERNAME} ${VDU0_PASSWORD} ${VDU0_PRIVATEKEY} sudo mkfs.ext3 -F /dev/vdb && sudo mkdir /shared && sudo mount /dev/vdb /shared && sudo chown ubuntu:ubuntu /shared && echo "osmtest" > /shared/test_file |
| vegall | 1d03986 | 2023-06-22 22:22:44 +0000 | [diff] [blame] | 98 | Sleep 10s |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 99 | Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_1} ${VDU1_USERNAME} ${VDU1_PASSWORD} ${VDU1_PRIVATEKEY} sudo mkdir /shared && sudo mount /dev/vdb /shared && ls /shared |
| 100 | Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_1} ${VDU1_USERNAME} ${VDU1_PASSWORD} ${VDU1_PRIVATEKEY} cat /shared/test_file |
| 101 | ${stdout}= Execute Remote Command Check Rc Return Output ${MGMT_IP_ADDR_0} ${VDU0_USERNAME} ${VDU0_PASSWORD} ${VDU0_PRIVATEKEY} cat /shared/test_file |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 102 | Log ${stdout} |
| 103 | Should Be Equal ${stdout} osmtest Shared data can't be read |
| 104 | |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 105 | Delete NS Instance Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 106 | [Documentation] Delete NS instance. |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 107 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 108 | Delete NS ${NS_NAME} |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 109 | |
| 110 | Delete NS Descriptor Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 111 | [Documentation] Delete NS package from OSM. |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 112 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 113 | Delete NSD ${NSD_NAME} |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 114 | |
| 115 | Delete VNF Descriptor Test |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 116 | [Documentation] Delete VNF package from OSM. |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 117 | [Tags] cleanup |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 118 | Delete VNFD ${VNFD_NAME} |
| Gabriel Cuba | b91fc76 | 2023-05-19 18:30:19 -0500 | [diff] [blame] | 119 | |
| 120 | |
| 121 | *** Keywords *** |
| 122 | Suite Cleanup |
| 123 | [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim |
| garciadeblas | 7a9e031 | 2023-12-11 22:24:46 +0100 | [diff] [blame] | 124 | Run Keyword If Any Tests Failed Delete NS ${NS_NAME} |
| 125 | Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME} |
| 126 | Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME} |