abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 1 | {% from 'cookied-bm-contrail40-nfv/underlay.yaml' import HOSTNAME_CFG01 with context %} |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 2 | {% from 'cookied-bm-contrail40-nfv/underlay.yaml' import HOSTNAME_CTL01 with context %} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 3 | {% from 'cookied-bm-contrail40-nfv/underlay.yaml' import DOMAIN_NAME with context %} |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 4 | {% from 'cookied-bm-contrail40-nfv/underlay.yaml' import LAB_CONFIG_NAME with context %} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 5 | {% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %} |
| 6 | {% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %} |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 7 | |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 8 | {% set PATTERN = os_env('PATTERN', 'false') %} |
| 9 | {% set RUN_TEMPEST = os_env('RUN_TEMPEST', 'false') %} |
Dennis Dmitriev | 4034db0 | 2018-08-26 21:50:13 +0300 | [diff] [blame] | 10 | |
| 11 | {% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %} |
| 12 | |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 13 | # Install OpenStack control services |
| 14 | |
sgudz | 62df2fc | 2018-10-09 12:26:19 +0300 | [diff] [blame] | 15 | {{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE() }} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 16 | |
Dennis Dmitriev | 4034db0 | 2018-08-26 21:50:13 +0300 | [diff] [blame] | 17 | {{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 18 | |
Dennis Dmitriev | 4034db0 | 2018-08-26 21:50:13 +0300 | [diff] [blame] | 19 | {{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 20 | |
sgudz | 6aea256 | 2018-08-22 15:05:37 +0300 | [diff] [blame] | 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 |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 29 | |
Dennis Dmitriev | 4034db0 | 2018-08-26 21:50:13 +0300 | [diff] [blame] | 30 | {{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=false) }} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 31 | |
| 32 | # install contrail |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 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; |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 39 | node_name: {{ HOSTNAME_CFG01 }} |
| 40 | retry: {count: 1, delay: 20} |
| 41 | skip_fail: false |
| 42 | |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 43 | - description: Install opencontrail database services on first minion |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 44 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 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 |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 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 |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 87 | -C 'I@opencontrail:control or I@opencontrail:collector' state.sls docker.client && sleep 15; |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 88 | node_name: {{ HOSTNAME_CFG01 }} |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 89 | retry: {count: 3, delay: 5} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 90 | skip_fail: false |
| 91 | |
| 92 | - description: Finalize opencontrail services |
| 93 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 94 | -C 'I@opencontrail:database:id:1' state.sls opencontrail.client |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 95 | node_name: {{ HOSTNAME_CFG01 }} |
| 96 | retry: {count: 3, delay: 30} |
sgudz | dcf5d55 | 2018-08-21 23:27:14 +0300 | [diff] [blame] | 97 | skip_fail: false |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 98 | |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 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 | |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 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 | |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 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 | |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 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 |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 135 | cmd: salt -C 'I@opencontrail:compute' state.sls opencontrail.client |
| 136 | node_name: {{ HOSTNAME_CFG01 }} |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 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 }} |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 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 | |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 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 |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 168 | cmd: | |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 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 | - 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'; |
abaraniuk | 68c7f7c | 2018-08-06 16:06:29 +0300 | [diff] [blame] | 223 | node_name: {{ HOSTNAME_CFG01 }} |
| 224 | retry: {count: 1, delay: 30} |
| 225 | skip_fail: true |
abaraniuk | c4130bc | 2018-11-15 14:51:10 +0200 | [diff] [blame] | 226 | |
| 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 |