blob: 8e76feec5a6d17951a28a8a3426b9e09f54ee4fc [file] [log] [blame]
Zack Williams1a371232017-09-27 15:13:17 -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
Andy Bavier8a7b8b62016-07-26 18:35:06 -040016# test-vsg/tasks/main.yml
Andy Baviera27effe2016-07-18 19:23:26 -040017#
Andy Bavierb83beac2016-10-20 15:54:08 -040018# Run tests to check that the CORD-in-a-Box deployment has worked.
Andy Baviera27effe2016-07-18 19:23:26 -040019
Andy Baviera27effe2016-07-18 19:23:26 -040020- name: Wait for vSG VM to come up
Zack Williamsc989f262017-05-11 13:02:59 -070021 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 -040022 register: result
23 until: result | success
24 retries: 10
25 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070026 tags:
27 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040028
29- name: Get ID of VM
Zack Williamsc989f262017-05-11 13:02:59 -070030 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 -040031 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070032 tags:
33 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040034
35- name: Get mgmt IP of VM
Zack Williamsc989f262017-05-11 13:02:59 -070036 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 -040037 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070038 tags:
39 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040040
Moshe Levi8f2867c2017-07-17 03:52:42 +030041- name: Get name of compute node
42 shell: bash -c "source /opt/cord_profile/admin-openrc.sh; nova show {{ nova_id.stdout }}|grep hypervisor_hostname|cut -d '|' -f 3"
43 register: node_name
44 tags:
45 - skip_ansible_lint # running a sub job
46
Andy Baviera27effe2016-07-18 19:23:26 -040047- name: Wait for Docker container inside VM to come up
Andy Bavier30d27c92016-09-15 15:59:17 -040048 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 -040049 register: result
50 until: result | success
51 retries: 20
52 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070053 tags:
54 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040055
Andy Bavierbef56282016-11-14 08:22:43 -080056- name: start container
Andy Bavierb83beac2016-10-20 15:54:08 -040057 become: yes
Andy Bavierbef56282016-11-14 08:22:43 -080058 lxd_container:
Andy Bavierb83beac2016-10-20 15:54:08 -040059 name: testclient
Andy Bavierb83beac2016-10-20 15:54:08 -040060 state: started
Andy Bavierb83beac2016-10-20 15:54:08 -040061
Andy Bavierbef56282016-11-14 08:22:43 -080062- name: Make sure testclient has default route to vSG
63 become: yes
64 shell: lxc exec testclient -- route | grep default | grep "eth0.222.111"
65 register: result
66 until: result | success
Zack Williams904e87f2017-03-02 14:35:28 -070067 retries: 20
68 delay: 30
Andy Bavierbef56282016-11-14 08:22:43 -080069 tags:
70 - skip_ansible_lint # running a sub job
71
Andy Baviera27effe2016-07-18 19:23:26 -040072- name: Test external connectivity in test client
Andy Bavierb83beac2016-10-20 15:54:08 -040073 become: yes
Zack Williams1a371232017-09-27 15:13:17 -070074 command: "lxc exec testclient -- ping -c 3 {{ lookup('dig', vsg_test_ping_target) }}"
Andy Baviera27effe2016-07-18 19:23:26 -040075 register: pingtest
Scott Bakerc7a02562016-10-28 14:38:29 -070076 tags:
77 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040078
79- name: Output from ping test
Zack Williams35624562016-08-28 17:12:26 -070080 debug: var=pingtest.stdout_lines
Zack Williamsa2763112017-01-03 11:38:38 -070081