blob: 4515bd05fef38d2cd8b57ab52e61319a32168787 [file] [log] [blame]
Zack Williamsd7b8ffb2017-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
Zack Williamsf6cc0122018-03-30 16:00:49 -070023 until: result is success
Andy Baviera27effe2016-07-18 19:23:26 -040024 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
Scott Bakerda53f732017-09-19 09:57:44 -070048 shell: ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu {{ node_name.stdout }}" ubuntu@{{ mgmt_ip.stdout }} "sudo docker ps|grep 'vsg\|vcpe'" > /dev/null
Andy Baviera27effe2016-07-18 19:23:26 -040049 register: result
Zack Williamsf6cc0122018-03-30 16:00:49 -070050 until: result is success
Zack Williams18b6f022018-01-19 11:46:54 -070051 retries: 40
52 delay: 30
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
Zack Williamsf6cc0122018-03-30 16:00:49 -070066 until: result is 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 Williamsd7b8ffb2017-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