| {% from 'cookied-bm-contrail40-nfv/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| {% from 'cookied-bm-contrail40-nfv/underlay.yaml' import HOSTNAME_CTL01 with context %} |
| {% from 'cookied-bm-contrail40-nfv/underlay.yaml' import DOMAIN_NAME with context %} |
| {% from 'cookied-bm-contrail40-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() }} |
| |
| {{ 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 Docker services |
| cmd: | |
| if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:host' match.pillar 'docker:host' ; then |
| salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:host' state.sls docker.host |
| fi; sleep 10; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 20} |
| skip_fail: false |
| |
| - description: Install opencontrail database services on first minion |
| 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: 1, delay: 20} |
| skip_fail: false |
| |
| - description: Install opencontrail database services |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:database' state.sls opencontrail.database |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 20} |
| skip_fail: false |
| |
| - description: Install Opencontrail control services on first minion |
| 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: 20} |
| skip_fail: false |
| |
| - description: Install Opencontrail control services |
| 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: 20} |
| skip_fail: false |
| |
| - description: Install Opencontrail collectors on first minion |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:collector and *01*' state.sls opencontrail exclude=opencontrail.client |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 20} |
| skip_fail: false |
| |
| - description: Install Opencontrail collectors |
| 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: 20} |
| skip_fail: false |
| |
| - description: Spawn Opencontrail docker images |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:control or I@opencontrail:collector' state.sls docker.client && sleep 15; |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 3, delay: 5} |
| skip_fail: false |
| |
| - description: Finalize opencontrail services |
| 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: 3, delay: 30} |
| skip_fail: false |
| |
| - description: Finalize opencontrail services |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:client and not I@opencontrail:compute' state.sls opencontrail.client |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Finalize opencontrail services |
| cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:compute' state.sls opencontrail exclude=opencontrail.client |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 3, delay: 30} |
| skip_fail: true |
| |
| - description: Check contrail status |
| cmd: sleep 15; salt --hard-crash --state-output=mixed --state-verbose=False |
| -C 'I@opencontrail:database' cmd.run 'doctrail all contrail-status' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 5} |
| 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: 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: Apply Opencontrail compute |
| cmd: salt -C 'I@opencontrail:compute' state.sls opencontrail.client |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 3, delay: 30} |
| skip_fail: false |
| |
| - description: Apply Opencontrail compute |
| cmd: salt -C 'I@opencontrail:compute' state.sls opencontrail |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| - description: Check status for contrail services |
| cmd: | |
| sleep 15; |
| salt -C 'I@opencontrail:database' cmd.run 'doctrail all contrail-status' |
| node_name: {{ HOSTNAME_CFG01 }} |
| retry: {count: 1, delay: 30} |
| skip_fail: false |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_HEAT() }} |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_HORIZON() }} |
| |
| {{ SHARED_OPENSTACK.MACRO_INSTALL_COMPUTE(CELL_MAPPING=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 |