blob: 4dd145beda6070da7e5de7d39c1a0d69ea5136d1 [file] [log] [blame]
aguilard845c2ea2022-04-08 09:36:03 +00001# 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 ***
14Documentation [HEAL-02] Healing of scaled charm VDUs
15
16Library OperatingSystem
17Library String
18Library Collections
19Library Process
20Library SSHLibrary
21
22Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnfd_lib.robot
23Resource %{ROBOT_DEVOPS_FOLDER}/lib/vnf_lib.robot
24Resource %{ROBOT_DEVOPS_FOLDER}/lib/nsd_lib.robot
25Resource %{ROBOT_DEVOPS_FOLDER}/lib/ns_lib.robot
26Resource %{ROBOT_DEVOPS_FOLDER}/lib/ssh_lib.robot
27Resource %{ROBOT_DEVOPS_FOLDER}/lib/openstack_lib.robot
28
29Force Tags heal_02 cluster_main daily regression
30
31
32Suite Teardown Run Keyword And Ignore Error Suite Cleanup
33
34
35*** Variables ***
36# NS and VNF descriptor package folder and ids
37${vnfd_volumes_pkg} several_volumes_vnf
38${vnfd_volumes_name} several_volumes-vnf
39${vdu_volumes_name} several_volumes-VM
40${vnf_several_index} several_volumes_vnf
41${vnfd_charm_pkg} charm-packages/native_manual_scale_charm_vnf
42${vnfd_charm_name} native_manual_scale_charm-vnf
43${vdu_charm_name} mgmtVM
44${vnf_charm_index} charm_vnf
45${vnf_charm_scaling_group} manual-scaling_mgmtVM
46${vnf_charm_cloudinit_file} /root/helloworld.txt
47${vnf_charm_day1_file} /home/ubuntu/first-touch
48${nsd_pkg} volumes_nativecharm_ns
49${nsd_name} volumes_nativecharm-ns
50
51# NS instance name and configuration
52${ns_name} heal_02
53${ns_config} {vld: [ {name: mgmtnet, vim-network-name: %{VIM_MGMT_NET}} ] }
54${scale_wait_time} 4min
55
56# SSH keys and username to be used
57${publickey} %{HOME}/.ssh/id_rsa.pub
58${privatekey} %{HOME}/.ssh/id_rsa
59${username} ubuntu
60${password} ${EMPTY}
61
62${success_return_code} 0
63
64
65*** Test Cases ***
66Create VNF Descriptors
67 [Tags] prepare
68 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_charm_pkg}'
69 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_volumes_pkg}'
70
71
72Create NS Descriptor
73 [Tags] prepare
74 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
75
76
77Network Service Instance Test
78 [Tags] prepare
79 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
80 Set Suite Variable ${ns_id} ${id}
81
82
83Get NS Id
84 [Tags] verify cleanup
85 ${variables} Get Variables
86 IF not "\${ns_id}" in "${variables}"
87 ${id}= Get Ns Id ${ns_name}
88 Set Suite Variable ${ns_id} ${id}
89 END
90
91
92Scale Out Charm VNF
93 [Tags] prepare
94 ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_charm_index}
95 Set Suite Variable ${vnf_charm_id} ${vnf_id}
96 @{vdur_list}= Get Vnf Vdur Names ${vnf_charm_id}
97 ${vdurs}= Get Length ${vdur_list}
98 Set Suite Variable ${initial_vdur_count} ${vdurs}
99 Execute Manual VNF Scale ${ns_name} ${vnf_charm_index} ${vnf_charm_scaling_group} SCALE_OUT ${scale_wait_time}
100 @{vdur_list}= Get Vnf Vdur Names ${vnf_charm_id}
101 ${vdurs}= Get Length ${vdur_list}
102 Run Keyword Unless ${vdurs} == ${initial_vdur_count} + 1 Fail msg=There is no new VDU records in the VNF after Scale Out
103
104
105Get Charm VNF Info
106 [Tags] verify
107 Variable Should Exist ${ns_id} msg=NS is not available
108 ${variables} Get Variables
109 IF not "\${vnf_charm_id}" in "${variables}"
110 ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_charm_index}
111 Set Suite Variable ${vnf_charm_id} ${vnf_id}
112 END
113 ${id}= Get VNF VIM ID ${vnf_charm_id}
114 @{vdu_charm_ids}= Split String ${id}
115 Set Suite Variable @{vdu_charm_ids} @{vdu_charm_ids}
116 log ${vdu_charm_ids}[1]
117 @{charm_ip_list}= Get Vnf Vdur IPs ${vnf_charm_id}
118 Set Suite Variable @{charm_ip_list} @{charm_ip_list}
119
120
121Stop Charm VDU
122 [Tags] verify
123 Variable Should Exist @{vdu_charm_ids} msg=VDU is not available
124 Stop Server ${vdu_charm_ids}[1]
125 Sleep 15
126
127
128Heal Charm VDU
129 [Tags] verify
130 Variable Should Exist ${vnf_charm_id} msg=VNF is not available
131 Heal Network Service ${ns_id} --vnf ${vnf_charm_id} --cause "Heal VM of charm_vnf" --vdu ${vdu_charm_name} --count-index 1 --run-day1
132
133
134Check VNF After Healing
135 [Tags] verify
136 Variable Should Exist ${vnf_charm_id} msg=VNF is not available
137
138 @{ip_list}= Get Vnf Vdur IPs ${vnf_charm_id}
139 Should Be Equal ${ip_list} ${charm_ip_list} IP addresses have changed after healing
140
141 ${id}= Get VNF VIM ID ${vnf_charm_id}
142 @{ids}= Split String ${id}
143 Should Be Equal ${vdu_charm_ids}[0] ${ids}[0] VDU[0] id has changed after healing
144 Should Not Be Equal ${vdu_charm_ids}[1] ${ids}[1] VDU[1] id has not changed after healing
145 Should Be Equal ${vdu_charm_ids}[2] ${ids}[2] VDU[2] id has changed after healing
146
147 ${ip}= Get Vdu Attribute ${vnf_charm_id} ip-address 1
148 ${stdout}= Execute Remote Command Check Rc Return Output ${ip} ${username} ${password} ${privatekey} sudo ls ${vnf_charm_cloudinit_file}
149 log ${stdout}
150 Check If remote File Exists ${ip} ${username} ${password} ${privatekey} ${vnf_charm_day1_file}
151
152
153Delete NS Instance
154 [Tags] cleanup
155 Delete NS ${ns_name}
156
157
158Delete NS Descriptor
159 [Tags] cleanup
160 Delete NSD ${nsd_name}
161
162
163Delete VNF Descriptors
164 [Tags] cleanup
165 Delete VNFD ${vnfd_volumes_name}
166 Delete VNFD ${vnfd_charm_name}
167
168
169*** Keywords ***
170Suite Cleanup
171 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
172
173 Run Keyword If Any Tests Failed Delete NS ${ns_name}
174 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
175 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_volumes_name}
176 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_charm_name}