Merge "Adding func_ovs tox environment for neutron ovs testing"

This commit is contained in:
Jenkins 2016-07-20 08:29:04 +00:00 committed by Gerrit Code Review
commit 8eb92817bd
10 changed files with 142 additions and 12 deletions

22
Vagrantfile vendored
View File

@ -1,13 +1,31 @@
# Runs various tests defined in the tox.ini
#
# To run everything but functional tests:
# vagrant up --provision-with bootstrap
#
# To run docs, linters and functional:
# vagrant up
#
# To run docs, linters and func_ovs tests:
# TOX_ENV=func_ovs vagrant up
#
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.provision "shell", inline: <<-SHELL
# Run docs, linters, etc, but no functional tests
config.vm.provision "bootstrap", type: "shell", inline: <<-SHELL
sudo su -
cd /vagrant
apt-get update
./run_tests.sh
FUNCTIONAL_TEST=false ./run_tests.sh
SHELL
# Run functional tests
config.vm.provision "func_test", type: "shell", inline: <<-SHELL
sudo su -
cd /vagrant
tox -e #{ENV['TOX_ENV'] || "functional"}
SHELL
end

View File

@ -33,7 +33,7 @@ pip install tox
# run through each tox env and execute the test
for tox_env in $(awk -F= '/envlist/ {print $2}' tox.ini | sed 's/,/ /g'); do
if [ "${tox_env}" != "functional" ]; then
if [[ "${tox_env}" != "functional" ]] && [[ $tox_env != func_* ]]; then
tox -e ${tox_env}
elif [ "${tox_env}" == "functional" ]; then
if ${FUNCTIONAL_TEST}; then

View File

@ -1,6 +1,5 @@
# {{ ansible_managed }}
# Linux bridge agent physical interface mappings
[ovs]
{% if neutron_tunnel_types | length > 0 %}
local_ip = {{ neutron_local_ip }}

View File

@ -1,8 +1,11 @@
[all]
localhost ansible_connection=local ansible_become=True
localhost ansible_connection=local ansible_ssh_host=127.0.0.1 ansible_become=True
infra1 ansible_host=10.100.100.2 ansible_become=True ansible_user=root
openstack1 ansible_host=10.100.100.3 ansible_become=True ansible_user=root
[physical_host]
localhost
[all_containers]
infra1
openstack1
@ -50,6 +53,7 @@ openstack1
neutron_agent
neutron_dhcp_agent
neutron_linuxbridge_agent
neutron_openvswitch_agent
neutron_metering_agent
neutron_l3_agent
neutron_lbaas_agent

61
tests/ovs_inventory Normal file
View File

@ -0,0 +1,61 @@
[all]
localhost ansible_connection=local ansible_ssh_host=127.0.0.1 ansible_become=True
infra1 ansible_host=10.100.100.2 ansible_become=True ansible_user=root
openstack1 ansible_host=10.100.100.3 ansible_become=True ansible_user=root
[physical_host]
localhost
[all_containers]
infra1
openstack1
[rabbitmq_all]
infra1
[galera_all]
infra1
[service_all:children]
rabbitmq_all
galera_all
[keystone_all]
openstack1
[neutron_agent]
openstack1
[neutron_dhcp_agent]
openstack1
[neutron_linuxbridge_agent]
[neutron_openvswitch_agent]
openstack1
[neutron_metering_agent]
openstack1
[neutron_l3_agent]
openstack1
[neutron_lbaas_agent]
openstack1
[neutron_metadata_agent]
openstack1
[neutron_server]
openstack1
[neutron_all:children]
neutron_agent
neutron_dhcp_agent
neutron_linuxbridge_agent
neutron_openvswitch_agent
neutron_metering_agent
neutron_l3_agent
neutron_lbaas_agent
neutron_metadata_agent
neutron_server

8
tests/ovs_test_vars.yml Normal file
View File

@ -0,0 +1,8 @@
---
openstack_host_specific_kernel_modules:
- name: "openvswitch"
pattern: "CONFIG_OPENVSWITCH="
group: "physical_host"
neutron_plugin_type: ml2.ovs
neutron_local_ip: "{{ ansible_ssh_host }}"

View File

@ -106,6 +106,10 @@
set_fact:
uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive"
when: nodepool.stat.exists | bool
- name: Include OVS testing vars
include_vars: ovs_test_vars.yml
when:
- groups['neutron_openvswitch_agent'] | length > 0
roles:
- role: "{{ rolename | basename }}"
post_tasks:

View File

@ -27,6 +27,14 @@
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: |
. /root/openrc
neutron agent-list
register: agent_list
- name: Ensure that the DHCP agent is alive
shell: |
. /root/openrc
@ -60,12 +68,13 @@
delay: 10
- name: Check for dhcp network namespace
shell: |
ip netns | grep "^qdhcp"
shell: ip netns
register: dhcp_namespace
until: dhcp_namespace.rc == 0
retries: 5
delay: 10
- name: Make sure the dhcp namespace is present
assert:
that:
- "'qdhcp' in dhcp_namespace.stdout"
- name: Check for iptables checksum rule
shell: |
@ -74,3 +83,5 @@
until : checksum_rule.rc == 0
retries: 5
delay: 10
when:
- groups['neutron_linuxbridge_agent'] | length > 0

View File

@ -32,7 +32,12 @@
lxc_container_cache_files:
- { src: '/etc/pip.conf', dest: '/etc/pip.conf' }
when: nodepool.stat.exists | bool
- name: Include OVS testing vars
include_vars: ovs_test_vars.yml
when:
- groups['neutron_openvswitch_agent'] | length > 0
roles:
- role: "openstack_hosts"
- role: "lxc_hosts"
lxc_net_address: 10.100.100.1
lxc_net_dhcp_range: 10.100.100.8,10.100.100.253

24
tox.ini
View File

@ -139,7 +139,7 @@ setenv =
{[testenv:ansible]setenv}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \
ansible-playbook -i {toxinidir}/tests/lxb_inventory \
--syntax-check \
--list-tasks \
-e "rolename={toxinidir}" \
@ -157,6 +157,8 @@ commands =
# NOTE(odyssey4me): this target does not use constraints because
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command.
#
# NOTE(automagically): this target tests neutron with linuxbridge
install_command =
pip install -U --force-reinstall {opts} {packages}
deps =
@ -165,11 +167,29 @@ setenv =
{[testenv:ansible]setenv}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \
ansible-playbook -i {toxinidir}/tests/lxb_inventory \
-e "rolename={toxinidir}" \
-e "install_test_packages=True" \
{toxinidir}/tests/test.yml -vvvv
[testenv:func_ovs]
# NOTE(odyssey4me): this target does not use constraints because
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command.
#
# NOTE(automagically): this target tests neutron with ovs
install_command =
pip install -U --force-reinstall {opts} {packages}
deps =
{[testenv:ansible]deps}
setenv =
{[testenv:ansible]setenv}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/ovs_inventory \
-e "rolename={toxinidir}" \
-e "install_test_packages=True" \
{toxinidir}/tests/test.yml -vvvv
[testenv:linters]
deps =