Matteo Scandolo | 3896c47 | 2017-08-01 13:31:42 -0700 | [diff] [blame] | 1 | |
| 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 | |
| 16 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 17 | --- |
| 18 | # test-examplservice/tasks/main.yml |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 19 | # Run tests to check that the single-node deployment has worked |
| 20 | |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 21 | - name: Load TOSCA to apply test config for ExampleService, over REST |
| 22 | xostosca: |
| 23 | url: "http://xos.{{ site_suffix }}:{{ xos_ui_port }}/api/utility/tosca/run/" |
| 24 | user: "{{ xos_admin_user }}" |
| 25 | password: "{{ xos_admin_pass }}" |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 26 | recipe: "{{ lookup('file', head_cord_profile_dir + '/test-exampleservice.yaml' ) }}" |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 27 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 28 | - name: Wait for ExampleService VM to come up |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 29 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null" |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 30 | register: result |
| 31 | until: result | success |
| 32 | retries: 10 |
| 33 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 34 | tags: |
| 35 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 36 | |
| 37 | - name: Get ID of VM |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 38 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2" |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 39 | register: nova_id |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 40 | tags: |
| 41 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 42 | |
| 43 | - name: Get mgmt IP of VM |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 44 | 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 | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 45 | register: mgmt_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 46 | tags: |
| 47 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 48 | |
| 49 | - name: Get public IP of VM |
Andy Bavier | d6c09af | 2017-08-23 17:57:51 -0700 | [diff] [blame] | 50 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '10\.8\.[[:digit:]]*\.[[:digit:]]*'" |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 51 | register: public_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 52 | tags: |
| 53 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 54 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 55 | - name: Get name of compute node |
Moshe Levi | 8f2867c | 2017-07-17 03:52:42 +0300 | [diff] [blame] | 56 | shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova show {{ nova_id.stdout }}|grep hypervisor_hostname|cut -d '|' -f 3" |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 57 | register: node_name |
| 58 | tags: |
| 59 | - skip_ansible_lint # running a sub job |
| 60 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 61 | - name: Wait for Apache to come up inside VM |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 62 | shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "ls /var/run/apache2/apache2.pid" > /dev/null |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 63 | register: result |
| 64 | until: result | success |
| 65 | retries: 20 |
| 66 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 67 | tags: |
| 68 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 69 | |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 70 | - name: start container |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 71 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 72 | lxd_container: |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 73 | name: testclient |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 74 | state: started |
| 75 | |
| 76 | - name: Make sure testclient has default route to vSG |
| 77 | become: yes |
| 78 | shell: lxc exec testclient -- route | grep default | grep "eth0.222.111" |
| 79 | register: result |
| 80 | until: result | success |
Zack Williams | 904e87f | 2017-03-02 14:35:28 -0700 | [diff] [blame] | 81 | retries: 20 |
| 82 | delay: 30 |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 83 | tags: |
| 84 | - skip_ansible_lint # running a sub job |
| 85 | |
| 86 | - name: Download the curl package through the vSG |
| 87 | become: yes |
| 88 | command: lxc exec testclient -- apt-get install -y curl |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 89 | tags: |
| 90 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 91 | |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 92 | # Don't use lxc_container in order to get output |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 93 | - name: Test connectivity to ExampleService from test client |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 94 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 95 | command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }} |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 96 | register: curltest |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 97 | tags: |
| 98 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 99 | |
| 100 | - name: Output from curl test |
| 101 | debug: var=curltest.stdout_lines |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 102 | |