blob: 0912845ae596e3fc540574d0e0a3deabafb4f827 [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 Baviera27effe2016-07-18 19:23:26 -040017---
Andy Bavier8a7b8b62016-07-26 18:35:06 -040018# test-vsg/tasks/main.yml
Andy Baviera27effe2016-07-18 19:23:26 -040019#
Andy Bavierb83beac2016-10-20 15:54:08 -040020# Run tests to check that the CORD-in-a-Box deployment has worked.
Andy Baviera27effe2016-07-18 19:23:26 -040021
Andy Baviera27effe2016-07-18 19:23:26 -040022- name: Wait for vSG VM to come up
Zack Williamsc989f262017-05-11 13:02:59 -070023 shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep 'vsg.*ACTIVE' > /dev/null"
Andy Baviera27effe2016-07-18 19:23:26 -040024 register: result
25 until: result | success
26 retries: 10
27 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070028 tags:
29 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040030
31- name: Get ID of VM
Zack Williamsc989f262017-05-11 13:02:59 -070032 shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova list --all-tenants|grep mysite_vsg|cut -d '|' -f 2"
Andy Baviera27effe2016-07-18 19:23:26 -040033 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070034 tags:
35 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040036
37- name: Get mgmt IP of VM
Zack Williamsc989f262017-05-11 13:02:59 -070038 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 Baviera27effe2016-07-18 19:23:26 -040039 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070040 tags:
41 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040042
Moshe Levi8f2867c2017-07-17 03:52:42 +030043- name: Get name of compute node
44 shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova show {{ nova_id.stdout }}|grep hypervisor_hostname|cut -d '|' -f 3"
45 register: node_name
46 tags:
47 - skip_ansible_lint # running a sub job
48
Andy Baviera27effe2016-07-18 19:23:26 -040049- name: Wait for Docker container inside VM to come up
Andy Bavier30d27c92016-09-15 15:59:17 -040050 shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "sudo docker ps|grep vcpe" > /dev/null
Andy Baviera27effe2016-07-18 19:23:26 -040051 register: result
52 until: result | success
53 retries: 20
54 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070055 tags:
56 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040057
Andy Bavierbef56282016-11-14 08:22:43 -080058- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040059 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080060 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040061 name: testclient
Andy Bavierb83beac2016-10-20 15:54:08 -040062 state: started
Andy Bavierb83beac2016-10-20 15:54:08 -040063
Andy Bavierbef56282016-11-14 08:22:43 -080064- name: Make sure testclient has default route to vSG
65 become: yes
66 shell: lxc exec testclient -- route | grep default | grep "eth0.222.111"
67 register: result
68 until: result | success
Zack Williams904e87f2017-03-02 14:35:28 -070069 retries: 20
70 delay: 30
Andy Bavierbef56282016-11-14 08:22:43 -080071 tags:
72 - skip_ansible_lint # running a sub job
73
Andy Baviera27effe2016-07-18 19:23:26 -040074- name: Test external connectivity in test client
Andy Bavierb83beac2016-10-20 15:54:08 -040075 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080076 command: lxc exec testclient -- ping -c 3 8.8.8.8
Andy Baviera27effe2016-07-18 19:23:26 -040077 register: pingtest
Scott Bakerc7a02562016-10-28 14:38:29 -070078 tags:
79 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040080
81- name: Output from ping test
Zack Williams35624562016-08-28 17:12:26 -070082 debug: var=pingtest.stdout_lines
Zack Williamsa2763112017-01-03 11:38:38 -070083