blob: 36e3f1d774150f5a42d70e07f0d1423864269a4d [file] [log] [blame]
garciaale0e696252020-09-24 18:04:27 +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*** Variables ***
14${success_return_code} 0
15
16
17*** Keywords ***
18Get Server Flavor ID
19 [Arguments] ${server_id}
20
21 Should Not Be Empty ${server_id}
22 ${rc} ${stdout}= Run and Return RC and Output openstack server show ${server_id} | grep flavor | awk 'NR>1{print $1}' RS='(' FS=')'
23 log ${stdout}
24 Should Be Equal As Integers ${rc} ${success_return_code}
25 [Return] ${stdout}
26
27
28Get Flavor Properties
29 [Arguments] ${flavor_id}
30
31 Should Not Be Empty ${flavor_id}
32 ${rc} ${stdout}= Run and Return RC and Output openstack flavor show ${flavor_id} | grep properties | awk -F '|' '{print $3}'
33 log ${stdout}
34 Should Be Equal As Integers ${rc} ${success_return_code}
35 [Return] ${stdout}
aguilard3422ec32021-06-30 12:28:46 +020036
37
38Check NS Servers In VIM
39 [Documentation] Check if the number of servers in Openstack by filtering by NS name is as expected.
40 [Arguments] ${ns_name} ${number}
41
42 Should Not Be Empty ${ns_name}
43 ${rc} ${stdout}= Run and Return RC and Output openstack server list | grep ${ns_name} | awk '{print $4}'
44 log ${stdout}
45 Should Be Equal As Integers ${rc} ${success_return_code}
46 @{servers} = Split String ${stdout}
47 ${n_servers}= Get Length ${servers}
48 Should Be Equal As Integers ${number} ${n_servers}
aguilardceb1cb42022-02-24 10:54:14 +000049
50
51Get Project Quota
52 [Documentation] Get a field (ram, cores, ports, etc.) from quota in current project.
53 [Arguments] ${field}
54
55 Should Not Be Empty ${field}
56 ${rc} ${stdout}= Run and Return RC and Output openstack quota show -c ${field} -f value
57 log ${stdout}
58 Should Be Equal As Integers ${rc} ${success_return_code}
59 [Return] ${stdout}
60
aguilardbde67802022-03-18 14:15:17 +000061
62Get Server Property
63 [Documentation] Get a field (flavor, image, volumes_attached, etc.) from a server.
64 [Arguments] ${server_id} ${field}
65
66 Should Not Be Empty ${server_id}
67 Should Not Be Empty ${field}
68 ${rc} ${stdout}= Run and Return RC and Output openstack server show ${server_id} -c ${field} -f value
69 log ${stdout}
70 Should Be Equal As Integers ${rc} ${success_return_code}
71 [Return] ${stdout}
72
73
Alexis Romerodd1b09d2022-03-16 06:51:43 +010074Check VM In Server Group
75 [Documentation] Check if a given server is included in an Openstack server group
76 [Arguments] ${server_id} ${server_group_name}
77
78 Should Not Be Empty ${server_group_name}
79 Should Not Be Empty ${server_id}
80 ${rc} ${stdout}= Run and Return RC and Output openstack server group show ${server_group_name} -c members -f value
81 log ${stdout}
82 Should Be Equal As Integers ${rc} ${success_return_code}
83 Should Contain ${stdout} ${server_id}
84
85
aguilardbde67802022-03-18 14:15:17 +000086Check If Volume Exists
87 [Documentation] Checks if a volume id exists
88 [Arguments] ${volume_id}
89
90 Should Not Be Empty ${volume_id}
91 ${rc} ${stdout}= Run and Return RC and Output openstack volume list | grep ${volume_id} | wc -l
92 log ${stdout}
93 Should Be Equal As Integers ${rc} ${success_return_code}
94 [Return] ${stdout}
95
96
97Delete Volume
98 [Documentation] Delete a volume by its identifier
99 [Arguments] ${volume_id}
100
101 Should Not Be Empty ${volume_id}
102 ${rc} ${stdout}= Run and Return RC and Output openstack volume delete ${volume_id}
103 log ${stdout}
104 Should Be Equal As Integers ${rc} ${success_return_code}
105 [Return] ${stdout}
aguilard845c2ea2022-04-08 09:36:03 +0000106
107
108Stop Server
109 [Documentation] Stop a server
110 [Arguments] ${server_id}
111
112 Should Not Be Empty ${server_id}
113 ${rc} ${stdout}= Run and Return RC and Output openstack server stop ${server_id}
114 log ${stdout}
115 Should Be Equal As Integers ${rc} ${success_return_code}
116 [Return] ${stdout}