blob: b7e5829ec24ff491300288c6a466d3d712ec703a [file] [log] [blame]
sgudz8c888ec2017-10-02 15:29:23 +03001{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
abaraniukc4130bc2018-11-15 14:51:10 +02002{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CTL01 with context %}
3{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import DOMAIN_NAME with context %}
4{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import LAB_CONFIG_NAME with context %}
sgudz8c888ec2017-10-02 15:29:23 +03005{% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %}
6{% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %}
sgudzcced67d2017-10-11 15:56:09 +03007{% 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
sgudz8c888ec2017-10-02 15:29:23 +030012# Install OpenStack control services
13
abaraniukc4130bc2018-11-15 14:51:10 +020014{{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=false) }}
sgudz8c888ec2017-10-02 15:29:23 +030015
Dennis Dmitriev4034db02018-08-26 21:50:13 +030016{{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }}
sgudz8c888ec2017-10-02 15:29:23 +030017
Dennis Dmitriev4034db02018-08-26 21:50:13 +030018{{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }}
sgudz8c888ec2017-10-02 15:29:23 +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
sgudz8c888ec2017-10-02 15:29:23 +030028
Dennis Dmitriev4034db02018-08-26 21:50:13 +030029{{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=false) }}
sgudz8c888ec2017-10-02 15:29:23 +030030
31# install contrail
sgudz868f0862018-03-16 21:47:18 +020032- 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
sgudz8c888ec2017-10-02 15:29:23 +030040 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
sgudz868f0862018-03-16 21:47:18 +020046- description: Install Opencontrail control on ctl01
sgudz8c888ec2017-10-02 15:29:23 +030047 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 }}
sgudzcced67d2017-10-11 15:56:09 +030050 retry: {count: 1, delay: 5}
51 skip_fail: false
52
sgudz868f0862018-03-16 21:47:18 +020053- description: Install Opencontrail control on all nodes
54 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
sgudz8c888ec2017-10-02 15:29:23 +030055 -C 'I@opencontrail:control' state.sls opencontrail exclude=opencontrail.client
56 node_name: {{ HOSTNAME_CFG01 }}
sgudz868f0862018-03-16 21:47:18 +020057 retry: {count: 1, delay: 5}
sgudz8c888ec2017-10-02 15:29:23 +030058 skip_fail: false
59
sgudz868f0862018-03-16 21:47:18 +020060- 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
sgudzcced67d2017-10-11 15:56:09 +030063 node_name: {{ HOSTNAME_CFG01 }}
64 retry: {count: 1, delay: 5}
65 skip_fail: false
66
sgudz868f0862018-03-16 21:47:18 +020067- description: Workaround for https://mirantis.jira.com/browse/PROD-12798
sgudz8c888ec2017-10-02 15:29:23 +030068 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
sgudz868f0862018-03-16 21:47:18 +020069 -C 'I@opencontrail:control' service.restart 'keepalived'
sgudz8c888ec2017-10-02 15:29:23 +030070 node_name: {{ HOSTNAME_CFG01 }}
sgudz868f0862018-03-16 21:47:18 +020071 retry: {count: 1, delay: 5}
sgudz8c888ec2017-10-02 15:29:23 +030072 skip_fail: false
73
sgudz868f0862018-03-16 21:47:18 +020074# OpenContrail vrouters
75- description: Install Opencontrail client
sgudz8c888ec2017-10-02 15:29:23 +030076 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
sgudz868f0862018-03-16 21:47:18 +020077 -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'
sgudz8c888ec2017-10-02 15:29:23 +030085 node_name: {{ HOSTNAME_CFG01 }}
sgudzcced67d2017-10-11 15:56:09 +030086 retry: {count: 2, delay: 5}
sgudz8c888ec2017-10-02 15:29:23 +030087 skip_fail: false
88
sgudz868f0862018-03-16 21:47:18 +020089- description: Install Opencontrail on computes
90 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
91 -C 'I@opencontrail:compute' state.sls 'opencontrail'
92 node_name: {{ HOSTNAME_CFG01 }}
93 retry: {count: 2, delay: 5}
94 skip_fail: false
95
96- description: Test Opencontrail
97 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
98 -C 'I@opencontrail:control' cmd.run 'contrail-status'
sgudz8c888ec2017-10-02 15:29:23 +030099 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 5}
101 skip_fail: false
102
Dennis Dmitriev4034db02018-08-26 21:50:13 +0300103{{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }}
sgudz8c888ec2017-10-02 15:29:23 +0300104
abaraniukc4130bc2018-11-15 14:51:10 +0200105{{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }}
sgudz8c888ec2017-10-02 15:29:23 +0300106
107# Install compute node
108
109- description: Apply formulas for compute node
110 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 5}
113 skip_fail: true
114
115- description: Re-apply(as in doc) formulas for compute node
116 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply
117 node_name: {{ HOSTNAME_CFG01 }}
118 retry: {count: 1, delay: 5}
Oleksii Butenko9f2601c2018-02-08 15:13:21 +0200119 skip_fail: false
sgudz8c888ec2017-10-02 15:29:23 +0300120
121- description: Check IP on computes
122 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run
123 'ip a'
124 node_name: {{ HOSTNAME_CFG01 }}
125 retry: {count: 10, delay: 30}
126 skip_fail: false
127
sgudzcced67d2017-10-11 15:56:09 +0300128- description: Hack resolv.conf on VCP nodes for internal services access
129 cmd: |
130 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;"
sgudzcced67d2017-10-11 15:56:09 +0300131 node_name: {{ HOSTNAME_CFG01 }}
132 retry: {count: 1, delay: 5}
133 skip_fail: false
sgudz8c888ec2017-10-02 15:29:23 +0300134
sgudzcced67d2017-10-11 15:56:09 +0300135- description: Hack vrouter (Delete default moun point)
136 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"
137 node_name: {{ HOSTNAME_CFG01 }}
138 retry: {count: 1, delay: 30}
139 skip_fail: true
140
141- description: Temporary WR for correct pci in vrouter.conf
142 cmd: salt "cmp*" cmd.run "sed -i 's/physical\_interface\_address\=.*/physical\_interface\_address=0000\:05\:00\.0/g' /etc/contrail/contrail-vrouter-agent.conf"
143 node_name: {{ HOSTNAME_CFG01 }}
144 retry: {count: 1, delay: 30}
145 skip_fail: true
146
147- description: Remove crashes files from /var/crashes/ while vrouter was crashed
148 cmd: salt "cmp*" cmd.run "rm -rf /var/crashes/*"
149 node_name: {{ HOSTNAME_CFG01 }}
150 retry: {count: 1, delay: 30}
151 skip_fail: true
152
153- description: Reboot computes
sgudz2b3dcfa2018-07-18 21:51:38 +0300154 cmd: |
155 salt "cmp*" system.reboot;
156 sleep 600;
sgudzcced67d2017-10-11 15:56:09 +0300157 node_name: {{ HOSTNAME_CFG01 }}
158 retry: {count: 1, delay: 30}
159 skip_fail: true
abaraniukc4130bc2018-11-15 14:51:10 +0200160
161- description: sync time
162 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
163 'service ntp stop; ntpd -gq; service ntp start'
164 node_name: {{ HOSTNAME_CFG01 }}
165 retry: {count: 1, delay: 30}
166 skip_fail: false
167
168- description: Hack resolv.conf on VCP nodes for internal services access
169 cmd: |
170 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;"
171 node_name: {{ HOSTNAME_CFG01 }}
172 retry: {count: 1, delay: 5}
173 skip_fail: false
174
175- description: Create heat-net before external net create
176 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
177 '. /root/keystonercv3; neutron net-create heat-net'
178 node_name: {{ HOSTNAME_CFG01 }}
179 retry: {count: 1, delay: 30}
180 skip_fail: false
181
182- description: Create public network for contrail
183 cmd: |
184 salt 'ntw01*' contrail.virtual_network_create public '{"external":true,"ip_prefix":"192.168.200.0","ip_prefix_len":24,"asn":64512,"target":10000}'
185 node_name: {{ HOSTNAME_CFG01 }}
186 retry: {count: 1, delay: 5}
187 skip_fail: true
188
189- description: Steps from neutron client for contrail
190 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
191 '. /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'
192 node_name: {{ HOSTNAME_CFG01 }}
193 retry: {count: 1, delay: 30}
194 skip_fail: false
195
196- description: Steps from neutron client for contrail
197 cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run
198 '. /root/keystonercv3; neutron router-create heat-router'
199 node_name: {{ HOSTNAME_CFG01 }}
200 retry: {count: 1, delay: 30}
201 skip_fail: false
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 router-gateway-set heat-router public'
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-interface-add heat-router heat-subnet'
213 node_name: {{ HOSTNAME_CFG01 }}
214 retry: {count: 1, delay: 30}
215 skip_fail: false
216
217- description: Fix default security group for access to external net from outside
218 cmd: |
219 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule list --column ID -f value | xargs openstack security group rule delete';
220 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol tcp';
221 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol tcp';
222 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol icmp';
223 salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol icmp';
224 node_name: {{ HOSTNAME_CFG01 }}
225 retry: {count: 1, delay: 30}
226 skip_fail: true
227
228# Starting prepare runtest
229
230- description: Upload tempest template
231 upload:
232 local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/
233 local_filename: runtest.yml
234 remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/
235 node_name: {{ HOSTNAME_CFG01 }}
236 skip_fail: False
237
238- description: Include class with tempest template into cfg node
239 cmd: |
240 sed -i 's/classes\:/classes\:\n- cluster.{{ LAB_CONFIG_NAME }}.infra.runtest/g' /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml;
241 salt '*' saltutil.refresh_pillar;
242 salt '*' saltutil.sync_all;
243 salt 'ctl01*' pkg.install docker.io;
244 salt 'ctl01*' cmd.run 'iptables --policy FORWARD ACCEPT';
245 salt 'cfg01*' state.sls salt.minion && sleep 20;
246 node_name: {{ HOSTNAME_CFG01 }}
247 retry: {count: 1, delay: 10}
248 skip_fail: false
249
250- description: Enforce keystone client
251 cmd: |
252 salt 'cfg01*' state.sls keystone.client;
253 node_name: {{ HOSTNAME_CFG01 }}
254 retry: {count: 1, delay: 5}
255 skip_fail: false
256
257- description: Create flavors for tests
258 cmd: |
259 salt 'cfg01*' state.sls nova.client;
260 node_name: {{ HOSTNAME_CFG01 }}
261 retry: {count: 1, delay: 5}
262 skip_fail: false
263
264- description: Upload cirros image
265 cmd: |
266 salt 'cfg01*' state.sls glance.client;
267 node_name: {{ HOSTNAME_CFG01 }}
268 retry: {count: 1, delay: 5}
269 skip_fail: false
270
271- description: Generate tempest config
272 cmd: |
273 salt 'cfg01*' state.sls runtest;
274 node_name: {{ HOSTNAME_CFG01 }}
275 retry: {count: 1, delay: 5}
276 skip_fail: false
277
278- description: Download cirros image for runtest
279 cmd: |
280 wget http://cz8133.bud.mirantis.net:8099/cirros-0.3.5-x86_64-disk.img -O /tmp/TestCirros-0.3.5.img
281 node_name: {{ HOSTNAME_CTL01 }}
282 retry: {count: 1, delay: 5}
283 skip_fail: false
284
285- description: Test future contrail manipulation
286 cmd: |
287 apt install crudini jq -y;
288 crudini --set /tmp/test/tempest.conf auth tempest_roles admin;
289 crudini --set /tmp/test/tempest.conf patrole custom_policy_files /etc/opencontrail/policy.json;
290 crudini --set /tmp/test/tempest.conf sdn service_name opencontrail;
291 cat /tmp/test/tempest.conf;
292 node_name: {{ HOSTNAME_CTL01 }}
293 retry: {count: 1, delay: 30}
294 skip_fail: true
295
296- description: Run tempest from new docker image
297 cmd: |
298 OPENSTACK_VERSION=`salt-call --out=newline_values_only pillar.get _param:openstack_version`;
299 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";
300 node_name: {{ HOSTNAME_CTL01 }}
301 retry: {count: 1, delay: 30}
302 skip_fail: false
303
304- description: Test Wait container script
305 cmd: |
306 report_file=`find /tmp/test -maxdepth 1 -name 'report_*xml' -print -quit`;
307 if [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ -f "$report_file" ];
308 then echo "All done!"; docker logs run-tempest-yml;
309 elif [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ ! -f "$report_file" ];
310 then echo "Exit without report!"; docker logs run-tempest-yml;
311 else echo "Tempest not finished... ";sleep 900; false;
312 fi
313 node_name: {{ HOSTNAME_CTL01 }}
314 retry: {count: 25, delay: 30}
315 skip_fail: false
316
317- description: Download xml results
318 download:
319 remote_path: /tmp/test/
320 remote_filename: "report_*.xml"
321 local_path: {{ os_env('PWD') }}
322 node_name: {{ HOSTNAME_CTL01 }}
323 skip_fail: true