blob: 89aeb22ccd79f973e1d15c4c1ad57fd8bd45e137 [file] [log] [blame]
garciadeblas7a9e0312023-12-11 22:24:46 +01001*** Comments ***
Felipe Vicensf96bb452020-06-22 08:12:30 +02002# 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
Felipe Vicensf96bb452020-06-22 08:12:30 +020015*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020016Documentation [HACKFEST-CLOUDINIT] Basic NS with two multi-VDU VNF with cloudinit
garciadeblas4cf45d72021-04-08 13:52:22 +020017
Felipe Vicensf96bb452020-06-22 08:12:30 +020018Library 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
Felipe Vicensf96bb452020-06-22 08:12:30 +020029
garciadeblas7a9e0312023-12-11 22:24:46 +010030Test Tags hackfest_cloudinit cluster_main daily regression sanity azure
garciadeblas4cf45d72021-04-08 13:52:22 +020031
garciadeblasd225e552020-10-02 16:10:14 +000032Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020033
34
35*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020036# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010037${VNFD_PKG} hackfest_cloudinit_vnf
38${VNFD_NAME} hackfest_cloudinit-vnf
39${NSD_PKG} hackfest_cloudinit_ns
40${NSD_NAME} hackfest_cloudinit-ns
almagiab4697d32021-05-25 08:56:17 +020041
42# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010043${NS_NAME} hfcloudinit
44${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
almagiab4697d32021-05-25 08:56:17 +020045
46# SSH user and password
garciadeblas7a9e0312023-12-11 22:24:46 +010047${USERNAME} ubuntu
48${PASSWORD} osm4u
almagiab4697d32021-05-25 08:56:17 +020049
garciadeblas7a9e0312023-12-11 22:24:46 +010050${NS_ID} ${EMPTY}
51${VNF_MEMBER_INDEX} vnf1
52${VNF_IP_ADDR} ${EMPTY}
almagiab4697d32021-05-25 08:56:17 +020053
Felipe Vicensf96bb452020-06-22 08:12:30 +020054
55*** Test Cases ***
56Create Hackfest Cloudinit VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010057 [Documentation] Upload VNF package for the testsuite.
58 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020059
60Create Hackfest Cloudinit NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010061 [Documentation] Upload NS package for the testsuite.
62 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020063
64Network Service Instance Test
garciadeblas7a9e0312023-12-11 22:24:46 +010065 [Documentation] Instantiate NS for the testsuite.
66 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${EMPTY}
67 Set Suite Variable ${NS_ID} ${id}
Felipe Vicensf96bb452020-06-22 08:12:30 +020068
69Get Vnf Ip Address
garciadeblas7a9e0312023-12-11 22:24:46 +010070 [Documentation] Get the mgmt IP address of the VNF of the NS.
71 ${ip_addr}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX}
garciadeblas321726f2022-12-21 11:43:06 +010072 Log ${ip_addr}
garciadeblas7a9e0312023-12-11 22:24:46 +010073 Set Suite Variable ${VNF_IP_ADDR} ${ip_addr}
Felipe Vicensf96bb452020-06-22 08:12:30 +020074
75Test SSH Access
garciadeblas7a9e0312023-12-11 22:24:46 +010076 [Documentation] Check that the VNF is accessible via SSH in its mgmt IP address.
Felipe Vicensf96bb452020-06-22 08:12:30 +020077 Sleep 30s Waiting ssh daemon to be up
garciadeblas7a9e0312023-12-11 22:24:46 +010078 Test SSH Connection ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY}
Felipe Vicensf96bb452020-06-22 08:12:30 +020079
80Check Remote File Injected Via Cloud-init
garciadeblas7a9e0312023-12-11 22:24:46 +010081 [Documentation] Check that the day-0 configuration via cloudinit worked as expected in the VNF. A file should exist in the VM.
82 ${stdout}= Execute Remote Command Check Rc Return Output ${VNF_IP_ADDR} ${USERNAME} ${PASSWORD} ${EMPTY} sudo cat /root/helloworld.txt
garciadeblas321726f2022-12-21 11:43:06 +010083 Log ${stdout}
Felipe Vicensf96bb452020-06-22 08:12:30 +020084
Felipe Vicensf96bb452020-06-22 08:12:30 +020085Delete NS Instance Test
garciadeblas7a9e0312023-12-11 22:24:46 +010086 [Documentation] Delete NS instance.
garciadeblas4cf45d72021-04-08 13:52:22 +020087 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +010088 Delete NS ${NS_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +020089
90Delete NS Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +010091 [Documentation] Delete NS package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +020092 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +010093 Delete NSD ${NSD_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +020094
95Delete VNF Descriptor Test
garciadeblas7a9e0312023-12-11 22:24:46 +010096 [Documentation] Delete VNF package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +020097 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +010098 Delete VNFD ${VNFD_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +020099
100
101*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000102Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200103 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
garciadeblas7a9e0312023-12-11 22:24:46 +0100104 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
105 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
106 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}