blob: 6b296c5d41cb39c81a3358509c5cafc08562e0c0 [file] [log] [blame]
Felipe Vicensf96bb452020-06-22 08:12:30 +02001# Licensed under the Apache License, Version 2.0 (the "License");
2# you may not use this file except in compliance with the License.
3# You may obtain a copy of the License at
4#
5# http://www.apache.org/licenses/LICENSE-2.0
6#
7# Unless required by applicable law or agreed to in writing, software
8# distributed under the License is distributed on an "AS IS" BASIS,
9# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10# See the License for the specific language governing permissions and
11# limitations under the License.
12
13*** Settings ***
garciadeblasf4ebaa82022-06-23 13:33:26 +020014Documentation [BASIC-06] VNF with Charm.
Felipe Vicensf96bb452020-06-22 08:12:30 +020015
16Library OperatingSystem
17Library SSHLibrary
18
19Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
20Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
21Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
aticiga131bf02022-08-25 13:10:14 +030023Resource %{ROBOT_DEVOPS_FOLDER}/lib/juju_lib.robot
Felipe Vicensf96bb452020-06-22 08:12:30 +020024
garciadeblas4cf45d72021-04-08 13:52:22 +020025Force Tags basic_06 cluster_ee_config daily regression
26
garciadeblasd225e552020-10-02 16:10:14 +000027Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +020028
29
30*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020031# NS and VNF descriptor package folder and ids
32${vnfd_pkg} charm-packages/ha_proxy_charm_vnf
33${vnfd_name} ha_proxy_charm-vnf
34${nsd_pkg} charm-packages/ha_proxy_charm_ns
35${nsd_name} ha_proxy_charm-ns
36
37# NS instance name and configuration
38${ns_name} basic_06_charm_test
39${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
40
41# SSH keys and username to be used
42${publickey} %{HOME}/.ssh/id_rsa.pub
43${privatekey} %{HOME}/.ssh/id_rsa
Felipe Vicensf96bb452020-06-22 08:12:30 +020044${username} ubuntu
45${password} ${EMPTY}
almagiab4697d32021-05-25 08:56:17 +020046
Felipe Vicensf96bb452020-06-22 08:12:30 +020047${action_name} touch
aguilardf2578292022-03-29 15:26:43 +000048${vnf_member_index_1} vnf1
49${vnf_member_index_2} vnf2
Felipe Vicensf96bb452020-06-22 08:12:30 +020050${day_1_file_name} /home/ubuntu/first-touch
51${day_2_file_name_1} /home/ubuntu/mytouch1
52${day_2_file_name_2} /home/ubuntu/mytouch2
53${ns_timeout} 15min
54
aticiga131bf02022-08-25 13:10:14 +030055# VNF profile id, execution environment name to check VNF level charm naming
56${vnf_profile_id} vnf1
57${ee_name} simple-ee
58
Felipe Vicensf96bb452020-06-22 08:12:30 +020059
60*** Test Cases ***
61Create Charm VNF Descriptor
Felipe Vicensf96bb452020-06-22 08:12:30 +020062
garciadeblasf4ebaa82022-06-23 13:33:26 +020063 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020064
65
66Create Charm NS Descriptor
Felipe Vicensf96bb452020-06-22 08:12:30 +020067
garciadeblasf4ebaa82022-06-23 13:33:26 +020068 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
Felipe Vicensf96bb452020-06-22 08:12:30 +020069
70
71Instantiate Charm Network Service
Felipe Vicensf96bb452020-06-22 08:12:30 +020072
garciadeblasf4ebaa82022-06-23 13:33:26 +020073 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout}
74 Set Suite Variable ${ns_id} ${id}
aticiga131bf02022-08-25 13:10:14 +030075 Set Suite Variable ${model_name} ${id}
76
77
78Check VNF Charm Application Name
79
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}
81 ${length}= Get Length ${vnf_charm_app_name}
82 Should Be True ${length} <50
Felipe Vicensf96bb452020-06-22 08:12:30 +020083
84
85Get Management Ip Addresses
Felipe Vicensf96bb452020-06-22 08:12:30 +020086
garciadeblasf4ebaa82022-06-23 13:33:26 +020087 ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1}
garciadeblas321726f2022-12-21 11:43:06 +010088 Log ${ip_addr_1}
garciadeblasf4ebaa82022-06-23 13:33:26 +020089 Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1}
90 ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2}
garciadeblas321726f2022-12-21 11:43:06 +010091 Log ${ip_addr_2}
garciadeblasf4ebaa82022-06-23 13:33:26 +020092 Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2}
Felipe Vicensf96bb452020-06-22 08:12:30 +020093
94
95Test SSH Access
Felipe Vicensf96bb452020-06-22 08:12:30 +020096
garciadeblasf4ebaa82022-06-23 13:33:26 +020097 Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available
98 Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available
99 Sleep 30s Waiting ssh daemon to be up
100 Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey}
101 Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200102
103
104Check Remote Files Created Via Day 1 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +0200105 [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}.
106 ... This test checks whether that files have been created or not.
Felipe Vicensf96bb452020-06-22 08:12:30 +0200107
garciadeblasf4ebaa82022-06-23 13:33:26 +0200108 Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name}
109 Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200110
111
112Execute Day 2 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +0200113 [Documentation] Performs one Day 2 operation per VNF that creates a new file.
Felipe Vicensf96bb452020-06-22 08:12:30 +0200114
garciadeblasf4ebaa82022-06-23 13:33:26 +0200115 Variable Should Exist ${ns_id} msg=Network service instance is not available
116 ${ns_op_id_1}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_1} filename=${day_2_file_name_1}
117 ${ns_op_id_2}= Execute NS Action ${ns_name} ${action_name} ${vnf_member_index_2} filename=${day_2_file_name_2}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200118
119
120Check Remote Files Created Via Day 2 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +0200121 [Documentation] Check whether the files created in the previous test via Day 2 operations exist or not.
Felipe Vicensf96bb452020-06-22 08:12:30 +0200122
garciadeblasf4ebaa82022-06-23 13:33:26 +0200123 Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_1}
124 Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_2_file_name_2}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200125
126
127Delete NS Instance
garciadeblas4cf45d72021-04-08 13:52:22 +0200128 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200129
garciadeblasf4ebaa82022-06-23 13:33:26 +0200130 Delete NS ${ns_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200131
132
133Delete NS Descriptor
garciadeblas4cf45d72021-04-08 13:52:22 +0200134 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200135
garciadeblasf4ebaa82022-06-23 13:33:26 +0200136 Delete NSD ${nsd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200137
138
139Delete VNF Descriptor
garciadeblas4cf45d72021-04-08 13:52:22 +0200140 [Tags] cleanup
Felipe Vicensf96bb452020-06-22 08:12:30 +0200141
garciadeblasf4ebaa82022-06-23 13:33:26 +0200142 Delete VNFD ${vnfd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200143
144
145*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000146Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200147 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
Felipe Vicensf96bb452020-06-22 08:12:30 +0200148
garciadeblasf4ebaa82022-06-23 13:33:26 +0200149 Run Keyword If Any Tests Failed Delete NS ${ns_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200150
garciadeblasf4ebaa82022-06-23 13:33:26 +0200151 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200152
garciadeblasf4ebaa82022-06-23 13:33:26 +0200153 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}
Felipe Vicensf96bb452020-06-22 08:12:30 +0200154