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 | |
Scott Baker | a14575f | 2017-10-26 11:29:04 -0700 | [diff] [blame] | 21 | - name: Configure XOS with profile specific TOSCA (new Engine) |
| 22 | uri: |
Matteo Scandolo | 7831f80 | 2017-11-28 16:46:30 -0800 | [diff] [blame] | 23 | url: "{{ xos_tosca_url }}/run" |
Scott Baker | a14575f | 2017-10-26 11:29:04 -0700 | [diff] [blame] | 24 | method: POST |
| 25 | headers: |
| 26 | xos-username: "{{ xos_admin_user }}" |
| 27 | xos-password: "{{ xos_admin_pass }}" |
| 28 | body: "{{ lookup('file', head_cord_profile_dir + '/test-exampleservice.yaml' ) }}" |
| 29 | status_code: 200 |
| 30 | tags: |
| 31 | - skip_ansible_lint # TOSCA loading should be idempotent |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 32 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 33 | - name: Wait for ExampleService VM to come up |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 34 | 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] | 35 | register: result |
| 36 | until: result | success |
| 37 | retries: 10 |
| 38 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 39 | tags: |
| 40 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 41 | |
| 42 | - name: Get ID of VM |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 43 | 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] | 44 | register: nova_id |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 45 | tags: |
| 46 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 47 | |
| 48 | - name: Get mgmt IP of VM |
Zack Williams | c989f26 | 2017-05-11 13:02:59 -0700 | [diff] [blame] | 49 | 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] | 50 | register: mgmt_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 51 | tags: |
| 52 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 53 | |
| 54 | - name: Get public IP of VM |
Andy Bavier | d6c09af | 2017-08-23 17:57:51 -0700 | [diff] [blame] | 55 | 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] | 56 | register: public_ip |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 57 | tags: |
| 58 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 59 | |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 60 | - name: Get name of compute node |
Moshe Levi | 8f2867c | 2017-07-17 03:52:42 +0300 | [diff] [blame] | 61 | 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] | 62 | register: node_name |
| 63 | tags: |
| 64 | - skip_ansible_lint # running a sub job |
| 65 | |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 66 | - name: Wait for Apache to come up inside VM |
Andy Bavier | 30d27c9 | 2016-09-15 15:59:17 -0400 | [diff] [blame] | 67 | 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] | 68 | register: result |
| 69 | until: result | success |
| 70 | retries: 20 |
| 71 | delay: 60 |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 72 | tags: |
| 73 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 74 | |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 75 | - name: start container |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 76 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 77 | lxd_container: |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 78 | name: testclient |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 79 | state: started |
| 80 | |
| 81 | - name: Make sure testclient has default route to vSG |
| 82 | become: yes |
| 83 | shell: lxc exec testclient -- route | grep default | grep "eth0.222.111" |
| 84 | register: result |
| 85 | until: result | success |
Zack Williams | 904e87f | 2017-03-02 14:35:28 -0700 | [diff] [blame] | 86 | retries: 20 |
| 87 | delay: 30 |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 88 | tags: |
| 89 | - skip_ansible_lint # running a sub job |
| 90 | |
| 91 | - name: Download the curl package through the vSG |
| 92 | become: yes |
| 93 | command: lxc exec testclient -- apt-get install -y curl |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 94 | tags: |
| 95 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 96 | |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 97 | # Don't use lxc_container in order to get output |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 98 | - name: Test connectivity to ExampleService from test client |
Andy Bavier | b83beac | 2016-10-20 15:54:08 -0400 | [diff] [blame] | 99 | become: yes |
Andy Bavier | bef5628 | 2016-11-14 08:22:43 -0800 | [diff] [blame] | 100 | command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }} |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 101 | register: curltest |
Zack Williams | 3562456 | 2016-08-28 17:12:26 -0700 | [diff] [blame] | 102 | tags: |
| 103 | - skip_ansible_lint # running a sub job |
Andy Bavier | 8a7b8b6 | 2016-07-26 18:35:06 -0400 | [diff] [blame] | 104 | |
| 105 | - name: Output from curl test |
| 106 | debug: var=curltest.stdout_lines |
Zack Williams | a276311 | 2017-01-03 11:38:38 -0700 | [diff] [blame] | 107 | |