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