blob: 7cc6de1c62c61a99ac7a863df38222fa31bb2cd8 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
Gabriel Cubab91fc762023-05-19 18:30:19 -05002# 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
garciadeblas7a9e0312023-12-11 22:24:46 +010014
Gabriel Cubab91fc762023-05-19 18:30:19 -050015*** Settings ***
16Documentation [BASIC-31] Basic NS with two multi-VDU VNF
17
18Library OperatingSystem
19Library String
20Library Collections
21Library Process
22Library SSHLibrary
23
garciadeblas7a9e0312023-12-11 22:24:46 +010024Resource ../lib/vnfd_lib.resource
25Resource ../lib/nsd_lib.resource
26Resource ../lib/ns_lib.resource
27Resource ../lib/connectivity_lib.resource
28Resource ../lib/ssh_lib.resource
Gabriel Cubab91fc762023-05-19 18:30:19 -050029
garciadeblas166c8912023-12-16 10:51:48 +010030Test Tags basic_31 cluster_main daily regression
Gabriel Cubab91fc762023-05-19 18:30:19 -050031
32Suite Teardown Run Keyword And Ignore Error Suite Cleanup
33
34
35*** Variables ***
36# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010037${VNFD_PKG} multivdu_multiattach_vnf
38${VNFD_NAME} multivdu_multiattach-vnf
39${NSD_PKG} multivdu_multiattach_ns
40${NSD_NAME} multivdu_multiattach-ns
Gabriel Cubab91fc762023-05-19 18:30:19 -050041
42# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010043${NS_NAME} multivdu_multiattach
44${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
Gabriel Cubab91fc762023-05-19 18:30:19 -050045
46# SSH keys and username to be used
garciadeblas7a9e0312023-12-11 22:24:46 +010047${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 Cubab91fc762023-05-19 18:30:19 -050055
garciadeblas7a9e0312023-12-11 22:24:46 +010056${NS_ID} ${EMPTY}
57${VNF_MEMBER_INDEX} vnf
58${VNF_IP_ADDR} ${EMPTY}
59${WAIT_GUARD_FOR_VM_BOOT} 50s
Gabriel Cubab91fc762023-05-19 18:30:19 -050060
61
62*** Test Cases ***
vegall1d039862023-06-22 22:22:44 +000063Create Multiattach VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010064 [Documentation] Upload VNF package for the testsuite.
65 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
Gabriel Cubab91fc762023-05-19 18:30:19 -050066
vegall1d039862023-06-22 22:22:44 +000067Create Multiattach NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010068 [Documentation] Upload NS package for the testsuite.
69 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
Gabriel Cubab91fc762023-05-19 18:30:19 -050070
71Network Service Instance Test
garciadeblas7a9e0312023-12-11 22:24:46 +010072 [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 Cubab91fc762023-05-19 18:30:19 -050080
81Get Vnf ID
garciadeblas7a9e0312023-12-11 22:24:46 +010082 [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 Cubab91fc762023-05-19 18:30:19 -050085
86Get Vnf Management Ip Addresses
garciadeblas7a9e0312023-12-11 22:24:46 +010087 [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 Cubab91fc762023-05-19 18:30:19 -050094
95Ensure that VDUs can share data
garciadeblas7a9e0312023-12-11 22:24:46 +010096 [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
vegall1d039862023-06-22 22:22:44 +000098 Sleep 10s
garciadeblas7a9e0312023-12-11 22:24:46 +010099 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 Cubab91fc762023-05-19 18:30:19 -0500102 Log ${stdout}
103 Should Be Equal ${stdout} osmtest Shared data can't be read
104
Gabriel Cubab91fc762023-05-19 18:30:19 -0500105Delete NS Instance Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100106 [Documentation] Delete NS instance.
Gabriel Cubab91fc762023-05-19 18:30:19 -0500107 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100108 Delete NS ${NS_NAME}
Gabriel Cubab91fc762023-05-19 18:30:19 -0500109
110Delete NS Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100111 [Documentation] Delete NS package from OSM.
Gabriel Cubab91fc762023-05-19 18:30:19 -0500112 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100113 Delete NSD ${NSD_NAME}
Gabriel Cubab91fc762023-05-19 18:30:19 -0500114
115Delete VNF Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +0100116 [Documentation] Delete VNF package from OSM.
Gabriel Cubab91fc762023-05-19 18:30:19 -0500117 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100118 Delete VNFD ${VNFD_NAME}
Gabriel Cubab91fc762023-05-19 18:30:19 -0500119
120
121*** Keywords ***
122Suite Cleanup
123 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
garciadeblas7a9e0312023-12-11 22:24:46 +0100124 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}