blob: 97969e67b981642670f9e0ef8e353143c23af5cc [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 Bakera14575f2017-10-26 11:29:04 -070021- name: Configure XOS with profile specific TOSCA (new Engine)
22 uri:
Matteo Scandolo7831f802017-11-28 16:46:30 -080023 url: "{{ xos_tosca_url }}/run"
Scott Bakera14575f2017-10-26 11:29:04 -070024 method: POST
25 headers:
26 xos-username: "{{ xos_admin_user }}"
Zack Williamsfc6b64b2017-12-22 15:57:50 -070027 xos-password: "{{ head_xos_admin_pass }}"
Scott Bakera14575f2017-10-26 11:29:04 -070028 body: "{{ lookup('file', head_cord_profile_dir + '/test-exampleservice.yaml' ) }}"
29 status_code: 200
Scott Baker253ebc22018-01-17 16:16:35 -080030 register: result
31 until: result | success
32 retries: 40
33 delay: 2
Scott Bakera14575f2017-10-26 11:29:04 -070034 tags:
35 - skip_ansible_lint # TOSCA loading should be idempotent
Andy Bavier8a7b8b62016-07-26 18:35:06 -040036
Andy Bavier8a7b8b62016-07-26 18:35:06 -040037- name: Wait for ExampleService VM to come up
Zack Williamsc989f262017-05-11 13:02:59 -070038 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 -040039 register: result
40 until: result | success
41 retries: 10
42 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070043 tags:
44 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040045
46- name: Get ID of VM
Zack Williamsc989f262017-05-11 13:02:59 -070047 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 -040048 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070049 tags:
50 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040051
52- name: Get mgmt IP of VM
Zack Williamsc989f262017-05-11 13:02:59 -070053 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 -040054 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070055 tags:
56 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040057
58- name: Get public IP of VM
Andy Bavierd6c09af2017-08-23 17:57:51 -070059 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 -040060 register: public_ip
Zack Williams35624562016-08-28 17:12:26 -070061 tags:
62 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040063
Andy Bavier30d27c92016-09-15 15:59:17 -040064- name: Get name of compute node
Moshe Levi8f2867c2017-07-17 03:52:42 +030065 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 -040066 register: node_name
67 tags:
68 - skip_ansible_lint # running a sub job
69
Andy Bavier8a7b8b62016-07-26 18:35:06 -040070- name: Wait for Apache to come up inside VM
Andy Bavier30d27c92016-09-15 15:59:17 -040071 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 -040072 register: result
73 until: result | success
74 retries: 20
75 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070076 tags:
77 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -040078
Andy Bavierbef56282016-11-14 08:22:43 -080079- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040080 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080081 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040082 name: testclient
Andy Bavierbef56282016-11-14 08:22:43 -080083 state: started
84
85- name: Make sure testclient has default route to vSG
86 become: yes
87 shell: lxc exec testclient -- route | grep default | grep "eth0.222.111"
88 register: result
89 until: result | success
Zack Williams904e87f2017-03-02 14:35:28 -070090 retries: 20
91 delay: 30
Andy Bavierbef56282016-11-14 08:22:43 -080092 tags:
93 - skip_ansible_lint # running a sub job
94
95- name: Download the curl package through the vSG
96 become: yes
97 command: lxc exec testclient -- apt-get install -y curl
Zack Williams35624562016-08-28 17:12:26 -070098 tags:
99 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400100
Andy Bavierb83beac2016-10-20 15:54:08 -0400101# Don't use lxc_container in order to get output
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400102- name: Test connectivity to ExampleService from test client
Andy Bavierb83beac2016-10-20 15:54:08 -0400103 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -0800104 command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400105 register: curltest
Zack Williams35624562016-08-28 17:12:26 -0700106 tags:
107 - skip_ansible_lint # running a sub job
Andy Bavier8a7b8b62016-07-26 18:35:06 -0400108
109- name: Output from curl test
110 debug: var=curltest.stdout_lines
Zack Williamsa2763112017-01-03 11:38:38 -0700111