Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 1 | --- |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 2 | # test-vsg/tasks/main.yml |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 3 | # |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 4 | # Run tests to check that the CORD-in-a-Box deployment has worked. |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 5 | |
| 6 | - name: Create a sample CORD subscriber |
| 7 | command: ansible xos-1 -u ubuntu -m shell \ |
| 8 | -a "cd ~/service-profile/cord-pod; make cord-subscriber" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 9 | tags: |
| 10 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 11 | |
| 12 | - name: Pause 60 seconds (work around bug in synchronizer) |
| 13 | pause: seconds=60 |
| 14 | |
| 15 | - name: Re-run 'make vtn' (work around bug in synchronizer) |
| 16 | command: ansible xos-1 -u ubuntu -m shell \ |
| 17 | -a "cd ~/service-profile/cord-pod; make vtn" |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 18 | tags: |
| 19 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 20 | |
| 21 | - name: Wait for vSG VM to come up |
| 22 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'vsg.*ACTIVE' > /dev/null" |
| 23 | register: result |
| 24 | until: result | success |
| 25 | retries: 10 |
| 26 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 27 | tags: |
| 28 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 29 | |
| 30 | - name: Get ID of VM |
| 31 | shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_vsg|cut -d '|' -f 2" |
| 32 | register: nova_id |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 33 | tags: |
| 34 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 35 | |
| 36 | - name: Get mgmt IP of VM |
| 37 | shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 172.27.[[:digit:]]*.[[:digit:]]*" |
| 38 | register: mgmt_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 39 | tags: |
| 40 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 41 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 42 | - name: Get name of compute node |
| 43 | shell: bash -c "source ~/admin-openrc.sh; nova service-list|grep nova-compute|cut -d '|' -f 3" |
| 44 | register: node_name |
| 45 | tags: |
| 46 | - skip_ansible_lint # running a sub job |
| 47 | |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 48 | - name: Wait for Docker container inside VM to come up |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 49 | shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "sudo docker ps|grep vcpe" > /dev/null |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 50 | register: result |
| 51 | until: result | success |
| 52 | retries: 20 |
| 53 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 54 | tags: |
| 55 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 56 | |
Andy Bavier | cb03099 | 2016-11-02 14:26:43 -0400 | [diff] [blame] | 57 | - name: get "fabric" bridge interface |
| 58 | shell: route -n | grep 10.6.1.0 | awk '{print $8}' |
| 59 | register: bridge |
| 60 | tags: |
| 61 | - skip_ansible_lint # running a sub job |
| 62 | |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 63 | # Specifying this through container_config below was not working... |
| 64 | - name: set lxc bridge interface |
| 65 | become: yes |
| 66 | lineinfile: |
| 67 | dest: /etc/lxc/default.conf |
| 68 | regexp: "^lxc.network.link =" |
Andy Bavier | cb03099 | 2016-11-02 14:26:43 -0400 | [diff] [blame] | 69 | line: "lxc.network.link = {{ bridge.stdout }}" |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 70 | |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 71 | - name: Create testclient |
| 72 | become: yes |
| 73 | lxc_container: |
| 74 | name: testclient |
| 75 | container_log: true |
| 76 | template: ubuntu |
| 77 | state: started |
| 78 | template_options: --release trusty |
| 79 | container_command: | |
| 80 | ifdown eth0 |
| 81 | sed -i 's/eth0 inet dhcp/eth0 inet manual/g' /etc/network/interfaces |
| 82 | ifup eth0 |
| 83 | ip link show eth0.222 || ip link add link eth0 name eth0.222 type vlan id 222 |
| 84 | ip link show eth0.222.111 || ip link add link eth0.222 name eth0.222.111 type vlan id 111 |
| 85 | ifconfig eth0.222 up |
| 86 | ifconfig eth0.222.111 up |
| 87 | dhclient eth0.222.111 |
| 88 | |
| 89 | # Don't use lxc_container so that we can get output |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 90 | - name: Test external connectivity in test client |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 91 | become: yes |
| 92 | command: lxc-attach -n testclient -- ping -c 3 8.8.8.8 |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 93 | register: pingtest |
Scott Baker | c7a0256 | 2016-10-28 14:38:29 -0700 | [diff] [blame] | 94 | tags: |
| 95 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 96 | |
| 97 | - name: Output from ping test |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 98 | debug: var=pingtest.stdout_lines |