blob: eeb5ba6ac3f47aceba834dcb0fbe32409ba25e14 [file] [log] [blame]
Dominik Fleischmann46186c82020-07-23 13:28:01 +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-11] Native Charms
Dominik Fleischmann46186c82020-07-23 13:28:01 +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
23
garciadeblas4cf45d72021-04-08 13:52:22 +020024Force Tags basic_11 cluster_ee_config cluster_relations daily regression sanity
25
garciadeblasd225e552020-10-02 16:10:14 +000026Suite Teardown Run Keyword And Ignore Error Suite Cleanup
Dominik Fleischmann46186c82020-07-23 13:28:01 +020027
28
29*** Variables ***
almagiab4697d32021-05-25 08:56:17 +020030# NS and VNF descriptor package folder and ids
31${vnfd_pkg} charm-packages/native_charm_vnf
32${vnfd_name} native_charm-vnf
33${nsd_pkg} charm-packages/native_charm_ns
34${nsd_name} native_charm-ns
35
36# NS instance name and configuration
37${ns_name} basic_11_native_charms
38${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
39${ns_timeout} 15min
40
41# SSH keys and username to be used
42${publickey} %{HOME}/.ssh/id_rsa.pub
43${privatekey} %{HOME}/.ssh/id_rsa
Dominik Fleischmann46186c82020-07-23 13:28:01 +020044${username} ubuntu
45${password} ${EMPTY}
almagiab4697d32021-05-25 08:56:17 +020046
Dominik Fleischmann46186c82020-07-23 13:28:01 +020047${action_name} touch
aguilardf2578292022-03-29 15:26:43 +000048${vnf_member_index_1} vnf1
49${vnf_member_index_2} vnf2
Dominik Fleischmann46186c82020-07-23 13:28:01 +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
Dominik Fleischmann46186c82020-07-23 13:28:01 +020053
54
55*** Test Cases ***
56Create Charm VNF Descriptor
Dominik Fleischmann46186c82020-07-23 13:28:01 +020057
garciadeblasf4ebaa82022-06-23 13:33:26 +020058 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
Dominik Fleischmann46186c82020-07-23 13:28:01 +020059
60
61Create Charm NS Descriptor
Dominik Fleischmann46186c82020-07-23 13:28:01 +020062
garciadeblasf4ebaa82022-06-23 13:33:26 +020063 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
Dominik Fleischmann46186c82020-07-23 13:28:01 +020064
65
66Instantiate Charm Network Service
Dominik Fleischmann46186c82020-07-23 13:28:01 +020067
garciadeblasf4ebaa82022-06-23 13:33:26 +020068 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey} ${ns_timeout}
69 Set Suite Variable ${ns_id} ${id}
Dominik Fleischmann46186c82020-07-23 13:28:01 +020070
71
72Get Management Ip Addresses
Dominik Fleischmann46186c82020-07-23 13:28:01 +020073
garciadeblasf4ebaa82022-06-23 13:33:26 +020074 ${ip_addr_1} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_1}
garciadeblas321726f2022-12-21 11:43:06 +010075 Log ${ip_addr_1}
garciadeblasf4ebaa82022-06-23 13:33:26 +020076 Set Suite Variable ${vnf_1_ip_addr} ${ip_addr_1}
77 ${ip_addr_2} Get Vnf Management Ip Address ${ns_id} ${vnf_member_index_2}
garciadeblas321726f2022-12-21 11:43:06 +010078 Log ${ip_addr_2}
garciadeblasf4ebaa82022-06-23 13:33:26 +020079 Set Suite Variable ${vnf_2_ip_addr} ${ip_addr_2}
Dominik Fleischmann46186c82020-07-23 13:28:01 +020080
81
82Test SSH Access
Dominik Fleischmann46186c82020-07-23 13:28:01 +020083
garciadeblasf4ebaa82022-06-23 13:33:26 +020084 Variable Should Exist ${vnf_1_ip_addr} msg=IP address of the management VNF '${vnf_member_index_1}' is not available
85 Variable Should Exist ${vnf_2_ip_addr} msg=IP address of the management VNF '${vnf_member_index_2}' is not available
86 Sleep 30s Waiting ssh daemon to be up
87 Test SSH Connection ${vnf_1_ip_addr} ${username} ${password} ${privatekey}
88 Test SSH Connection ${vnf_2_ip_addr} ${username} ${password} ${privatekey}
Dominik Fleischmann46186c82020-07-23 13:28:01 +020089
90
91Check Remote Files Created Via Day 1 Operations
garciadeblasf4ebaa82022-06-23 13:33:26 +020092 [Documentation] The Charm VNF has a Day 1 operation that creates a file named ${day_1_file_name}.
93 ... This test checks whether that files have been created or not.
Dominik Fleischmann46186c82020-07-23 13:28:01 +020094
garciadeblasf4ebaa82022-06-23 13:33:26 +020095 Check If remote File Exists ${vnf_1_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name}
96 Check If remote File Exists ${vnf_2_ip_addr} ${username} ${password} ${privatekey} ${day_1_file_name}
Dominik Fleischmann46186c82020-07-23 13:28:01 +020097
98
99Delete NS Instance
garciadeblas4cf45d72021-04-08 13:52:22 +0200100 [Tags] cleanup
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200101
garciadeblasf4ebaa82022-06-23 13:33:26 +0200102 Delete NS ${ns_name}
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200103
104
105Delete NS Descriptor
garciadeblas4cf45d72021-04-08 13:52:22 +0200106 [Tags] cleanup
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200107
garciadeblasf4ebaa82022-06-23 13:33:26 +0200108 Delete NSD ${nsd_name}
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200109
110
111Delete VNF Descriptor
garciadeblas4cf45d72021-04-08 13:52:22 +0200112 [Tags] cleanup
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200113
garciadeblasf4ebaa82022-06-23 13:33:26 +0200114 Delete VNFD ${vnfd_name}
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200115
116
117*** Keywords ***
garciadeblasd225e552020-10-02 16:10:14 +0000118Suite Cleanup
garciadeblasf4ebaa82022-06-23 13:33:26 +0200119 [Documentation] Test Suite Cleanup: Deleting descriptors and NS instance
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200120
garciadeblasf4ebaa82022-06-23 13:33:26 +0200121 Run Keyword If Any Tests Failed Delete NS ${ns_name}
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200122
garciadeblasf4ebaa82022-06-23 13:33:26 +0200123 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200124
garciadeblasf4ebaa82022-06-23 13:33:26 +0200125 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}
Dominik Fleischmann46186c82020-07-23 13:28:01 +0200126