blob: 109046e4fa509a7e6d7090a34b5b035ce5f84a2a [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 [BASIC-06] VNF with Charm.
Felipe Vicensf96bb452020-06-22 08:12:30 +020017
18Library OperatingSystem
19Library SSHLibrary
20
garciadeblas7a9e0312023-12-11 22:24:46 +010021Resource ../lib/vnfd_lib.resource
22Resource ../lib/nsd_lib.resource
23Resource ../lib/ns_lib.resource
24Resource ../lib/ns_operation_lib.resource
25Resource ../lib/ssh_lib.resource
26Resource ../lib/juju_lib.resource
Felipe Vicensf96bb452020-06-22 08:12:30 +020027
garciadeblas7a9e0312023-12-11 22:24:46 +010028Test Tags basic_06 cluster_ee_config regression azure
garciadeblas4cf45d72021-04-08 13:52:22 +020029
garciadeblasd225e552020-10-02 16:10:14 +000030Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020031
32
33*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020034# NS and VNF descriptor package folder and ids
garciadeblas7a9e0312023-12-11 22:24:46 +010035${VNFD_PKG} charm-packages/ha_proxy_charm_vnf
36${VNFD_NAME} ha_proxy_charm-vnf
37${NSD_PKG} charm-packages/ha_proxy_charm_ns
38${NSD_NAME} ha_proxy_charm-ns
almagiab4697d32021-05-25 08:56:17 +020039
40# NS instance name and configuration
garciadeblas7a9e0312023-12-11 22:24:46 +010041${NS_NAME} basic_06_charm_test
42${NS_CONFIG} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
almagiab4697d32021-05-25 08:56:17 +020043
44# SSH keys and username to be used
garciadeblas7a9e0312023-12-11 22:24:46 +010045${PUBLICKEY} %{HOME}/.ssh/id_rsa.pub
46${PRIVATEKEY} %{HOME}/.ssh/id_rsa
47${USERNAME} ubuntu
48${PASSWORD} ${EMPTY}
almagiab4697d32021-05-25 08:56:17 +020049
garciadeblas7a9e0312023-12-11 22:24:46 +010050${ACTION_NAME} touch
51${VNF_MEMBER_INDEX_1} vnf1
52${VNF_MEMBER_INDEX_2} vnf2
53${DAY_1_FILE_NAME} /home/ubuntu/first-touch
54${DAY_2_FILE_NAME_1} /home/ubuntu/mytouch1
55${DAY_2_FILE_NAME_2} /home/ubuntu/mytouch2
56${NS_TIMEOUT} 15min
Felipe Vicensf96bb452020-06-22 08:12:30 +020057
aticiga131bf02022-08-25 13:10:14 +030058# VNF profile id, execution environment name to check VNF level charm naming
garciadeblas7a9e0312023-12-11 22:24:46 +010059${VNF_PROFILE_ID} vnf1
60${EE_NAME} simple-ee
aticiga131bf02022-08-25 13:10:14 +030061
Felipe Vicensf96bb452020-06-22 08:12:30 +020062
63*** Test Cases ***
64Create Charm VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010065 [Documentation] Upload VNF package for the testsuite.
66 Create VNFD '%{PACKAGES_FOLDER}/${VNFD_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020067
68Create Charm NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +010069 [Documentation] Upload NS package for the testsuite.
70 Create NSD '%{PACKAGES_FOLDER}/${NSD_PKG}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020071
72Instantiate Charm Network Service
garciadeblas7a9e0312023-12-11 22:24:46 +010073 [Documentation] Instantiates the NS for the testsuite.
74 ${id}= Create Network Service ${NSD_NAME} %{VIM_TARGET} ${NS_NAME} ${NS_CONFIG} ${PUBLICKEY} ${NS_TIMEOUT}
75 Set Suite Variable ${NS_ID} ${id}
76 Set Suite Variable ${MODEL_NAME} ${id}
aticiga131bf02022-08-25 13:10:14 +030077
78Check VNF Charm Application Name
garciadeblas7a9e0312023-12-11 22:24:46 +010079 [Documentation] Checks that the charm application name meets the expected length
80 ${vnf_charm_app_name}= Get Application Name VNF Level Charm %{OSM_HOSTNAME} ${USERNAME} ${PASSWORD} %{OSM_RSA_FILE} ${MODEL_NAME} ${VNF_PROFILE_ID} ${EE_NAME}
aticiga131bf02022-08-25 13:10:14 +030081 ${length}= Get Length ${vnf_charm_app_name}
82 Should Be True ${length} <50
Felipe Vicensf96bb452020-06-22 08:12:30 +020083
Felipe Vicensf96bb452020-06-22 08:12:30 +020084Get Management Ip Addresses
garciadeblas7a9e0312023-12-11 22:24:46 +010085 [Documentation] Get the mgmt IP addresses of both VNF of the NS.
86 ${ip_addr_1}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_1}
garciadeblas321726f2022-12-21 11:43:06 +010087 Log ${ip_addr_1}
garciadeblas7a9e0312023-12-11 22:24:46 +010088 Set Suite Variable ${VNF_1_IP_ADDR} ${ip_addr_1}
89 ${ip_addr_2}= Get Vnf Management Ip Address ${NS_ID} ${VNF_MEMBER_INDEX_2}
garciadeblas321726f2022-12-21 11:43:06 +010090 Log ${ip_addr_2}
garciadeblas7a9e0312023-12-11 22:24:46 +010091 Set Suite Variable ${VNF_2_IP_ADDR} ${ip_addr_2}
Felipe Vicensf96bb452020-06-22 08:12:30 +020092
93Test SSH Access
garciadeblas7a9e0312023-12-11 22:24:46 +010094 [Documentation] Check that both VNF are accessible via SSH in their mgmt IP addresses.
95 Variable Should Exist ${VNF_1_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_1}' is not available
96 Variable Should Exist ${VNF_2_IP_ADDR} msg=IP address of the management VNF '${VNF_MEMBER_INDEX_2}' is not available
garciadeblasf4ebaa82022-06-23 13:33:26 +020097 Sleep 30s Waiting ssh daemon to be up
garciadeblas7a9e0312023-12-11 22:24:46 +010098 Test SSH Connection ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY}
99 Test SSH Connection ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200100
101Check Remote Files Created Via Day 1 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +0200102 [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}.
103 ... This test checks whether that files have been created or not.
garciadeblas7a9e0312023-12-11 22:24:46 +0100104 Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME}
105 Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_1_FILE_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200106
107Execute Day 2 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +0200108 [Documentation] Performs one Day 2 operation per VNF that creates a new file.
garciadeblas7a9e0312023-12-11 22:24:46 +0100109 Variable Should Exist ${NS_ID} msg=Network service instance is not available
110 ${ns_op_id_1}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_1} filename=${DAY_2_FILE_NAME_1}
111 Log ${ns_op_id_1}
112 ${ns_op_id_2}= Execute NS Action ${NS_NAME} ${ACTION_NAME} ${VNF_MEMBER_INDEX_2} filename=${DAY_2_FILE_NAME_2}
113 Log ${ns_op_id_2}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200114
115Check Remote Files Created Via Day 2 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +0200116 [Documentation] Check whether the files created in the previous test via Day 2 operations exist or not.
garciadeblas7a9e0312023-12-11 22:24:46 +0100117 Check If Remote File Exists ${VNF_1_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_1}
118 Check If Remote File Exists ${VNF_2_IP_ADDR} ${USERNAME} ${PASSWORD} ${PRIVATEKEY} ${DAY_2_FILE_NAME_2}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200119
120Delete NS Instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100121 [Documentation] Delete NS instance.
garciadeblas4cf45d72021-04-08 13:52:22 +0200122 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100123 Delete NS ${NS_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200124
125Delete NS Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100126 [Documentation] Delete NS package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +0200127 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100128 Delete NSD ${NSD_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200129
130Delete VNF Descriptor
garciadeblas7a9e0312023-12-11 22:24:46 +0100131 [Documentation] Delete VNF package from OSM.
garciadeblas4cf45d72021-04-08 13:52:22 +0200132 [Tags] cleanup
garciadeblas7a9e0312023-12-11 22:24:46 +0100133 Delete VNFD ${VNFD_NAME}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200134
135
136*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000137Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200138 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
garciadeblas7a9e0312023-12-11 22:24:46 +0100139 Run Keyword If Any Tests Failed Delete NS ${NS_NAME}
140 Run Keyword If Any Tests Failed Delete NSD ${NSD_NAME}
141 Run Keyword If Any Tests Failed Delete VNFD ${VNFD_NAME}