functional: Stop compiling OVS from source

There is a bug 1640283 fixed in OVS 2.5.1 but currently we ship Neutron
with openvswitch 2.5.0. The patch adds a decorator that skips particular
tests in case minimal version requirement is not met.

Change-Id: I3a665f3ba770e4acad7e7ead3f8cc557a86952cf
This commit is contained in:
Jakub Libosvar 2017-02-22 11:44:43 -05:00 committed by Ihar Hrachyshka
parent d46636112f
commit 7210696702
3 changed files with 27 additions and 7 deletions

View File

@ -13,6 +13,8 @@
# under the License.
import datetime
from distutils import version
import functools
import os
import random
@ -22,6 +24,7 @@ import six
import testtools
import neutron
from neutron.agent.common import ovs_lib
from neutron.common import topics
from neutron import context
from neutron.db import agents_db
@ -220,3 +223,21 @@ def get_not_used_vlan(bridge, vlan_range):
used_vlan_tags = {val['tag'] for val in port_vlans}
available_vlans = vlan_range - used_vlan_tags
return random.choice(list(available_vlans))
def skip_if_ovs_older_than(ovs_version):
"""Decorator for test method to skip if OVS version doesn't meet
minimal requirement.
"""
def skip_if_bad_ovs(f):
@functools.wraps(f)
def check_ovs_and_skip(test):
ovs = ovs_lib.BaseOVS()
current_ovs_version = version.StrictVersion(
ovs.config['ovs_version'])
if current_ovs_version < version.StrictVersion(ovs_version):
test.skip("This test requires OVS version %s or higher." %
ovs_version)
return f(test)
return check_ovs_and_skip
return skip_if_bad_ovs

View File

@ -63,14 +63,11 @@ case $VENV in
configure_host_for_func_testing
# Kernel modules are not needed for functional job. They are needed only
# for fullstack because of bug present in Ubuntu Xenial kernel version
# that makes VXLAN local tunneling fail.
if [[ "$VENV" =~ "dsvm-functional" ]]; then
compile_modules=False
NEUTRON_OVERRIDE_OVS_BRANCH=v2.5.1
# Because of bug present in current Ubuntu Xenial kernel version
# we need a fix for VXLAN local tunneling.
if [[ "$VENV" =~ "dsvm-fullstack" ]]; then
upgrade_ovs_if_necessary
fi
upgrade_ovs_if_necessary $compile_modules
# prepare base environment for ./stack.sh
load_rc_hook stack_base

View File

@ -32,6 +32,7 @@ from neutron.plugins.ml2.drivers.openvswitch.agent.common import constants
from neutron.plugins.ml2.drivers.openvswitch.agent \
import ovs_neutron_agent as ovsagt
from neutron.tests.common import base as common_base
from neutron.tests.common import helpers
from neutron.tests.common import net_helpers
from neutron.tests.functional.agent import test_ovs_lib
from neutron.tests.functional import base
@ -387,6 +388,7 @@ class OVSFlowTestCase(OVSAgentTestBase):
self.assertIn(("dl_src=%(gateway_mac)s" % kwargs),
trace["Final flow"])
@helpers.skip_if_ovs_older_than("2.5.1")
def test_install_flood_to_tun(self):
attrs = {
'remote_ip': '192.0.2.1', # RFC 5737 TEST-NET-1