blob: 73b89905c8110f2ff07f54c17bf548db417c631f [file] [log] [blame]
dhanasekaranc4da0672022-04-28 12:56: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-04] Autohealing of NS
15Suite Teardown Run Keyword And Ignore Error Suite Cleanup
16Force Tags heal_04 cluster_main daily regression
17Library OperatingSystem
18Library String
19Library Collections
20Library Process
21Library SSHLibrary
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
29*** Variables ***
30# NS and VNF descriptor package folder and ids
31${vnfd_pkg} autoheal_vnf
32${vnfd_name} autoheal_vnfd
33${vdu_name} autoheal_vnfd-VM
dhanasekaran631d1612022-06-16 14:10:06 +000034${vnf_index} autoheal-basic-1
dhanasekaranc4da0672022-04-28 12:56:03 +000035${nsd_pkg} autoheal_ns
36${nsd_name} autoheal_nsd
37# NS instance name and configuration
38${ns_name} heal_04
39${ns_config} {vld: [ {name: mgmt, 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
44${username} ubuntu
45${password} ${EMPTY}
46
47${success_return_code} 0
48
dhanasekaran631d1612022-06-16 14:10:06 +000049#Healing wait time
50${healing_pol_time} 15sec
51${healing_max_wait_time} 10m
52
dhanasekaranc4da0672022-04-28 12:56:03 +000053*** Test Cases ***
54Create VNF Descriptors
dhanasekaranc4da0672022-04-28 12:56:03 +000055 Create VNFD '%{PACKAGES_FOLDER}/${vnfd_pkg}'
56
57
58Create NS Descriptor
dhanasekaranc4da0672022-04-28 12:56:03 +000059 Create NSD '%{PACKAGES_FOLDER}/${nsd_pkg}'
60
61
62Network Service Instance Test
dhanasekaranc4da0672022-04-28 12:56:03 +000063 ${id}= Create Network Service ${nsd_name} %{VIM_TARGET} ${ns_name} ${ns_config} ${publickey}
64 Set Suite Variable ${ns_id} ${id}
65
66
67Get NS Id
dhanasekaran631d1612022-06-16 14:10:06 +000068 [Tags] cleanup
dhanasekaranc4da0672022-04-28 12:56:03 +000069 ${variables} Get Variables
70 IF not "\${ns_id}" in "${variables}"
71 ${id}= Get Ns Id ${ns_name}
72 Set Suite Variable ${ns_id} ${id}
73 END
74
75
76Get VNF Info
dhanasekaranc4da0672022-04-28 12:56:03 +000077 Variable Should Exist ${ns_id} msg=NS is not available
78 ${ip_addr}= Get Vnf Management Ip Address ${ns_id} ${vnf_index}
79 log ${ip_addr}
80 Set Suite Variable ${vnf_ip_addr} ${ip_addr}
81
82 ${vnf_id}= Get Vnf Id ${ns_id} ${vnf_index}
83 Set Suite Variable ${vnf_autoheal_id} ${vnf_id}
84 ${id}= Get VNF VIM ID ${vnf_id}
85 Set Suite Variable ${vdu_autoheal_id} ${id}
86 log ${vdu_autoheal_id}
87
88 @{autoheal_ip_list}= Get Vnf Vdur IPs ${vnf_autoheal_id}
89 Set Suite Variable @{autoheal_ip_list} @{autoheal_ip_list}
90 log @{autoheal_ip_list}
91
92
93Stop Autoheal VDU
dhanasekaranc4da0672022-04-28 12:56:03 +000094 Variable Should Exist ${vdu_autoheal_id} msg=VDU is not available
95 Halt Server ${vdu_autoheal_id}
dhanasekaranb356eec2022-06-18 10:21:49 +000096 Sleep 30
dhanasekaranc4da0672022-04-28 12:56:03 +000097
98
dhanasekaran631d1612022-06-16 14:10:06 +000099Wait For Autohealing To Be Completed
dhanasekaran631d1612022-06-16 14:10:06 +0000100 ${healing_max_wait_time}= Convert Time ${healing_max_wait_time} result_format=number
101 ${healing_max_wait_time}= Evaluate ${healing_max_wait_time} * ${vim_timeout_multiplier}
dhanasekaranb356eec2022-06-18 10:21:49 +0000102 Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Get Operations By Type ${ns_id} heal
103 ${stdout}= Get Operations By Type ${ns_id} heal
104 Wait Until Keyword Succeeds ${healing_max_wait_time} ${healing_pol_time} Check For NS Operation Ended ${stdout}
105 Check For NS Operation Completed ${stdout}
dhanasekaran631d1612022-06-16 14:10:06 +0000106
107
108Check VNF After Healing
dhanasekaranc4da0672022-04-28 12:56:03 +0000109 Variable Should Exist ${vnf_autoheal_id} msg=VNF is not available
110
111 @{ip_list}= Get Vnf Vdur IPs ${vnf_autoheal_id}
112 log @{ip_list}
113 Should Be Equal ${ip_list} ${autoheal_ip_list} IP addresses have changed after healing
114
115 ${id}= Get VNF VIM ID ${vnf_autoheal_id}
116 log ${id}
117 Should Not Be Equal ${id} ${vdu_autoheal_id} VDU id has not changed after healing
118
119
120Delete NS Instance
121 [Tags] cleanup
122 Delete NS ${ns_name}
123
124
125Delete NS Descriptor
126 [Tags] cleanup
127 Delete NSD ${nsd_name}
128
129
130Delete VNF Descriptors
131 [Tags] cleanup
132 Delete VNFD ${vnfd_name}
133
134*** Keywords ***
135Suite Cleanup
136 [Documentation] Test Suit Cleanup: Deleting Descriptor, instance and vim
137
138 Run Keyword If Any Tests Failed Delete NS ${ns_name}
139 Run Keyword If Any Tests Failed Delete NSD ${nsd_name}
140 Run Keyword If Any Tests Failed Delete VNFD ${vnfd_name}