blob: 99a165566f52b0682516948d041bbbdb1ab87a37 [file] [log] [blame]
Zack Williams18b6f022018-01-19 11:46:54 -07001---
Matteo Scandolo3896c472017-08-01 13:31:42 -07002# 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 Williams18b6f022018-01-19 11:46:54 -070016# test-exampleservice/tasks/main.yml
Andy Bavier8a7b8b62016-07-26 18:35:06 -040017# Run tests to check that the single-node deployment has worked
18
Scott Bakera14575f2017-10-26 11:29:04 -070019- name: Configure XOS with profile specific TOSCA (new Engine)
20 uri:
Matteo Scandolo7831f802017-11-28 16:46:30 -080021 url: "{{ xos_tosca_url }}/run"
Scott Bakera14575f2017-10-26 11:29:04 -070022 method: POST
23 headers:
24 xos-username: "{{ xos_admin_user }}"
Zack Williamsfc6b64b2017-12-22 15:57:50 -070025 xos-password: "{{ head_xos_admin_pass }}"
Scott Bakera14575f2017-10-26 11:29:04 -070026 body: "{{ lookup('file', head_cord_profile_dir + '/test-exampleservice.yaml' ) }}"
27 status_code: 200
Scott Baker253ebc22018-01-17 16:16:35 -080028 register: result
Zack Williamsf6cc0122018-03-30 16:00:49 -070029 until: result is success
Scott Baker3f24f642018-01-22 11:38:20 -080030 retries: 50
31 delay: 5
Scott Bakera14575f2017-10-26 11:29:04 -070032 tags:
33 - skip_ansible_lint # TOSCA loading should be idempotent
Andy Bavier8a7b8b62016-07-26 18:35:06 -040034
Andy Bavier8a7b8b62016-07-26 18:35:06 -040035- name: Wait for ExampleService VM to come up
Zack Williamsc989f262017-05-11 13:02:59 -070036 shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null"
Andy Bavier8a7b8b62016-07-26 18:35:06 -040037 register: result
Zack Williamsf6cc0122018-03-30 16:00:49 -070038 until: result is success
Andy Bavier8a7b8b62016-07-26 18:35:06 -040039 retries: 10
40 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070041 tags:
42 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040043
44- name: Get ID of VM
Zack Williamsc989f262017-05-11 13:02:59 -070045 shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
Andy Bavier8a7b8b62016-07-26 18:35:06 -040046 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070047 tags:
48 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040049
50- name: Get mgmt IP of VM
Zack Williamsc989f262017-05-11 13:02:59 -070051 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 Bavier8a7b8b62016-07-26 18:35:06 -040052 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070053 tags:
54 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040055
56- name: Get public IP of VM
Andy Bavierd6c09af2017-08-23 17:57:51 -070057 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 Bavier8a7b8b62016-07-26 18:35:06 -040058 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070059 tags:
60 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040061
Andy Bavier30d27c92016-09-15 15:59:17 -040062- name: Get name of compute node
Moshe Levi8f2867c2017-07-17 03:52:42 +030063 shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova show {{ nova_id.stdout }}|grep hypervisor_hostname|cut -d '|' -f 3"
Andy Bavier30d27c92016-09-15 15:59:17 -040064 register: node_name
65 tags:
66 - skip_ansible_lint # running a sub job
67
Andy Bavier8a7b8b62016-07-26 18:35:06 -040068- name: Wait for Apache to come up inside VM
Andy Bavier30d27c92016-09-15 15:59:17 -040069 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 Bavier8a7b8b62016-07-26 18:35:06 -040070 register: result
Zack Williamsf6cc0122018-03-30 16:00:49 -070071 until: result is success
Andy Bavier8a7b8b62016-07-26 18:35:06 -040072 retries: 20
73 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070074 tags:
75 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040076
Andy Bavierbef56282016-11-14 08:22:43 -080077- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040078 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080079 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040080 name: testclient
Andy Bavierbef56282016-11-14 08:22:43 -080081 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 Williamsf6cc0122018-03-30 16:00:49 -070087 until: result is success
Zack Williams904e87f2017-03-02 14:35:28 -070088 retries: 20
89 delay: 30
Andy Bavierbef56282016-11-14 08:22:43 -080090 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 Williams35624562016-08-28 17:12:26 -070096 tags:
97 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040098
Andy Bavierb83beac2016-10-20 15:54:08 -040099# Don't use lxc_container in order to get output
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400100- name: Test connectivity to ExampleService from test client
Andy Bavierb83beac2016-10-20 15:54:08 -0400101 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -0800102 command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400103 register: curltest
Zack Williams35624562016-08-28 17:12:26 -0700104 tags:
105 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400106
107- name: Output from curl test
108 debug: var=curltest.stdout_lines
Zack Williamsa2763112017-01-03 11:38:38 -0700109