Add functional testing for Calico

Change-Id: I2f3e3aac1da800b41055bcb82cb7c4e07a20d8e2
This commit is contained in:
Logan V 2016-09-09 22:24:04 -05:00 committed by Kevin Carter (cloudnull)
parent fa6088afab
commit 085713af39
10 changed files with 147 additions and 4 deletions

View File

@ -42,10 +42,6 @@
src: https://git.openstack.org/openstack/openstack-ansible-rabbitmq_server
scm: git
version: master
- name: bird
scm: git
src: https://github.com/logan2211/ansible-bird
version: master
- name: etcd
scm: git
src: https://github.com/logan2211/ansible-etcd

58
tests/calico_inventory Normal file
View File

@ -0,0 +1,58 @@
[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
[etcd_all]
infra1
[etcd:children]
etcd_all
[service_all:children]
rabbitmq_all
galera_all
etcd_all
[keystone_all]
openstack1
[neutron_calico_dhcp_agent]
openstack1
[neutron_server]
openstack1
[neutron_agent]
[neutron_dhcp_agent]
[neutron_linuxbridge_agent]
[neutron_openvswitch_agent]
[neutron_metering_agent]
[neutron_l3_agent]
[neutron_lbaas_agent]
[neutron_metadata_agent]
[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
neutron_calico_dhcp_agent

View File

@ -0,0 +1,18 @@
---
# Copyright 2016, Logan Vig <logan2211@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
neutron_plugin_type: ml2.calico
neutron_provider_networks:
network_types: ''

View File

@ -49,6 +49,8 @@ openstack1
[neutron_server]
openstack1
[neutron_calico_dhcp_agent]
[neutron_all:children]
neutron_agent
neutron_dhcp_agent

View File

@ -49,6 +49,8 @@ openstack1
[neutron_server]
openstack1
[neutron_calico_dhcp_agent]
[neutron_all:children]
neutron_agent
neutron_dhcp_agent

View File

@ -0,0 +1,31 @@
---
# Copyright 2016, Logan Vig <logan2211@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Ensure Calico services are running
command: pgrep -a {{ item }}
with_items:
- calico-felix
- calico-dhcp-age
- name: Ensure that the Calico Felix agent is alive
shell: |
. /root/openrc
neutron agent-list | grep calico-felix
register: calico_felix_agent
until: calico_felix_agent.stdout.find(':-)') != -1
when:
- groups['neutron_calico_dhcp_agent'] | length > 0
retries: 5
delay: 10

View File

@ -17,6 +17,11 @@
hosts: service_all
user: root
gather_facts: true
pre_tasks:
- name: Include Calico testing vars
include_vars: calico_test_vars.yml
when:
- groups['neutron_calico_dhcp_agent'] | length > 0
roles:
- role: "rabbitmq_server"
rabbitmq_cookie_token: secrete
@ -30,3 +35,6 @@
galera_wsrep_provider_options:
- { option: "gcache.size", value: "32M" }
galera_server_id: "{{ inventory_hostname | string_2_int }}"
- role: "etcd"
when:
- groups['neutron_calico_dhcp_agent'] | length > 0

View File

@ -110,9 +110,16 @@
include_vars: ovs_test_vars.yml
when:
- groups['neutron_openvswitch_agent'] | length > 0
- name: Include Calico testing vars
include_vars: calico_test_vars.yml
when:
- groups['neutron_calico_dhcp_agent'] | length > 0
roles:
- role: "{{ rolename | basename }}"
post_tasks:
- include: test-neutron-functional.yml
- include: test-calico-functional.yml
when:
- "{{ neutron_plugin_type == 'ml2.calico' }}"
vars_files:
- test-vars.yml

View File

@ -41,6 +41,8 @@
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
@ -97,6 +99,8 @@
assert:
that:
- "'qdhcp' in dhcp_namespace.stdout"
when:
- groups['neutron_dhcp_agent'] | length > 0
- name: Check for iptables checksum rule
shell: |

17
tox.ini
View File

@ -204,6 +204,23 @@ commands =
{toxinidir}/tests/test.yml -vvvv
{[testenv:func_logs]commands}
[testenv:calico]
# NOTE(logan): this target tests neutron with calico
install_command =
{[testenv:func_base]install_command}
deps =
{[testenv:ansible]deps}
setenv =
{[testenv:ansible]setenv}
commands =
{[testenv:ansible]commands}
ansible-playbook -i {toxinidir}/tests/calico_inventory \
-e "rolename={toxinidir}" \
-e "install_test_packages=True" \
{toxinidir}/tests/test.yml -vvvv
bash -c 'mkdir -p {toxinidir}/logs'
bash -c 'rsync -av --ignore-errors /var/log/ /openstack/log/ {toxinidir}/logs/ || true'
[testenv:linters]
deps =