| --- |
| # test-vsg/tasks/main.yml |
| # |
| # Run tests to check that the CORD-in-a-Box deployment has worked. |
| |
| - name: Create cord subscriber |
| make: |
| chdir: "{{ service_profile_repo_dest }}/{{ xos_configuration }}" |
| target: cord-subscriber |
| |
| - name: Get name of compute node |
| shell: bash -c "source ~/admin-openrc.sh; nova service-list|grep nova-compute|cut -d '|' -f 3" |
| register: node_name |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: Wait for vSG VM to come up |
| shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'vsg.*ACTIVE' > /dev/null" |
| register: result |
| until: result | success |
| retries: 10 |
| delay: 60 |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: Get ID of VM |
| shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_vsg|cut -d '|' -f 2" |
| register: nova_id |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: Get mgmt IP of VM |
| shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '172\.27\.[[:digit:]]*\.[[:digit:]]*'" |
| register: mgmt_ip |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: Wait for Docker container inside VM to come up |
| shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "sudo docker ps|grep vcpe" > /dev/null |
| register: result |
| until: result | success |
| retries: 20 |
| delay: 60 |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: start container |
| become: yes |
| lxd_container: |
| name: testclient |
| state: started |
| |
| - name: Make sure testclient has default route to vSG |
| become: yes |
| shell: lxc exec testclient -- route | grep default | grep "eth0.222.111" |
| register: result |
| until: result | success |
| retries: 3 |
| delay: 10 |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: Test external connectivity in test client |
| become: yes |
| command: lxc exec testclient -- ping -c 3 8.8.8.8 |
| register: pingtest |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: Output from ping test |
| debug: var=pingtest.stdout_lines |