blob: 168697fb88b47680e3d68972e8bdff07c362593a [file] [log] [blame]
# Copyright 2017-present Open Networking Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
# test-examplservice/tasks/main.yml
# Run tests to check that the single-node deployment has worked
- name: Load TOSCA to apply test config for ExampleService, over REST
xostosca:
url: "http://xos.{{ site_suffix }}:{{ xos_ui_port }}/api/utility/tosca/run/"
user: "{{ xos_admin_user }}"
password: "{{ maas_xos_admin_pass }}"
recipe: "{{ lookup('file', head_cord_profile_dir + '/test-exampleservice.yaml' ) }}"
- name: Wait for ExampleService VM to come up
shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep 'exampleservice.*ACTIVE' > /dev/null"
register: result
until: result | success
retries: 10
delay: 60
tags:
- skip_ansible_lint # running a sub job
- name: Get ID of VM
shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep mysite_exampleservice|cut -d '|' -f 2"
register: nova_id
tags:
- skip_ansible_lint # running a sub job
- name: Get mgmt IP of VM
shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '172\.27\.[[:digit:]]*\.[[:digit:]]*'"
register: mgmt_ip
tags:
- skip_ansible_lint # running a sub job
- name: Get public IP of VM
shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 '10\.8\.[[:digit:]]*\.[[:digit:]]*'"
register: public_ip
tags:
- skip_ansible_lint # running a sub job
- name: Get name of compute node
shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova show {{ nova_id.stdout }}|grep hypervisor_hostname|cut -d '|' -f 3"
register: node_name
tags:
- skip_ansible_lint # running a sub job
- name: Wait for Apache to come up inside VM
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
register: result
until: result | success
retries: 20
delay: 60
tags:
- skip_ansible_lint # running a sub job
- name: start container
become: yes
lxd_container:
name: testclient
state: started
- name: Make sure testclient has default route to vSG
become: yes
shell: lxc exec testclient -- route | grep default | grep "eth0.222.111"
register: result
until: result | success
retries: 20
delay: 30
tags:
- skip_ansible_lint # running a sub job
- name: Download the curl package through the vSG
become: yes
command: lxc exec testclient -- apt-get install -y curl
tags:
- skip_ansible_lint # running a sub job
# Don't use lxc_container in order to get output
- name: Test connectivity to ExampleService from test client
become: yes
command: lxc exec testclient -- curl -s http://{{ public_ip.stdout }}
register: curltest
tags:
- skip_ansible_lint # running a sub job
- name: Output from curl test
debug: var=curltest.stdout_lines