blob: 875aace2bb7573104d8ad071f47f8ca3c34476c0 [file] [log] [blame]
sgudzd7f8ec92018-04-19 16:22:47 +03001{% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_CFG01 with context %}
abaraniukc4130bc2018-11-15 14:51:10 +02002{% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import DOMAIN_NAME with context %}
4{% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import LAB_CONFIG_NAME with context %}
sgudzd7f8ec92018-04-19 16:22:47 +03005{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
6{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
7{% set PATTERN = os_env('PATTERN', 'false') %}
8{% set RUN_TEMPEST = os_env('RUN_TEMPEST', 'false') %}
Dennis Dmitriev4034db02018-08-26 21:50:13 +03009
10{% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %}
11
sgudzd7f8ec92018-04-19 16:22:47 +030012# Install OpenStack control services
13
abaraniukc4130bc2018-11-15 14:51:10 +020014{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=false) }}
sgudzd7f8ec92018-04-19 16:22:47 +030015
Dennis Dmitriev4034db02018-08-26 21:50:13 +030016{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
sgudzd7f8ec92018-04-19 16:22:47 +030017
Dennis Dmitriev4034db02018-08-26 21:50:13 +030018{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
sgudzd7f8ec92018-04-19 16:22:47 +030019
sgudze12b5092018-09-15 00:40:10 +030020{{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER(INSTALL_VOLUME=false) }}
21
22- description: WR Install cinder volume
23 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
24 -C 'I@cinder:volume' state.sls cinder
25 node_name: {{ HOSTNAME_CFG01 }}
26 retry: {count: 2, delay: 5}
27 skip_fail: false
sgudzd7f8ec92018-04-19 16:22:47 +030028
Dennis Dmitriev4034db02018-08-26 21:50:13 +030029{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=false) }}
sgudzd7f8ec92018-04-19 16:22:47 +030030
31# install contrail
32- description: Install Opencontrail db on ctl01
33 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
34 -C 'I@opencontrail:database and *01*' state.sls opencontrail.database
35 node_name: {{ HOSTNAME_CFG01 }}
36 retry: {count: 2, delay: 20}
37 skip_fail: false
38
39- description: Install Opencontrail db on all nodes
40 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
41 -C 'I@opencontrail:database' state.sls opencontrail.database
42 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 2, delay: 20}
44 skip_fail: false
45
46- description: Install Opencontrail control on ctl01
47 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
48 -C 'I@opencontrail:control and *01*' state.sls opencontrail exclude=opencontrail.client
49 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 5}
51 skip_fail: false
52
53- description: Install Opencontrail control on all nodes
54 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
55 -C 'I@opencontrail:control' state.sls opencontrail exclude=opencontrail.client
56 node_name: {{ HOSTNAME_CFG01 }}
57 retry: {count: 1, delay: 5}
58 skip_fail: false
59
60- description: Install Opencontrail on collector
61 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
62 -C 'I@opencontrail:collector' state.sls opencontrail exclude=opencontrail.client
63 node_name: {{ HOSTNAME_CFG01 }}
64 retry: {count: 1, delay: 5}
65 skip_fail: false
66
67- description: Workaround for https://mirantis.jira.com/browse/PROD-12798
68 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
69 -C 'I@opencontrail:control' service.restart 'keepalived'
70 node_name: {{ HOSTNAME_CFG01 }}
71 retry: {count: 1, delay: 5}
72 skip_fail: false
73
74# OpenContrail vrouters
75- description: Install Opencontrail client
76 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
77 -C 'I@opencontrail:database:id:1' state.sls 'opencontrail.client'
78 node_name: {{ HOSTNAME_CFG01 }}
79 retry: {count: 1, delay: 5}
80 skip_fail: false
81
82- description: Install Opencontrail client on computes
83 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
84 -C 'I@opencontrail:compute' state.sls 'opencontrail.client'
85 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 2, delay: 5}
87 skip_fail: false
88
89# The next four steps should be converted to one (state.sls opencontrail) with skip_fail: false
90# It is related to bug with hugepages. So we need to add WR, then reboot
91# for only 1G hugepages were mounted. Then re-apply state
92- description: Install Opencontrail on computes
93 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
94 -C 'I@opencontrail:compute' state.sls 'opencontrail'
95 node_name: {{ HOSTNAME_CFG01 }}
96 retry: {count: 1, delay: 5}
97 skip_fail: true
98
99- description: Hack vrouter (Delete default moun point)
100 cmd: salt "cmp*" cmd.run "sed -i 's/exit 0//g' /etc/rc.local; echo 'umount /dev/hugepages; service supervisor-vrouter restart' >> /etc/rc.local; echo 'exit 0' >> /etc/rc.local"
101 node_name: {{ HOSTNAME_CFG01 }}
102 retry: {count: 1, delay: 30}
103 skip_fail: true
104
105- description: Reboot computes
106 cmd: salt --timeout=600 "cmp*" system.reboot
107 node_name: {{ HOSTNAME_CFG01 }}
108 retry: {count: 1, delay: 30}
109 skip_fail: true
110
111- description: Install Opencontrail on computes
112 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
113 -C 'I@opencontrail:compute' state.sls 'opencontrail'
114 node_name: {{ HOSTNAME_CFG01 }}
115 retry: {count: 2, delay: 5}
116 skip_fail: false
117
118- description: Remove crashes files from /var/crashes/ while vrouter was crashed
119 cmd: salt "cmp*" cmd.run "rm -rf /var/crashes/*"
120 node_name: {{ HOSTNAME_CFG01 }}
121 retry: {count: 1, delay: 30}
122 skip_fail: true
123
124- description: Test Opencontrail
125 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
126 -C 'I@opencontrail:control' cmd.run 'contrail-status'
127 node_name: {{ HOSTNAME_CFG01 }}
128 retry: {count: 1, delay: 5}
129 skip_fail: false
130
Dennis Dmitriev4034db02018-08-26 21:50:13 +0300131{{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }}
sgudzd7f8ec92018-04-19 16:22:47 +0300132
133- description: Deploy horizon dashboard
134 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
135 -C 'I@horizon:server' state.sls horizon
136 node_name: {{ HOSTNAME_CFG01 }}
137 retry: {count: 1, delay: 5}
138 skip_fail: true
139
140- description: Deploy nginx proxy
141 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
142 -C 'I@nginx:server' state.sls nginx
143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 5}
145 skip_fail: true
146
147# Install compute node
148- description: Apply formulas for compute node
149 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 1, delay: 5}
152 skip_fail: true
153
154- description: Re-apply(as in doc) formulas for compute node
155 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
156 node_name: {{ HOSTNAME_CFG01 }}
157 retry: {count: 1, delay: 5}
158 skip_fail: false
159
160- description: Check IP on computes
161 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
162 'ip a'
163 node_name: {{ HOSTNAME_CFG01 }}
164 retry: {count: 10, delay: 30}
165 skip_fail: false
166
abaraniukc4130bc2018-11-15 14:51:10 +0200167- description: Reboot computes
168 cmd: |
169 salt "cmp*" system.reboot;
170 sleep 600;
sgudzd7f8ec92018-04-19 16:22:47 +0300171 node_name: {{ HOSTNAME_CFG01 }}
172 retry: {count: 1, delay: 30}
abaraniukc4130bc2018-11-15 14:51:10 +0200173 skip_fail: true
sgudzd7f8ec92018-04-19 16:22:47 +0300174
175- description: sync time
176 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
177 'service ntp stop; ntpd -gq; service ntp start'
178 node_name: {{ HOSTNAME_CFG01 }}
179 retry: {count: 1, delay: 30}
180 skip_fail: false
181
sgudzd7f8ec92018-04-19 16:22:47 +0300182- description: Hack resolv.conf on VCP nodes for internal services access
183 cmd: |
184 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;"
185 node_name: {{ HOSTNAME_CFG01 }}
186 retry: {count: 1, delay: 5}
187 skip_fail: false
188
abaraniukc4130bc2018-11-15 14:51:10 +0200189- description: Create heat-net before external net create
190 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
191 '. /root/keystonercv3; neutron net-create heat-net'
192 node_name: {{ HOSTNAME_CFG01 }}
193 retry: {count: 1, delay: 30}
194 skip_fail: false
195
196- description: Create public network for contrail
sgudz2b3dcfa2018-07-18 21:51:38 +0300197 cmd: |
abaraniukc4130bc2018-11-15 14:51:10 +0200198 salt 'ntw01*' contrail.virtual_network_create public '{"external":true,"ip_prefix":"192.168.200.0","ip_prefix_len":24,"asn":64512,"target":10000}'
199 node_name: {{ HOSTNAME_CFG01 }}
200 retry: {count: 1, delay: 5}
201 skip_fail: true
202
203- description: Steps from neutron client for contrail
204 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
205 '. /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'
206 node_name: {{ HOSTNAME_CFG01 }}
207 retry: {count: 1, delay: 30}
208 skip_fail: false
209
210- description: Steps from neutron client for contrail
211 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
212 '. /root/keystonercv3; neutron router-create heat-router'
213 node_name: {{ HOSTNAME_CFG01 }}
214 retry: {count: 1, delay: 30}
215 skip_fail: false
216
217- description: Steps from neutron client for contrail
218 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
219 '. /root/keystonercv3; neutron router-gateway-set heat-router public'
220 node_name: {{ HOSTNAME_CFG01 }}
221 retry: {count: 1, delay: 30}
222 skip_fail: false
223
224- description: Steps from neutron client for contrail
225 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
226 '. /root/keystonercv3; neutron router-interface-add heat-router heat-subnet'
227 node_name: {{ HOSTNAME_CFG01 }}
228 retry: {count: 1, delay: 30}
229 skip_fail: false
230
231- description: Fix default security group for access to external net from outside
232 cmd: |
233 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule list --column ID -f value | xargs openstack security group rule delete';
234 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol tcp';
235 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol tcp';
236 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol icmp';
237 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol icmp';
sgudzd7f8ec92018-04-19 16:22:47 +0300238 node_name: {{ HOSTNAME_CFG01 }}
239 retry: {count: 1, delay: 30}
240 skip_fail: true
abaraniukc4130bc2018-11-15 14:51:10 +0200241
242# Starting prepare runtest
243
244- description: Upload tempest template
245 upload:
246 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
247 local_filename: runtest.yml
248 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/
249 node_name: {{ HOSTNAME_CFG01 }}
250 skip_fail: False
251
252- description: Include class with tempest template into cfg node
253 cmd: |
254 sed -i 's/classes\:/classes\:\n- cluster.{{ LAB_CONFIG_NAME }}.infra.runtest/g' /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml;
255 salt '*' saltutil.refresh_pillar;
256 salt '*' saltutil.sync_all;
257 salt 'ctl01*' pkg.install docker.io;
258 salt 'ctl01*' cmd.run 'iptables --policy FORWARD ACCEPT';
259 salt 'cfg01*' state.sls salt.minion && sleep 20;
260 node_name: {{ HOSTNAME_CFG01 }}
261 retry: {count: 1, delay: 10}
262 skip_fail: false
263
264- description: Enforce keystone client
265 cmd: |
266 salt 'cfg01*' state.sls keystone.client;
267 node_name: {{ HOSTNAME_CFG01 }}
268 retry: {count: 1, delay: 5}
269 skip_fail: false
270
271- description: Steps from nova client for dpdk
272 cmd: |
273 . /root/keystonercv3; nova flavor-create m1.extra_tiny_test 998 1024 5 1;
274 nova flavor-create m1.tiny_test 999 1024 5 1;
275 nova flavor-key m1.extra_tiny_test set hw:mem_page_size=1GB;
276 nova flavor-key m1.tiny_test set hw:mem_page_size=1GB;
277 node_name: {{ HOSTNAME_CTL01 }}
278 retry: {count: 1, delay: 5}
279 skip_fail: false
280
281- description: Upload cirros image
282 cmd: |
283 salt 'cfg01*' state.sls glance.client;
284 node_name: {{ HOSTNAME_CFG01 }}
285 retry: {count: 1, delay: 5}
286 skip_fail: false
287
288- description: Generate tempest config
289 cmd: |
290 salt 'cfg01*' state.sls runtest;
291 node_name: {{ HOSTNAME_CFG01 }}
292 retry: {count: 1, delay: 5}
293 skip_fail: false
294
295- description: Download cirros image for runtest
296 cmd: |
297 wget http://cz8133.bud.mirantis.net:8099/cirros-0.3.5-x86_64-disk.img -O /tmp/TestCirros-0.3.5.img
298 node_name: {{ HOSTNAME_CTL01 }}
299 retry: {count: 1, delay: 5}
300 skip_fail: false
301
302- description: Test future contrail manipulation
303 cmd: |
304 apt install crudini jq -y;
305 crudini --set /tmp/test/tempest.conf auth tempest_roles admin;
306 crudini --set /tmp/test/tempest.conf patrole custom_policy_files /etc/opencontrail/policy.json;
307 crudini --set /tmp/test/tempest.conf sdn service_name opencontrail;
308 cat /tmp/test/tempest.conf;
309 node_name: {{ HOSTNAME_CTL01 }}
310 retry: {count: 1, delay: 30}
311 skip_fail: true
312
313- description: Run tempest from new docker image
314 cmd: |
315 OPENSTACK_VERSION=`salt-call --out=newline_values_only pillar.get _param:openstack_version`;
316 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";
317 node_name: {{ HOSTNAME_CTL01 }}
318 retry: {count: 1, delay: 30}
319 skip_fail: false
320
321- description: Test Wait container script
322 cmd: |
323 report_file=`find /tmp/test -maxdepth 1 -name 'report_*xml' -print -quit`;
324 if [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ -f "$report_file" ];
325 then echo "All done!"; docker logs run-tempest-yml;
326 elif [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ ! -f "$report_file" ];
327 then echo "Exit without report!"; docker logs run-tempest-yml;
328 else echo "Tempest not finished... ";sleep 900; false;
329 fi
330 node_name: {{ HOSTNAME_CTL01 }}
331 retry: {count: 25, delay: 30}
332 skip_fail: false
333
334- description: Download xml results
335 download:
336 remote_path: /tmp/test/
337 remote_filename: "report_*.xml"
338 local_path: {{ os_env('PWD') }}
339 node_name: {{ HOSTNAME_CTL01 }}
340 skip_fail: true