blob: 308a731715cec54d0b4dc23ae567f1f8785686f2 [file] [log] [blame]
Andy Baviera27effe2016-07-18 19:23:26 -04001---
Andy Bavier8a7b8b62016-07-26 18:35:06 -04002# test-vsg/tasks/main.yml
Andy Baviera27effe2016-07-18 19:23:26 -04003#
Andy Bavierb83beac2016-10-20 15:54:08 -04004# Run tests to check that the CORD-in-a-Box deployment has worked.
Andy Baviera27effe2016-07-18 19:23:26 -04005
6- name: Create a sample CORD subscriber
7 command: ansible xos-1 -u ubuntu -m shell \
8 -a "cd ~/service-profile/cord-pod; make cord-subscriber"
Zack Williams35624562016-08-28 17:12:26 -07009 tags:
10 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040011
12- name: Pause 60 seconds (work around bug in synchronizer)
13 pause: seconds=60
14
15- name: Re-run 'make vtn' (work around bug in synchronizer)
16 command: ansible xos-1 -u ubuntu -m shell \
17 -a "cd ~/service-profile/cord-pod; make vtn"
Zack Williams35624562016-08-28 17:12:26 -070018 tags:
19 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040020
21- name: Wait for vSG VM to come up
22 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep 'vsg.*ACTIVE' > /dev/null"
23 register: result
24 until: result | success
25 retries: 10
26 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070027 tags:
28 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040029
30- name: Get ID of VM
31 shell: bash -c "source ~/admin-openrc.sh; nova list --all-tenants|grep mysite_vsg|cut -d '|' -f 2"
32 register: nova_id
Zack Williams35624562016-08-28 17:12:26 -070033 tags:
34 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040035
36- name: Get mgmt IP of VM
37 shell: bash -c "source ~/admin-openrc.sh; nova interface-list {{ nova_id.stdout }}|grep -o -m 1 172.27.[[:digit:]]*.[[:digit:]]*"
38 register: mgmt_ip
Zack Williams35624562016-08-28 17:12:26 -070039 tags:
40 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040041
Andy Bavier30d27c92016-09-15 15:59:17 -040042- name: Get name of compute node
43 shell: bash -c "source ~/admin-openrc.sh; nova service-list|grep nova-compute|cut -d '|' -f 3"
44 register: node_name
45 tags:
46 - skip_ansible_lint # running a sub job
47
Andy Baviera27effe2016-07-18 19:23:26 -040048- name: Wait for Docker container inside VM to come up
Andy Bavier30d27c92016-09-15 15:59:17 -040049 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 -040050 register: result
51 until: result | success
52 retries: 20
53 delay: 60
Zack Williams35624562016-08-28 17:12:26 -070054 tags:
55 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040056
Andy Bavierb83beac2016-10-20 15:54:08 -040057# Specifying this through container_config below was not working...
58- name: set lxc bridge interface
59 become: yes
60 lineinfile:
61 dest: /etc/lxc/default.conf
62 regexp: "^lxc.network.link ="
63 line: "lxc.network.link = {{ fabric_bridge_on_head_node }}"
Andy Baviera27effe2016-07-18 19:23:26 -040064
Andy Bavierb83beac2016-10-20 15:54:08 -040065- name: Create testclient
66 become: yes
67 lxc_container:
68 name: testclient
69 container_log: true
70 template: ubuntu
71 state: started
72 template_options: --release trusty
73 container_command: |
74 ifdown eth0
75 sed -i 's/eth0 inet dhcp/eth0 inet manual/g' /etc/network/interfaces
76 ifup eth0
77 ip link show eth0.222 || ip link add link eth0 name eth0.222 type vlan id 222
78 ip link show eth0.222.111 || ip link add link eth0.222 name eth0.222.111 type vlan id 111
79 ifconfig eth0.222 up
80 ifconfig eth0.222.111 up
81 dhclient eth0.222.111
82
83# Don't use lxc_container so that we can get output
Andy Baviera27effe2016-07-18 19:23:26 -040084- name: Test external connectivity in test client
Andy Bavierb83beac2016-10-20 15:54:08 -040085 become: yes
86 command: lxc-attach -n testclient -- ping -c 3 8.8.8.8
Andy Baviera27effe2016-07-18 19:23:26 -040087 register: pingtest
Scott Bakerc7a02562016-10-28 14:38:29 -070088 tags:
89 - skip_ansible_lint # running a sub job
Andy Baviera27effe2016-07-18 19:23:26 -040090
91- name: Output from ping test
Zack Williams35624562016-08-28 17:12:26 -070092 debug: var=pingtest.stdout_lines