blob: 64f03d9567cfbe24ed06d9e9935572a79c226284 [file] [log] [blame]
Matteo Scandolo3896c472017-08-01 13:31:42 -07001
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 Bavier8a7b8b62016-07-26 18:35:06 -040017---
18# test-examplservice/tasks/main.yml
Andy Bavier8a7b8b62016-07-26 18:35:06 -040019# Run tests to check that the single-node deployment has worked
20
Scott Bakerdfca35f2017-10-26 11:29:04 -070021- name: Configure XOS with profile specific TOSCA (new Engine)
22 uri:
Matteo Scandoloda864802017-11-28 16:46:30 -080023 url: "{{ xos_tosca_url }}/run"
Scott Bakerdfca35f2017-10-26 11:29:04 -070024 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 Bavier8a7b8b62016-07-26 18:35:06 -040032
Andy Bavier8a7b8b62016-07-26 18:35:06 -040033- name: Wait for ExampleService VM to come up
Zack Williamsc989f262017-05-11 13:02:59 -070034 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 -040035 register: result
36 until: result | success
37 retries: 10
38 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070039 tags:
40 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040041
42- name: Get ID of VM
Zack Williamsc989f262017-05-11 13:02:59 -070043 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 -040044 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070045 tags:
46 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040047
48- name: Get mgmt IP of VM
Zack Williamsc989f262017-05-11 13:02:59 -070049 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 -040050 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070051 tags:
52 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040053
54- name: Get public IP of VM
Andy Bavierd6c09af2017-08-23 17:57:51 -070055 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 -040056 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070057 tags:
58 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040059
Andy Bavier30d27c92016-09-15 15:59:17 -040060- name: Get name of compute node
Moshe Levi8f2867c2017-07-17 03:52:42 +030061 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 -040062 register: node_name
63 tags:
64 - skip_ansible_lint # running a sub job
65
Andy Bavier8a7b8b62016-07-26 18:35:06 -040066- name: Wait for Apache to come up inside VM
Andy Bavier30d27c92016-09-15 15:59:17 -040067 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 -040068 register: result
69 until: result | success
70 retries: 20
71 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070072 tags:
73 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040074
Andy Bavierbef56282016-11-14 08:22:43 -080075- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040076 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080077 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040078 name: testclient
Andy Bavierbef56282016-11-14 08:22:43 -080079 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 Williams904e87f2017-03-02 14:35:28 -070086 retries: 20
87 delay: 30
Andy Bavierbef56282016-11-14 08:22:43 -080088 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 Williams35624562016-08-28 17:12:26 -070094 tags:
95 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040096
Andy Bavierb83beac2016-10-20 15:54:08 -040097# Don't use lxc_container in order to get output
Andy Bavier8a7b8b62016-07-26 18:35:06 -040098- name: Test connectivity to ExampleService from test client
Andy Bavierb83beac2016-10-20 15:54:08 -040099 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -0800100 command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400101 register: curltest
Zack Williams35624562016-08-28 17:12:26 -0700102 tags:
103 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400104
105- name: Output from curl test
106 debug: var=curltest.stdout_lines
Zack Williamsa2763112017-01-03 11:38:38 -0700107