| {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_CTL01 with context %} |
| {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import DOMAIN_NAME with context %} |
| {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import LAB_CONFIG_NAME with context %} |
| {% from 'shared-salt.yaml' import IPV4_NET_EXTERNAL_PREFIX with context %} |
| {% from 'shared-salt.yaml' import IPV4_NET_TENANT_PREFIX with context %} |
| {% set PATTERN = os_env('PATTERN', 'false') %} |
| {% set RUN_TEMPEST = os_env('RUN_TEMPEST', 'false') %} |
| |
| {% import 'shared-openstack.yaml' as SHARED_OPENSTACK with context %} |
| |
| # Install OpenStack control services |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_KEYSTONE(USE_ORCHESTRATE=false) }} |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_GLANCE() }} |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_NOVA() }} |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_CINDER(INSTALL_VOLUME=false) }} |
| |
| - description: WR Install cinder volume |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@cinder:volume' state.sls cinder |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 2, delay: 5} |
| skip_fail: false |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_NEUTRON(INSTALL_GATEWAY=false) }} |
| |
| # install contrail |
| - description: Install Opencontrail db on ctl01 |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:database and *01*' state.sls opencontrail.database |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 2, delay: 20} |
| skip_fail: false |
| |
| - description: Install Opencontrail db on all nodes |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:database' state.sls opencontrail.database |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 2, delay: 20} |
| skip_fail: false |
| |
| - description: Install Opencontrail control on ctl01 |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:control and *01*' state.sls opencontrail exclude=opencontrail.client |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Install Opencontrail control on all nodes |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:control' state.sls opencontrail exclude=opencontrail.client |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Install Opencontrail on collector |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:collector' state.sls opencontrail exclude=opencontrail.client |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Workaround for https://mirantis.jira.com/browse/PROD-12798 |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:control' service.restart 'keepalived' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| # OpenContrail vrouters |
| - description: Install Opencontrail client |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:database:id:1' state.sls 'opencontrail.client' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Install Opencontrail client on computes |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:compute' state.sls 'opencontrail.client' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 2, delay: 5} |
| skip_fail: false |
| |
| # The next four steps should be converted to one (state.sls opencontrail) with skip_fail: false |
| # It is related to bug with hugepages. So we need to add WR, then reboot |
| # for only 1G hugepages were mounted. Then re-apply state |
| - description: Install Opencontrail on computes |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:compute' state.sls 'opencontrail' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| - description: Hack vrouter (Delete default moun point) |
| 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" |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: true |
| |
| - description: Reboot computes |
| cmd: salt --timeout=600 "cmp*" system.reboot |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: true |
| |
| - description: Install Opencontrail on computes |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:compute' state.sls 'opencontrail' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 2, delay: 5} |
| skip_fail: false |
| |
| - description: Remove crashes files from /var/crashes/ while vrouter was crashed |
| cmd: salt "cmp*" cmd.run "rm -rf /var/crashes/*" |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: true |
| |
| - description: Test Opencontrail |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:control' cmd.run 'contrail-status' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }} |
| |
| - description: Deploy horizon dashboard |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@horizon:server' state.sls horizon |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| - description: Deploy nginx proxy |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@nginx:server' state.sls nginx |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| # Install compute node |
| - description: Apply formulas for compute node |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| - description: Re-apply(as in doc) formulas for compute node |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' state.apply |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Check IP on computes |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'cmp*' cmd.run |
| 'ip a' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 10, delay: 30} |
| skip_fail: false |
| |
| - description: Reboot computes |
| cmd: | |
| salt "cmp*" system.reboot; |
| sleep 600; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: true |
| |
| - description: sync time |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run |
| 'service ntp stop; ntpd -gq; service ntp start' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Hack resolv.conf on VCP nodes for internal services access |
| cmd: | |
| 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;" |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Create heat-net before external net create |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| '. /root/keystonercv3; neutron net-create heat-net' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Create public network for contrail |
| cmd: | |
| salt 'ntw01*' contrail.virtual_network_create public '{"external":true,"ip_prefix":"192.168.200.0","ip_prefix_len":24,"asn":64512,"target":10000}' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: true |
| |
| - description: Steps from neutron client for contrail |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| '. /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' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Steps from neutron client for contrail |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| '. /root/keystonercv3; neutron router-create heat-router' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Steps from neutron client for contrail |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| '. /root/keystonercv3; neutron router-gateway-set heat-router public' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Steps from neutron client for contrail |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False 'ctl01*' cmd.run |
| '. /root/keystonercv3; neutron router-interface-add heat-router heat-subnet' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Fix default security group for access to external net from outside |
| cmd: | |
| salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule list --column ID -f value | xargs openstack security group rule delete'; |
| salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol tcp'; |
| salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol tcp'; |
| salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --egress --protocol icmp'; |
| salt 'ctl01*' cmd.run '. /root/keystonercv3; openstack security group rule create default --ingress --protocol icmp'; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: true |
| |
| # Starting prepare runtest |
| |
| - description: Upload tempest template |
| upload: |
| local_path: {{ config.salt_deploy.templates_dir }}{{ LAB_CONFIG_NAME }}/ |
| local_filename: runtest.yml |
| remote_path: /srv/salt/reclass/classes/cluster/{{ LAB_CONFIG_NAME }}/infra/ |
| node_name: {{ HOSTNAME_CFG01 }} |
| skip_fail: False |
| |
| - description: Include class with tempest template into cfg node |
| cmd: | |
| sed -i 's/classes\:/classes\:\n- cluster.{{ LAB_CONFIG_NAME }}.infra.runtest/g' /srv/salt/reclass/nodes/_generated/cfg01.{{ DOMAIN_NAME }}.yml; |
| salt '*' saltutil.refresh_pillar; |
| salt '*' saltutil.sync_all; |
| salt 'ctl01*' pkg.install docker.io; |
| salt 'ctl01*' cmd.run 'iptables --policy FORWARD ACCEPT'; |
| salt 'cfg01*' state.sls salt.minion && sleep 20; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 10} |
| skip_fail: false |
| |
| - description: Enforce keystone client |
| cmd: | |
| salt 'cfg01*' state.sls keystone.client; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Steps from nova client for dpdk |
| cmd: | |
| . /root/keystonercv3; nova flavor-create m1.extra_tiny_test 998 1024 5 1; |
| nova flavor-create m1.tiny_test 999 1024 5 1; |
| nova flavor-key m1.extra_tiny_test set hw:mem_page_size=1GB; |
| nova flavor-key m1.tiny_test set hw:mem_page_size=1GB; |
| node_name: {{ HOSTNAME_CTL01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Upload cirros image |
| cmd: | |
| salt 'cfg01*' state.sls glance.client; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Generate tempest config |
| cmd: | |
| salt 'cfg01*' state.sls runtest; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Download cirros image for runtest |
| cmd: | |
| wget http://cz8133.bud.mirantis.net:8099/cirros-0.3.5-x86_64-disk.img -O /tmp/TestCirros-0.3.5.img |
| node_name: {{ HOSTNAME_CTL01 }} |
| retry: {count: 1, delay: 5} |
| skip_fail: false |
| |
| - description: Test future contrail manipulation |
| cmd: | |
| apt install crudini jq -y; |
| crudini --set /tmp/test/tempest.conf auth tempest_roles admin; |
| crudini --set /tmp/test/tempest.conf patrole custom_policy_files /etc/opencontrail/policy.json; |
| crudini --set /tmp/test/tempest.conf sdn service_name opencontrail; |
| cat /tmp/test/tempest.conf; |
| node_name: {{ HOSTNAME_CTL01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: true |
| |
| - description: Run tempest from new docker image |
| cmd: | |
| OPENSTACK_VERSION=`salt-call --out=newline_values_only pillar.get _param:openstack_version`; |
| 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"; |
| node_name: {{ HOSTNAME_CTL01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Test Wait container script |
| cmd: | |
| report_file=`find /tmp/test -maxdepth 1 -name 'report_*xml' -print -quit`; |
| if [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ -f "$report_file" ]; |
| then echo "All done!"; docker logs run-tempest-yml; |
| elif [ `docker inspect run-tempest-yml | jq -M '.[]."State"."Status"' | tr -d '"'` == "exited" ] && [ ! -f "$report_file" ]; |
| then echo "Exit without report!"; docker logs run-tempest-yml; |
| else echo "Tempest not finished... ";sleep 900; false; |
| fi |
| node_name: {{ HOSTNAME_CTL01 }} |
| retry: {count: 25, delay: 30} |
| skip_fail: false |
| |
| - description: Download xml results |
| download: |
| remote_path: /tmp/test/ |
| remote_filename: "report_*.xml" |
| local_path: {{ os_env('PWD') }} |
| node_name: {{ HOSTNAME_CTL01 }} |
| skip_fail: true |