Move to use Tempest tests for Neutron

We're seeing a lot of gate failures due to race conditions that are
causing various failures (dhcp agent not starting in time, iptables
rules not being added in time etc.)

To avoid recreating tempest, lets use tempest to test using the
networking api tests.

Change-Id: I624d1c7ebbc191b1ddb89eef22dd120df6bb5415
This commit is contained in:
Andy McCrae 2016-10-17 14:38:29 +01:00
parent 7849c7d8e3
commit 8980f25c63
6 changed files with 17 additions and 192 deletions

View File

@ -38,6 +38,10 @@
src: https://git.openstack.org/openstack/openstack-ansible-os_keystone src: https://git.openstack.org/openstack/openstack-ansible-os_keystone
scm: git scm: git
version: master version: master
- name: os_tempest
src: https://git.openstack.org/openstack/openstack-ansible-os_tempest
scm: git
version: master
- name: rabbitmq_server - name: rabbitmq_server
src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server
scm: git scm: git

View File

@ -61,32 +61,5 @@ neutron_metadata_agent
neutron_server neutron_server
neutron_calico_dhcp_agent neutron_calico_dhcp_agent
[nova_api_metadata] [utility_all]
openstack1 openstack1
[nova_api_os_compute]
openstack1
[nova_cert]
openstack1
[nova_compute]
localhost
[nova_conductor]
openstack1
[nova_console]
openstack1
[nova_scheduler]
openstack1
[nova_all:children]
nova_api_metadata
nova_api_os_compute
nova_cert
nova_compute
nova_conductor
nova_console
nova_scheduler

View File

@ -66,32 +66,5 @@ neutron_lbaas_agent
neutron_metadata_agent neutron_metadata_agent
neutron_server neutron_server
[nova_api_metadata] [utility_all]
openstack1 openstack1
[nova_api_os_compute]
openstack1
[nova_cert]
openstack1
[nova_compute]
localhost
[nova_conductor]
openstack1
[nova_console]
openstack1
[nova_scheduler]
openstack1
[nova_all:children]
nova_api_metadata
nova_api_os_compute
nova_cert
nova_compute
nova_conductor
nova_console
nova_scheduler

View File

@ -66,32 +66,5 @@ neutron_lbaas_agent
neutron_metadata_agent neutron_metadata_agent
neutron_server neutron_server
[nova_api_metadata] [utility_all]
openstack1 openstack1
[nova_api_os_compute]
openstack1
[nova_cert]
openstack1
[nova_compute]
localhost
[nova_conductor]
openstack1
[nova_console]
openstack1
[nova_scheduler]
openstack1
[nova_all:children]
nova_api_metadata
nova_api_os_compute
nova_cert
nova_compute
nova_conductor
nova_console
nova_scheduler

View File

@ -21,115 +21,14 @@
user: root user: root
gather_facts: true gather_facts: true
tasks: tasks:
- name: Install testing pip packages - name: Run tempest
pip:
name: "{{ item }}"
with_items:
- python-neutronclient
- httplib2
- name: Check the neutron api
uri:
url: "http://localhost:9696"
status_code: 200
# No assertion around this yet, just useful for debug purposes
# TODO(automagically) - Test for all expected agents and agent status
- name: Neutron agents status
shell: | shell: |
. /root/openrc . {{ tempest_venv_bin }}/activate
neutron agent-list {{ tempest_venv_bin | dirname }}/run_tempest.sh --no-virtual-env --serial tempest.api.network
register: agent_list register: run_tempest
until: run_tempest|success
- name: Ensure that the DHCP agent is alive retries: 3
shell: | delay: 5
. /root/openrc
neutron agent-list | grep DHCP
register: neutron_dhcp_agent
until: neutron_dhcp_agent.stdout.find(':-)') != -1
when:
- groups['neutron_dhcp_agent'] | length > 0
retries: 5
delay: 10
- name: Create test network
neutron:
command: create_network
openrc_path: /root/openrc
net_name: test-network
- name: Ensuring network is created correctly
shell: |
. /root/openrc
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
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: |
. /root/openrc
neutron subnet-list -c id -c name -f value | grep test-subnet
register: neutron_subnet_list
until: neutron_subnet_list.rc == 0
retries: 10
delay: 3
# (andymccr): To avoid a race condition we can restart
# the neutron-dhcp-agent service:
# https://bugs.launchpad.net/openstack-ansible/+bug/1629346
- name: Restart neutron-dhcp-agent service
service:
state: restarted
name: neutron-dhcp-agent
- name: Ensure the dhcp agent is on the net
shell: |
. /root/openrc
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
- name: Check for dhcp network namespace
shell: ip netns ls
register: dhcp_namespace
until: dhcp_namespace.stdout.find("qdhcp") != -1
retries: 5
delay: 10
- name: List the namespaces
debug:
msg: "{{ dhcp_namespace }}"
- name: Make sure the dhcp namespace is present
assert:
that:
- "'qdhcp' in dhcp_namespace.stdout"
when:
- groups['neutron_dhcp_agent'] | length > 0
- name: Check for iptables checksum rule
shell: |
ip netns exec {{ dhcp_namespace.stdout.split(' ')[0] }} iptables -C neutron-dhcp-age-POSTROUTING -t mangle -p udp --dport 68 -j CHECKSUM --checksum-fill
register: checksum_rule
until : checksum_rule.rc == 0
retries: 5
delay: 10
when:
- groups['neutron_linuxbridge_agent'] | length > 0
post_tasks: post_tasks:
- include: test-calico-functional.yml - include: test-calico-functional.yml

View File

@ -30,5 +30,8 @@
# Install Neutron # Install Neutron
- include: common/test-install-neutron.yml - include: common/test-install-neutron.yml
# Install Tempest
- include: common/test-install-tempest.yml
# Run tests # Run tests
- include: test-neutron-functional.yml - include: test-neutron-functional.yml