| --- |
| # test-vsg/tasks/main.yml |
| # |
| # Run tests to check that the CORD-in-a-Box deployment has worked. |
| |
| - name: Create a sample CORD subscriber |
| command: ansible xos-1 -u ubuntu -m shell \ |
| -a "cd ~/service-profile/cord-pod; make cord-subscriber" |
| tags: |
| - skip_ansible_lint # running a sub job |
| |
| - name: Pause 60 seconds (work around bug in synchronizer) |
| pause: seconds=60 |
| |
| - name: Re-run 'make vtn' (work around bug in synchronizer) |
| command: ansible xos-1 -u ubuntu -m shell \ |
| -a "cd ~/service-profile/cord-pod; make vtn" |
| 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: 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 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 |
| |
| # Specifying this through container_config below was not working... |
| - name: set lxc bridge interface |
| become: yes |
| lineinfile: |
| dest: /etc/lxc/default.conf |
| regexp: "^lxc.network.link =" |
| line: "lxc.network.link = {{ fabric_bridge_on_head_node }}" |
| |
| - name: Create testclient |
| become: yes |
| lxc_container: |
| name: testclient |
| container_log: true |
| template: ubuntu |
| state: started |
| template_options: --release trusty |
| container_command: | |
| ifdown eth0 |
| sed -i 's/eth0 inet dhcp/eth0 inet manual/g' /etc/network/interfaces |
| ifup eth0 |
| ip link show eth0.222 || ip link add link eth0 name eth0.222 type vlan id 222 |
| ip link show eth0.222.111 || ip link add link eth0.222 name eth0.222.111 type vlan id 111 |
| ifconfig eth0.222 up |
| ifconfig eth0.222.111 up |
| dhclient eth0.222.111 |
| |
| # Don't use lxc_container so that we can get output |
| - name: Test external connectivity in test client |
| become: yes |
| command: lxc-attach -n testclient -- ping -c 3 8.8.8.8 |
| register: pingtest |
| |
| - name: Output from ping test |
| debug: var=pingtest.stdout_lines |