Adding func_ovs tox environment for neutron ovs testing

This tox environment will be run with check experimental for now.
Ultimately it should become part of the gate testing for the role.

Change-Id: I410f029816590dde819a6c97bde5f159f7a791d1
Implements: blueprint support-openvswitch
This commit is contained in:
Travis Truman 2016-07-14 14:07:28 -04:00
parent 1240dd0cf0
commit eb0bb51faf
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| Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64" config.vm.box = "ubuntu/trusty64"
config.vm.provider "virtualbox" do |v| config.vm.provider "virtualbox" do |v|
v.memory = 2048 v.memory = 2048
v.cpus = 2 v.cpus = 2
end 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 - sudo su -
cd /vagrant cd /vagrant
apt-get update 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 SHELL
end end

View File

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

View File

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

View File

@ -1,8 +1,11 @@
[all] [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 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 openstack1 ansible_host=10.100.100.3 ansible_become=True ansible_user=root
[physical_host]
localhost
[all_containers] [all_containers]
infra1 infra1
openstack1 openstack1
@ -50,6 +53,7 @@ openstack1
neutron_agent neutron_agent
neutron_dhcp_agent neutron_dhcp_agent
neutron_linuxbridge_agent neutron_linuxbridge_agent
neutron_openvswitch_agent
neutron_metering_agent neutron_metering_agent
neutron_l3_agent neutron_l3_agent
neutron_lbaas_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: set_fact:
uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive" uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive"
when: nodepool.stat.exists | bool when: nodepool.stat.exists | bool
- name: Include OVS testing vars
include_vars: ovs_test_vars.yml
when:
- groups['neutron_openvswitch_agent'] | length > 0
roles: roles:
- role: "{{ rolename | basename }}" - role: "{{ rolename | basename }}"
post_tasks: post_tasks:

View File

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

View File

@ -32,7 +32,12 @@
lxc_container_cache_files: lxc_container_cache_files:
- { src: '/etc/pip.conf', dest: '/etc/pip.conf' } - { src: '/etc/pip.conf', dest: '/etc/pip.conf' }
when: nodepool.stat.exists | bool when: nodepool.stat.exists | bool
- name: Include OVS testing vars
include_vars: ovs_test_vars.yml
when:
- groups['neutron_openvswitch_agent'] | length > 0
roles: roles:
- role: "openstack_hosts"
- role: "lxc_hosts" - role: "lxc_hosts"
lxc_net_address: 10.100.100.1 lxc_net_address: 10.100.100.1
lxc_net_dhcp_range: 10.100.100.8,10.100.100.253 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} {[testenv:ansible]setenv}
commands = commands =
{[testenv:ansible]commands} {[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \ ansible-playbook -i {toxinidir}/tests/lxb_inventory \
--syntax-check \ --syntax-check \
--list-tasks \ --list-tasks \
-e "rolename={toxinidir}" \ -e "rolename={toxinidir}" \
@ -157,6 +157,8 @@ commands =
# NOTE(odyssey4me): this target does not use constraints because # NOTE(odyssey4me): this target does not use constraints because
# it doesn't work in OpenStack-CI yet. Once that's fixed, we can # it doesn't work in OpenStack-CI yet. Once that's fixed, we can
# drop the install_command. # drop the install_command.
#
# NOTE(automagically): this target tests neutron with linuxbridge
install_command = install_command =
pip install -U --force-reinstall {opts} {packages} pip install -U --force-reinstall {opts} {packages}
deps = deps =
@ -165,11 +167,29 @@ setenv =
{[testenv:ansible]setenv} {[testenv:ansible]setenv}
commands = commands =
{[testenv:ansible]commands} {[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/inventory \ ansible-playbook -i {toxinidir}/tests/lxb_inventory \
-e "rolename={toxinidir}" \ -e "rolename={toxinidir}" \
-e "install_test_packages=True" \ -e "install_test_packages=True" \
{toxinidir}/tests/test.yml -vvvv {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] [testenv:linters]
deps = deps =