blob: 4eae93243d622880ac10c8860fa2c8f66799371e [file] [log] [blame]
abaraniuk68c7f7c2018-08-06 16:06:29 +03001{% from 'cookied-bm-contrail40-nfv/underlay.yaml' import HOSTNAME_CFG01 with context %}
abaraniukc4130bc2018-11-15 14:51:10 +02002{% from 'cookied-bm-contrail40-nfv/underlay.yaml' import HOSTNAME_CTL01 with context %}
abaraniuk68c7f7c2018-08-06 16:06:29 +03003{% from 'cookied-bm-contrail40-nfv/underlay.yaml' import DOMAIN_NAME with context %}
abaraniukc4130bc2018-11-15 14:51:10 +02004{% from 'cookied-bm-contrail40-nfv/underlay.yaml' import LAB_CONFIG_NAME with context %}
abaraniuk68c7f7c2018-08-06 16:06:29 +03005{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
6{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
abaraniukc4130bc2018-11-15 14:51:10 +02007
abaraniuk68c7f7c2018-08-06 16:06:29 +03008{% set PATTERN = os_env('PATTERN', 'false') %}
9{% set RUN_TEMPEST = os_env('RUN_TEMPEST', 'false') %}
Dennis Dmitriev4034db02018-08-26 21:50:13 +030010
11{% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %}
12
abaraniuk68c7f7c2018-08-06 16:06:29 +030013# Install OpenStack control services
14
sgudz62df2fc2018-10-09 12:26:19 +030015{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }}
abaraniuk68c7f7c2018-08-06 16:06:29 +030016
Dennis Dmitriev4034db02018-08-26 21:50:13 +030017{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
abaraniuk68c7f7c2018-08-06 16:06:29 +030018
Dennis Dmitriev4034db02018-08-26 21:50:13 +030019{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
abaraniuk68c7f7c2018-08-06 16:06:29 +030020
sgudz6aea2562018-08-22 15:05:37 +030021{{ 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
abaraniuk68c7f7c2018-08-06 16:06:29 +030029
Dennis Dmitriev4034db02018-08-26 21:50:13 +030030{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=false) }}
abaraniuk68c7f7c2018-08-06 16:06:29 +030031
32# install contrail
abaraniukc4130bc2018-11-15 14:51:10 +020033
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;
abaraniuk68c7f7c2018-08-06 16:06:29 +030039 node_name: {{ HOSTNAME_CFG01 }}
40 retry: {count: 1, delay: 20}
41 skip_fail: false
42
abaraniukc4130bc2018-11-15 14:51:10 +020043- description: Install opencontrail database services on first minion
abaraniuk68c7f7c2018-08-06 16:06:29 +030044 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
abaraniukc4130bc2018-11-15 14:51:10 +020045 -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
abaraniuk68c7f7c2018-08-06 16:06:29 +030081 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
abaraniukc4130bc2018-11-15 14:51:10 +020087 -C 'I@opencontrail:control or I@opencontrail:collector' state.sls docker.client && sleep 15;
abaraniuk68c7f7c2018-08-06 16:06:29 +030088 node_name: {{ HOSTNAME_CFG01 }}
abaraniukc4130bc2018-11-15 14:51:10 +020089 retry: {count: 3, delay: 5}
abaraniuk68c7f7c2018-08-06 16:06:29 +030090 skip_fail: false
91
92- description: Finalize opencontrail services
93 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
abaraniukc4130bc2018-11-15 14:51:10 +020094 -C 'I@opencontrail:database:id:1' state.sls opencontrail.client
abaraniuk68c7f7c2018-08-06 16:06:29 +030095 node_name: {{ HOSTNAME_CFG01 }}
96 retry: {count: 3, delay: 30}
sgudzdcf5d552018-08-21 23:27:14 +030097 skip_fail: false
abaraniuk68c7f7c2018-08-06 16:06:29 +030098
abaraniukc4130bc2018-11-15 14:51:10 +020099- 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
abaraniuk68c7f7c2018-08-06 16:06:29 +0300113- 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
abaraniuk68c7f7c2018-08-06 16:06:29 +0300120- 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
abaraniukc4130bc2018-11-15 14:51:10 +0200128- 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
abaraniuk68c7f7c2018-08-06 16:06:29 +0300135 cmd: salt -C 'I@opencontrail:compute' state.sls opencontrail.client
136 node_name: {{ HOSTNAME_CFG01 }}
abaraniukc4130bc2018-11-15 14:51:10 +0200137 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 }}
abaraniuk68c7f7c2018-08-06 16:06:29 +0300143 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
abaraniukc4130bc2018-11-15 14:51:10 +0200154{{ 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
abaraniuk68c7f7c2018-08-06 16:06:29 +0300168 cmd: |
abaraniukc4130bc2018-11-15 14:51:10 +0200169 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- description: Fix default security group for access to external net from outside
217 cmd: |
218 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule list --column ID -f value | xargs openstack security group rule delete';
219 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol tcp';
220 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol tcp';
221 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol icmp';
222 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol icmp';
abaraniuk68c7f7c2018-08-06 16:06:29 +0300223 node_name: {{ HOSTNAME_CFG01 }}
224 retry: {count: 1, delay: 30}
225 skip_fail: true
abaraniukc4130bc2018-11-15 14:51:10 +0200226
227# Starting prepare runtest
228
229- description: Upload tempest template
230 upload:
231 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
232 local_filename: runtest.yml
233 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/
234 node_name: {{ HOSTNAME_CFG01 }}
235 skip_fail: False
236
237- description: Include class with tempest template into cfg node
238 cmd: |
239 sed -i 's/classes\:/classes\:\n- cluster.{{ LAB_CONFIG_NAME }}.infra.runtest/g' /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml;
240 salt '*' saltutil.refresh_pillar;
241 salt '*' saltutil.sync_all;
242 salt 'ctl01*' pkg.install docker.io;
243 salt 'ctl01*' cmd.run 'iptables --policy FORWARD ACCEPT';
244 salt 'cfg01*' state.sls salt.minion && sleep 20;
245 node_name: {{ HOSTNAME_CFG01 }}
246 retry: {count: 1, delay: 10}
247 skip_fail: false
248
249- description: Enforce keystone client
250 cmd: |
251 salt 'cfg01*' state.sls keystone.client;
252 node_name: {{ HOSTNAME_CFG01 }}
253 retry: {count: 1, delay: 5}
254 skip_fail: false
255
256- description: Steps from nova client for dpdk
257 cmd: |
258 . /root/keystonercv3; nova flavor-create m1.extra_tiny_test 998 1024 5 1;
259 nova flavor-create m1.tiny_test 999 1024 5 1;
260 nova flavor-key m1.extra_tiny_test set hw:mem_page_size=1GB;
261 nova flavor-key m1.tiny_test set hw:mem_page_size=1GB;
262 node_name: {{ HOSTNAME_CTL01 }}
263 retry: {count: 1, delay: 5}
264 skip_fail: false
265
266- description: Upload cirros image
267 cmd: |
268 salt 'cfg01*' state.sls glance.client;
269 node_name: {{ HOSTNAME_CFG01 }}
270 retry: {count: 1, delay: 5}
271 skip_fail: false
272
273- description: Generate tempest config
274 cmd: |
275 salt 'cfg01*' state.sls runtest;
276 node_name: {{ HOSTNAME_CFG01 }}
277 retry: {count: 1, delay: 5}
278 skip_fail: false
279
280- description: Download cirros image for runtest
281 cmd: |
282 wget http://cz8133.bud.mirantis.net:8099/cirros-0.3.5-x86_64-disk.img -O /tmp/TestCirros-0.3.5.img
283 node_name: {{ HOSTNAME_CTL01 }}
284 retry: {count: 1, delay: 5}
285 skip_fail: false
286
287- description: Test future contrail manipulation
288 cmd: |
289 apt install crudini jq -y;
290 crudini --set /tmp/test/tempest.conf auth tempest_roles admin;
291 crudini --set /tmp/test/tempest.conf patrole custom_policy_files /etc/opencontrail/policy.json;
292 crudini --set /tmp/test/tempest.conf sdn service_name opencontrail;
293 cat /tmp/test/tempest.conf;
294 node_name: {{ HOSTNAME_CTL01 }}
295 retry: {count: 1, delay: 30}
296 skip_fail: true
297
298- description: Run tempest from new docker image
299 cmd: |
300 OPENSTACK_VERSION=`salt-call --out=newline_values_only pillar.get _param:openstack_version`;
301 docker run --name "run-tempest-yml" -d -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/ docker-prod-virtual.docker.mirantis.net/mirantis/cicd/ci-tempest:$OPENSTACK_VERSION /bin/bash -c "run-tempest";
302 node_name: {{ HOSTNAME_CTL01 }}
303 retry: {count: 1, delay: 30}
304 skip_fail: false
305
306- description: Test Wait container script
307 cmd: |
308 report_file=`find /tmp/test -maxdepth 1 -name 'report_*xml' -print -quit`;
309 if [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ -f "$report_file" ];
310 then echo "All done!"; docker logs run-tempest-yml;
311 elif [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ ! -f "$report_file" ];
312 then echo "Exit without report!"; docker logs run-tempest-yml;
313 else echo "Tempest not finished... ";sleep 900; false;
314 fi
315 node_name: {{ HOSTNAME_CTL01 }}
316 retry: {count: 25, delay: 30}
317 skip_fail: false
318
319- description: Download xml results
320 download:
321 remote_path: /tmp/test/
322 remote_filename: "report_*.xml"
323 local_path: {{ os_env('PWD') }}
324 node_name: {{ HOSTNAME_CTL01 }}
325 skip_fail: true