Zack Williams | d7b8ffb | 2017-09-27 15:13:17 -0700 | [diff] [blame^] | 1 | --- |
Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 16 | # test-vsg/tasks/main.yml |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 17 | # |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 18 | # 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] | 19 | |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 20 | - name: Wait for vSG VM to come up |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 21 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep 'vsg.*ACTIVE' > /dev/null" |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 22 | register: result |
| 23 | until: result | success |
| 24 | retries: 10 |
| 25 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 26 | tags: |
| 27 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 28 | |
| 29 | - name: Get ID of VM |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 30 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep mysite_vsg|cut -d '|' -f 2" |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 31 | register: nova_id |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 32 | tags: |
| 33 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 34 | |
| 35 | - name: Get mgmt IP of VM |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 36 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '172\.27\.[[:digit:]]*\.[[:digit:]]*'" |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 37 | register: mgmt_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 38 | tags: |
| 39 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 40 | |
Moshe Levi | 8f2867c | 2017-07-17 03:52:42 +0300 | [diff] [blame] | 41 | - name: Get name of compute node |
| 42 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova show {{ nova_id.stdout }}|grep hypervisor_hostname|cut -d '|' -f 3" |
| 43 | register: node_name |
| 44 | tags: |
| 45 | - skip_ansible_lint # running a sub job |
| 46 | |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 47 | - name: Wait for Docker container inside VM to come up |
Scott Baker | da53f73 | 2017-09-19 09:57:44 -0700 | [diff] [blame] | 48 | shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "sudo docker ps|grep 'vsg\|vcpe'" > /dev/null |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 49 | register: result |
| 50 | until: result | success |
| 51 | retries: 20 |
| 52 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 53 | tags: |
| 54 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 55 | |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 56 | - name: start container |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 57 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 58 | lxd_container: |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 59 | name: testclient |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 60 | state: started |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 61 | |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 62 | - name: Make sure testclient has default route to vSG |
| 63 | become: yes |
| 64 | shell: lxc exec testclient -- route | grep default | grep "eth0.222.111" |
| 65 | register: result |
| 66 | until: result | success |
Zack Williams | 904e87f | 2017-03-02 14:35:28 -0700 | [diff] [blame] | 67 | retries: 20 |
| 68 | delay: 30 |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 69 | tags: |
| 70 | - skip_ansible_lint # running a sub job |
| 71 | |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 72 | - name: Test external connectivity in test client |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 73 | become: yes |
Zack Williams | d7b8ffb | 2017-09-27 15:13:17 -0700 | [diff] [blame^] | 74 | command: "lxc exec testclient -- ping -c 3 {{ lookup('dig', vsg_test_ping_target) }}" |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 75 | register: pingtest |
Scott Baker | c7a0256 | 2016-10-28 14:38:29 -0700 | [diff] [blame] | 76 | tags: |
| 77 | - skip_ansible_lint # running a sub job |
Andy Bavier | a27effe | 2016-07-18 19:23:26 -0400 | [diff] [blame] | 78 | |
| 79 | - name: Output from ping test |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 80 | debug: var=pingtest.stdout_lines |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 81 | |