From 090ab22301981a85ede72a39bb92481864987102 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Thu, 15 Sep 2016 11:20:44 +0100 Subject: [PATCH] Wait for net to be fully instantiated This adds a check to see if the dhcp is properly up, with neutron call of the dhcp-agent-list-hosting-net instead of checking the port presence. This is more reliable and should be the way to check. (The port can come up later and the check is subject to race conditions). Change-Id: I8a5286b93fa3a213d85109721cb37b4f7f98f4a4 Signed-off-by: Jean-Philippe Evrard --- tests/test-neutron-functional.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/test-neutron-functional.yml b/tests/test-neutron-functional.yml index 7d68ce89..661ee205 100644 --- a/tests/test-neutron-functional.yml +++ b/tests/test-neutron-functional.yml @@ -55,19 +55,21 @@ - name: Ensuring network is created correctly shell: | . /root/openrc - neutron net-list | grep test-network + neutron net-list -c id -c name -f value | grep test-network register: neutron_net_list until: neutron_net_list.rc == 0 retries: 10 delay: 3 - name: Create test subnet - neutron: - command: create_subnet - openrc_path: /root/openrc - net_name: test-network - subnet_name: test-subnet - cidr: "192.168.74.0/24" + shell: | + . /root/openrc + neutron subnet-create --name test-subnet test-network 192.168.74.0/24 + register: neutron_subnet_create + +- name: Debug test subnet output + debug: + msg: "{{ neutron_subnet_create.stdout_lines }}" - name: Ensuring subnet is created correctly shell: | @@ -78,12 +80,12 @@ retries: 10 delay: 3 -- name: Ensuring dhcp port is present +- name: Ensure the dhcp agent is on the net shell: | . /root/openrc - neutron port-list -c device_owner -c id -c fixed_ips -f value | egrep 'dhcp.*{{ neutron_subnet_list.stdout_lines[0].split(' ')[0] }}' - register: neutron_port_list_dhcp - until: neutron_port_list_dhcp.rc == 0 + neutron dhcp-agent-list-hosting-net '{{ neutron_net_list.stdout_lines[0].split(' ')[0] }}' | grep ":-)" + register: neutron_dhcp_agent_list + until: neutron_dhcp_agent_list.rc == 0 retries: 10 delay: 3