blob: 7dff4de5f6f4c756e88b32575ee94f5001ac70a4 [file] [log] [blame]
abaraniuke46fea52018-10-04 16:13:22 +03001{% from 'cookied-bm-oc40-queens/underlay.yaml' import HOSTNAME_CFG01 with context %}
2{% from 'cookied-bm-oc40-queens/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'cookied-bm-oc40-queens/underlay.yaml' import DOMAIN_NAME with context %}
4{% from 'cookied-bm-oc40-queens/underlay.yaml' import LAB_CONFIG_NAME with context %}
5{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
6{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
7
8{% set PATTERN = os_env('PATTERN', 'false') %}
9{% set RUN_TEMPEST = os_env('RUN_TEMPEST', 'false') %}
10
11{% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %}
12
13# Install OpenStack control services
14
15{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }}
16
17{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
18
19{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
20
21{{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER(INSTALL_VOLUME=false) }}
22
23- description: WR Install cinder volume
24 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
25 -C 'I@cinder:volume' state.sls cinder
26 node_name: {{ HOSTNAME_CFG01 }}
27 retry: {count: 2, delay: 5}
28 skip_fail: false
29
30{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=false) }}
31
32# install contrail
33
34- description: Install Docker services
35 cmd: |
36 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:host' match.pillar 'docker:host' ; then
37 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:host' state.sls docker.host
38 fi; sleep 10;
39 node_name: {{ HOSTNAME_CFG01 }}
40 retry: {count: 1, delay: 20}
41 skip_fail: false
42
43- description: Install opencontrail database services on first minion
44 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
45 -C 'I@opencontrail:database and *01*' state.sls opencontrail.database
46 node_name: {{ HOSTNAME_CFG01 }}
47 retry: {count: 1, delay: 20}
48 skip_fail: false
49
50- description: Install opencontrail database services
51 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
52 -C 'I@opencontrail:database' state.sls opencontrail.database
53 node_name: {{ HOSTNAME_CFG01 }}
54 retry: {count: 1, delay: 20}
55 skip_fail: false
56
57- description: Install Opencontrail control services on first minion
58 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
59 -C 'I@opencontrail:control and *01*' state.sls opencontrail exclude=opencontrail.client
60 node_name: {{ HOSTNAME_CFG01 }}
61 retry: {count: 1, delay: 20}
62 skip_fail: false
63
64- description: Install Opencontrail control services
65 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
66 -C 'I@opencontrail:control' state.sls opencontrail exclude=opencontrail.client
67 node_name: {{ HOSTNAME_CFG01 }}
68 retry: {count: 1, delay: 20}
69 skip_fail: false
70
71- description: Install Opencontrail collectors on first minion
72 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
73 -C 'I@opencontrail:collector and *01*' state.sls opencontrail exclude=opencontrail.client
74 node_name: {{ HOSTNAME_CFG01 }}
75 retry: {count: 1, delay: 20}
76 skip_fail: false
77
78- description: Install Opencontrail collectors
79 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
80 -C 'I@opencontrail:collector' state.sls opencontrail exclude=opencontrail.client
81 node_name: {{ HOSTNAME_CFG01 }}
82 retry: {count: 1, delay: 20}
83 skip_fail: false
84
85- description: Spawn Opencontrail docker images
86 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
87 -C 'I@opencontrail:control or I@opencontrail:collector' state.sls docker.client && sleep 15;
88 node_name: {{ HOSTNAME_CFG01 }}
89 retry: {count: 3, delay: 5}
90 skip_fail: false
91
92- description: Finalize opencontrail services
93 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
94 -C 'I@opencontrail:database:id:1' state.sls opencontrail.client
95 node_name: {{ HOSTNAME_CFG01 }}
96 retry: {count: 3, delay: 30}
97 skip_fail: false
98
99- description: Finalize opencontrail services
100 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
101 -C 'I@opencontrail:client and not I@opencontrail:compute' state.sls opencontrail.client
102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 1, delay: 30}
104 skip_fail: false
105
106- description: Finalize opencontrail services
107 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
108 -C 'I@opencontrail:compute' state.sls opencontrail exclude=opencontrail.client
109 node_name: {{ HOSTNAME_CFG01 }}
110 retry: {count: 3, delay: 30}
111 skip_fail: true
112
113- description: Check contrail status
114 cmd: sleep 15; salt --hard-crash --state-output=mixed --state-verbose=False
115 -C 'I@opencontrail:database' cmd.run 'doctrail all contrail-status'
116 node_name: {{ HOSTNAME_CFG01 }}
117 retry: {count: 1, delay: 5}
118 skip_fail: false
119
120- description: Reboot computes
121 cmd: |
122 salt "cmp*" system.reboot;
123 sleep 600;
124 node_name: {{ HOSTNAME_CFG01 }}
125 retry: {count: 1, delay: 30}
126 skip_fail: true
127
128- description: Remove crashes files from /var/crashes/ while vrouter was crashed
129 cmd: salt "cmp*" cmd.run "rm -rf /var/crashes/*"
130 node_name: {{ HOSTNAME_CFG01 }}
131 retry: {count: 1, delay: 30}
132 skip_fail: true
133
134- description: Apply Opencontrail compute
135 cmd: salt -C 'I@opencontrail:compute' state.sls opencontrail.client
136 node_name: {{ HOSTNAME_CFG01 }}
137 retry: {count: 3, delay: 30}
138 skip_fail: false
139
140- description: Apply Opencontrail compute
141 cmd: salt -C 'I@opencontrail:compute' state.sls opencontrail
142 node_name: {{ HOSTNAME_CFG01 }}
143 retry: {count: 1, delay: 30}
144 skip_fail: false
145
146- description: Check status for contrail services
147 cmd: |
148 sleep 15;
149 salt -C 'I@opencontrail:database' cmd.run 'doctrail all contrail-status'
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 1, delay: 30}
152 skip_fail: false
153
154{{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }}
155
156{{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }}
157
158{{ SHARED_OPENSTACK.MACRO_INSTALL_COMPUTE(CELL_MAPPING=true) }}
159
160- description: sync time
161 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
162 'service ntp stop; ntpd -gq; service ntp start'
163 node_name: {{ HOSTNAME_CFG01 }}
164 retry: {count: 1, delay: 30}
165 skip_fail: false
166
167- description: Hack resolv.conf on VCP nodes for internal services access
168 cmd: |
169 salt --hard-crash --state-output=mixed --state-verbose=False -C '* and not kvm* and not cmp* and not gtw* and not cfg*' cmd.run "echo 'nameserver 172.18.208.44' > /etc/resolv.conf;"
170 node_name: {{ HOSTNAME_CFG01 }}
171 retry: {count: 1, delay: 5}
172 skip_fail: false
173
174- description: Create heat-net before external net create
175 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
176 '. /root/keystonercv3; neutron net-create heat-net'
177 node_name: {{ HOSTNAME_CFG01 }}
178 retry: {count: 1, delay: 30}
179 skip_fail: false
180
181- description: Create public network for contrail
182 cmd: |
183 salt 'ntw01*' contrail.virtual_network_create public '{"external":true,"ip_prefix":"192.168.200.0","ip_prefix_len":24,"asn":64512,"target":10000}'
184 node_name: {{ HOSTNAME_CFG01 }}
185 retry: {count: 1, delay: 5}
186 skip_fail: true
187
188- description: Steps from neutron client for contrail
189 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
190 '. /root/keystonercv3; neutron subnet-create heat-net 10.20.30.0/24 --allocation-pool start=10.20.30.10,end=10.20.30.254 --gateway 10.20.30.1 --name heat-subnet'
191 node_name: {{ HOSTNAME_CFG01 }}
192 retry: {count: 1, delay: 30}
193 skip_fail: false
194
195- description: Steps from neutron client for contrail
196 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
197 '. /root/keystonercv3; neutron router-create heat-router'
198 node_name: {{ HOSTNAME_CFG01 }}
199 retry: {count: 1, delay: 30}
200 skip_fail: false
201
202- description: Steps from neutron client for contrail
203 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
204 '. /root/keystonercv3; neutron router-gateway-set heat-router public'
205 node_name: {{ HOSTNAME_CFG01 }}
206 retry: {count: 1, delay: 30}
207 skip_fail: false
208
209- description: Steps from neutron client for contrail
210 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
211 '. /root/keystonercv3; neutron router-interface-add heat-router heat-subnet'
212 node_name: {{ HOSTNAME_CFG01 }}
213 retry: {count: 1, delay: 30}
214 skip_fail: false
215
216# Starting prepare runtest
217
218- description: Upload tempest template
219 upload:
220 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
221 local_filename: runtest.yml
222 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/
223 node_name: {{ HOSTNAME_CFG01 }}
224 skip_fail: False
225
226- description: Include class with tempest template into cfg node
227 cmd: |
228 sed -i 's/classes\:/classes\:\n- cluster.{{ LAB_CONFIG_NAME }}.infra.runtest/g' /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml;
229 salt '*' saltutil.refresh_pillar;
230 salt '*' saltutil.sync_all;
231 salt 'ctl01*' pkg.install docker.io;
232 salt 'ctl01*' cmd.run 'iptables --policy FORWARD ACCEPT';
233 salt 'cfg01*' state.sls salt.minion && sleep 20;
234 node_name: {{ HOSTNAME_CFG01 }}
235 retry: {count: 1, delay: 10}
236 skip_fail: false
237
238- description: Enforce keystone client
239 cmd: |
240 salt 'cfg01*' state.sls keystone.client;
241 node_name: {{ HOSTNAME_CFG01 }}
242 retry: {count: 1, delay: 5}
243 skip_fail: false
244
245- description: Create flavors for tests
246 cmd: |
247 salt 'cfg01*' state.sls nova.client;
248 node_name: {{ HOSTNAME_CFG01 }}
249 retry: {count: 1, delay: 5}
250 skip_fail: false
251
252- description: Upload cirros image
253 cmd: |
254 salt 'cfg01*' state.sls glance.client;
255 node_name: {{ HOSTNAME_CFG01 }}
256 retry: {count: 1, delay: 5}
257 skip_fail: false
258
259- description: Generate tempest config
260 cmd: |
261 salt 'cfg01*' state.sls runtest;
262 node_name: {{ HOSTNAME_CFG01 }}
263 retry: {count: 1, delay: 5}
264 skip_fail: false
265
266- description: Download cirros image for runtest
267 cmd: |
268 wget http://cz8133.bud.mirantis.net:8099/cirros-0.3.5-x86_64-disk.img -O /tmp/TestCirros-0.3.5.img
269 node_name: {{ HOSTNAME_CTL01 }}
270 retry: {count: 1, delay: 5}
271 skip_fail: false
272
273- description: Run tempest from new docker image
274 cmd: |
275 OPENSTACK_VERSION=`salt-call --out=newline_values_only pillar.get _param:openstack_version`;
276 docker run -e ARGS="-r test -w 2" -v /tmp/test/tempest.conf:/etc/tempest/tempest.conf -v /tmp/:/tmp/ -v /tmp/test:/root/tempest -v /etc/ssl/certs/:/etc/ssl/certs/ --rm docker-prod-virtual.docker.mirantis.net/mirantis/cicd/ci-tempest:$OPENSTACK_VERSION /bin/bash -c "run-tempest";
277 node_name: {{ HOSTNAME_CTL01 }}
278 retry: {count: 1, delay: 30}
279 skip_fail: true
280
281- description: Download xml results
282 download:
283 remote_path: /tmp/test/
284 remote_filename: "report_*.xml"
285 local_path: {{ os_env('PWD') }}
286 node_name: {{ HOSTNAME_CTL01 }}
287 skip_fail: true