Remove testplans and suites for openstack
[integration/test.git] / tools / deployment / openstack_ha / deploy / 04_glance_setup.robot
1 *** Settings ***
2 Documentation       Test suite to verify packet flows between vm instances.
3
4 Library             SSHLibrary
5 Library             OperatingSystem
6 Library             RequestsLibrary
7 Resource            ../libraries/OpenStackInstallUtils.robot
8 Resource            ../libraries/OpenStackOperations.robot
9 Resource            ../libraries/SystemUtils.robot
10 Resource            ../libraries/Utils.robot
11
12 Suite Setup         OpenStackInstallUtils.Get All Ssh Connections
13 Suite Teardown      Close All Connections
14
15
16 *** Test Cases ***
17 Install Glance
18     Create And Configure Glance Db    ${OS_CONTROL_1_IP}    root    mysql    ${OS_CONTROL_1_HOSTNAME}
19     IF    2 < ${NUM_CONTROL_NODES}
20         Create And Configure Glance Db Other Nodes    ${OS_CONTROL_2_IP}    root    mysql    ${OS_CONTROL_2_HOSTNAME}
21     END
22     IF    2 < ${NUM_CONTROL_NODES}
23         Create And Configure Glance Db Other Nodes    ${OS_CONTROL_3_IP}    root    mysql    ${OS_CONTROL_3_HOSTNAME}
24     END
25     IF    3 < ${NUM_CONTROL_NODES}
26         Create And Configure Glance Db Other Nodes    ${OS_CONTROL_4_IP}    root    mysql    ${OS_CONTROL_4_HOSTNAME}
27     END
28     IF    3 < ${NUM_CONTROL_NODES}
29         Create And Configure Glance Db Other Nodes    ${OS_CONTROL_5_IP}    root    mysql    ${OS_CONTROL_5_HOSTNAME}
30     END
31     IF    2 > ${NUM_CONTROL_NODES}
32         Create Openstack Elements    ${OS_CONTROL_1_HOSTNAME}
33     END
34     IF    2 < ${NUM_CONTROL_NODES}
35         Create Openstack Elements    ${HAPROXY_HOSTNAME}
36     END
37     IF    2 > ${NUM_CONTROL_NODES}
38         Install Configure Glance    ${OS_CONTROL_1_IP}    ${OS_CONTROL_1_HOSTNAME}
39     END
40     IF    2 > ${NUM_CONTROL_NODES}    Start Glance    ${OS_CONTROL_1_IP}
41     IF    2 < ${NUM_CONTROL_NODES}
42         Install Configure Glance    ${OS_CONTROL_1_IP}    ${HAPROXY_HOSTNAME}
43     END
44     IF    2 < ${NUM_CONTROL_NODES}
45         Install Configure Glance    ${OS_CONTROL_2_IP}    ${HAPROXY_HOSTNAME}
46     END
47     IF    2 < ${NUM_CONTROL_NODES}
48         Install Configure Glance    ${OS_CONTROL_3_IP}    ${HAPROXY_HOSTNAME}
49     END
50     IF    3 < ${NUM_CONTROL_NODES}
51         Install Configure Glance    ${OS_CONTROL_4_IP}    ${HAPROXY_HOSTNAME}
52     END
53     IF    4 < ${NUM_CONTROL_NODES}
54         Install Configure Glance    ${OS_CONTROL_5_IP}    ${HAPROXY_HOSTNAME}
55     END
56     IF    2 < ${NUM_CONTROL_NODES}    Start Glance    ${OS_CONTROL_1_IP}
57     IF    2 < ${NUM_CONTROL_NODES}    Start Glance    ${OS_CONTROL_2_IP}
58     IF    2 < ${NUM_CONTROL_NODES}    Start Glance    ${OS_CONTROL_3_IP}
59     IF    2 < ${NUM_CONTROL_NODES}
60         Generic HAProxy Entry    ${HAPROXY_IP}    ${HAPROXY_IP}    9292    glance_api
61     END
62     IF    2 < ${NUM_CONTROL_NODES}
63         Generic HAProxy Entry    ${HAPROXY_IP}    ${HAPROXY_IP}    9191    glance_registry
64     END
65
66
67 *** Keywords ***
68 Create And Configure Glance Db
69     [Arguments]    ${os_node_cxn}    ${mysql_user}    ${mysql_pass}    ${host_name}
70     Create Database for Mysql    ${os_node_cxn}    ${mysql_user}    ${mysql_pass}    glance
71     Grant Privileges To Mysql Database
72     ...    ${os_node_cxn}
73     ...    ${mysql_user}
74     ...    ${mysql_pass}
75     ...    glance.*
76     ...    glance
77     ...    ${host_name}
78     ...    glance
79     Grant Privileges To Mysql Database
80     ...    ${os_node_cxn}
81     ...    ${mysql_user}
82     ...    ${mysql_pass}
83     ...    glance.*
84     ...    glance
85     ...    localhost
86     ...    glance
87     IF    2 < ${NUM_CONTROL_NODES}
88         Grant Privileges To Mysql Database
89         ...    ${os_node_cxn}
90         ...    ${mysql_user}
91         ...    ${mysql_pass}
92         ...    glance.*
93         ...    glance
94         ...    ${HAPROXY_HOSTNAME}
95         ...    glance
96     END
97
98 Create And Configure Glance Db Other Nodes
99     [Arguments]    ${os_node_cxn}    ${mysql_user}    ${mysql_pass}    ${host_name}
100     Grant Privileges To Mysql Database
101     ...    ${os_node_cxn}
102     ...    ${mysql_user}
103     ...    ${mysql_pass}
104     ...    glance.*
105     ...    glance
106     ...    ${host_name}
107     ...    glance
108     Grant Privileges To Mysql Database
109     ...    ${os_node_cxn}
110     ...    ${mysql_user}
111     ...    ${mysql_pass}
112     ...    glance.*
113     ...    glance
114     ...    localhost
115     ...    glance
116     IF    2 < ${NUM_CONTROL_NODES}
117         Grant Privileges To Mysql Database
118         ...    ${os_node_cxn}
119         ...    ${mysql_user}
120         ...    ${mysql_pass}
121         ...    glance.*
122         ...    glance
123         ...    ${HAPROXY_HOSTNAME}
124         ...    glance
125     END
126
127 Create Openstack Elements
128     [Arguments]    ${host_name}
129     Source Local File    /tmp/stackrc
130     Create User    glance    default    glance    rc_file=/tmp/stackrc
131     Role Add    service    glance    admin    rc_file=/tmp/stackrc
132     Create Service    glance    "Image Service"    image    rc_file=/tmp/stackrc
133     Create Endpoint    RegionOne    ${host_name}    image    public    9292    rc_file=/tmp/stackrc
134     Create Endpoint    RegionOne    ${host_name}    image    internal    9292    rc_file=/tmp/stackrc
135     Create Endpoint    RegionOne    ${host_name}    image    admin    9292    rc_file=/tmp/stackrc
136
137 Install Configure Glance
138     [Arguments]    ${os_node_cxn}    ${host_name}
139     IF    '${OS_APPS_PRE_INSTALLED}' == 'no'
140         Install Rpm Package    ${os_node_cxn}    openstack-glance
141     END
142     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    DEFAULT    bind_host    "0.0.0.0"
143     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    DEFAULT    notification_driver    "noop"
144     IF    2 < ${NUM_CONTROL_NODES}
145         Crudini Edit
146         ...    ${os_node_cxn}
147         ...    /etc/glance/glance-api.conf
148         ...    DEFAULT
149         ...    transport_url
150         ...    "rabbit://openstack:rabbit@${OS_CONTROL_1_HOSTNAME},openstack:rabbit@${OS_CONTROL_2_HOSTNAME},openstack:rabbit@${OS_CONTROL_3_HOSTNAME}"
151     END
152     IF    2 > ${NUM_CONTROL_NODES}
153         Crudini Edit
154         ...    ${os_node_cxn}
155         ...    /etc/glance/glance-api.conf
156         ...    DEFAULT
157         ...    transport_url
158         ...    "rabbit://openstack:rabbit@${host_name}"
159     END
160     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    oslo_messaging_rabbit    rabbit_max_retries    0
161     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    oslo_messaging_rabbit    rabbit_ha_queues    true
162     Crudini Edit
163     ...    ${os_node_cxn}
164     ...    /etc/glance/glance-api.conf
165     ...    database
166     ...    connection
167     ...    "mysql+pymysql://glance:glance@${host_name}/glance"
168     Crudini Edit
169     ...    ${os_node_cxn}
170     ...    /etc/glance/glance-api.conf
171     ...    keystone_authtoken
172     ...    auth_uri
173     ...    http://${host_name}:5000
174     Crudini Edit
175     ...    ${os_node_cxn}
176     ...    /etc/glance/glance-api.conf
177     ...    keystone_authtoken
178     ...    auth_url
179     ...    http://${host_name}:35357
180     IF    2 < ${NUM_CONTROL_NODES}
181         Crudini Edit
182         ...    ${os_node_cxn}
183         ...    /etc/glance/glance-api.conf
184         ...    keystone_authtoken
185         ...    memcached_servers
186         ...    ${OS_CONTROL_1_IP}:11211,${OS_CONTROL_2_IP}:11211,${OS_CONTROL_3_IP}:11211
187     END
188     IF    2 > ${NUM_CONTROL_NODES}
189         Crudini Edit
190         ...    ${os_node_cxn}
191         ...    /etc/glance/glance-api.conf
192         ...    keystone_authtoken
193         ...    memcached_servers
194         ...    ${host_name}:11211
195     END
196     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    keystone_authtoken    auth_type    password
197     Crudini Edit
198     ...    ${os_node_cxn}
199     ...    /etc/glance/glance-api.conf
200     ...    keystone_authtoken
201     ...    project_domain_name
202     ...    default
203     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    keystone_authtoken    user_domain_name    default
204     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    keystone_authtoken    project_name    service
205     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    keystone_authtoken    username    glance
206     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    keystone_authtoken    password    glance
207     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    paste_deploy    flavor    keystone
208     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    glance_store    stores    "file,http"
209     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-api.conf    glance_store    default_store    file
210     Crudini Edit
211     ...    ${os_node_cxn}
212     ...    /etc/glance/glance-api.conf
213     ...    glance_store
214     ...    filesystem_store_datadir
215     ...    /var/lib/glance/images/
216     Chmod File    ${os_node_cxn}    /etc/glance/glance-api.conf    640
217     Chown File    ${os_node_cxn}    /etc/glance/glance-api.conf    root    glance
218     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-registry.conf    DEFAULT    bind_host    "0.0.0.0"
219     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-registry.conf    DEFAULT    notification_driver    "noop"
220     IF    2 < ${NUM_CONTROL_NODES}
221         Crudini Edit
222         ...    ${os_node_cxn}
223         ...    /etc/glance/glance-registry.conf
224         ...    DEFAULT
225         ...    transport_url
226         ...    "rabbit://openstack:rabbit@${OS_CONTROL_1_HOSTNAME},openstack:rabbit@${OS_CONTROL_2_HOSTNAME},openstack:rabbit@${OS_CONTROL_3_HOSTNAME}"
227     END
228     IF    2 > ${NUM_CONTROL_NODES}
229         Crudini Edit
230         ...    ${os_node_cxn}
231         ...    /etc/glance/glance-registry.conf
232         ...    DEFAULT
233         ...    transport_url
234         ...    "rabbit://openstack:rabbit@${host_name}"
235     END
236     Crudini Edit
237     ...    ${os_node_cxn}
238     ...    /etc/glance/glance-registry.conf
239     ...    oslo_messaging_rabbit
240     ...    rabbit_max_retries
241     ...    0
242     Crudini Edit
243     ...    ${os_node_cxn}
244     ...    /etc/glance/glance-registry.conf
245     ...    oslo_messaging_rabbit
246     ...    rabbit_ha_queues
247     ...    true
248     Crudini Edit
249     ...    ${os_node_cxn}
250     ...    /etc/glance/glance-registry.conf
251     ...    database
252     ...    connection
253     ...    "mysql+pymysql://glance:glance@${host_name}/glance"
254     Crudini Edit
255     ...    ${os_node_cxn}
256     ...    /etc/glance/glance-registry.conf
257     ...    keystone_authtoken
258     ...    auth_uri
259     ...    http://${host_name}:5000
260     Crudini Edit
261     ...    ${os_node_cxn}
262     ...    /etc/glance/glance-registry.conf
263     ...    keystone_authtoken
264     ...    auth_url
265     ...    http://${host_name}:35357
266     IF    2 < ${NUM_CONTROL_NODES}
267         Crudini Edit
268         ...    ${os_node_cxn}
269         ...    /etc/glance/glance-registry.conf
270         ...    keystone_authtoken
271         ...    memcached_servers
272         ...    ${OS_CONTROL_1_IP}:11211,${OS_CONTROL_2_IP}:11211,${OS_CONTROL_3_IP}:11211
273     END
274     IF    2 > ${NUM_CONTROL_NODES}
275         Crudini Edit
276         ...    ${os_node_cxn}
277         ...    /etc/glance/glance-registry.conf
278         ...    keystone_authtoken
279         ...    memcached_servers
280         ...    ${host_name}:11211
281     END
282     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-registry.conf    keystone_authtoken    auth_type    password
283     Crudini Edit
284     ...    ${os_node_cxn}
285     ...    /etc/glance/glance-registry.conf
286     ...    keystone_authtoken
287     ...    project_domain_name
288     ...    default
289     Crudini Edit
290     ...    ${os_node_cxn}
291     ...    /etc/glance/glance-registry.conf
292     ...    keystone_authtoken
293     ...    user_domain_name
294     ...    default
295     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-registry.conf    keystone_authtoken    project_name    service
296     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-registry.conf    keystone_authtoken    username    glance
297     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-registry.conf    keystone_authtoken    password    glance
298     Crudini Edit    ${os_node_cxn}    /etc/glance/glance-registry.conf    paste_deploy    flavor    keystone
299     IF    2 < ${NUM_CONTROL_NODES} and '${OS_APPS_PRE_INSTALLED}' == 'no'
300         Install Rpm Package    ${os_node_cxn}    nfs-utils
301     END
302     IF    2 < ${NUM_CONTROL_NODES}
303         Enable Service    ${os_node_cxn}    rpcbind
304     END
305     IF    2 < ${NUM_CONTROL_NODES}    Start Service    ${os_node_cxn}    rpcbind
306     IF    2 < ${NUM_CONTROL_NODES}
307         Run Command    ${os_node_cxn}    sudo mkdir -p /var/lib/glance/images
308     END
309     IF    2 < ${NUM_CONTROL_NODES}
310         Run Command    ${os_node_cxn}    sudo mount -t nfs ${HAPROXY_IP}:/images /var/lib/glance/images
311     END
312     IF    2 < ${NUM_CONTROL_NODES}
313         Run Command    ${os_node_cxn}    sudo mount
314     END
315     Run Command As User    ${os_node_cxn}    "glance-manage db_sync"    glance
316     Enable Service    ${os_node_cxn}    openstack-glance-api
317     Enable Service    ${os_node_cxn}    openstack-glance-registry
318
319 Start Glance
320     [Arguments]    ${os_node_cxn}
321     Start Service    ${os_node_cxn}    openstack-glance-api
322     Start Service    ${os_node_cxn}    openstack-glance-registry