Merge "Add sanity check for OVSDB native support"
This commit is contained in:
@@ -17,6 +17,7 @@ import re
|
||||
|
||||
import netaddr
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from neutron.agent.linux import ip_lib
|
||||
from neutron.agent.linux import ip_link_support
|
||||
@@ -152,3 +153,19 @@ def dnsmasq_version_supported():
|
||||
"Exception: %s", e)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def ovsdb_native_supported():
|
||||
# Running the test should ensure we are configured for OVSDB native
|
||||
try:
|
||||
ovs = ovs_lib.BaseOVS()
|
||||
ovs.get_bridges()
|
||||
return True
|
||||
except ImportError as ex:
|
||||
LOG.error(_LE("Failed to import required modules. Ensure that the "
|
||||
"python-openvswitch package is installed. Error: %s"),
|
||||
ex.message)
|
||||
except Exception as ex:
|
||||
LOG.exception(six.text_type(ex))
|
||||
|
||||
return False
|
||||
|
||||
@@ -129,6 +129,14 @@ def check_vf_management():
|
||||
return result
|
||||
|
||||
|
||||
def check_ovsdb_native():
|
||||
cfg.CONF.set_override('ovsdb_interface', 'native', group='OVS')
|
||||
result = checks.ovsdb_native_supported()
|
||||
if not result:
|
||||
LOG.error(_LE('Check for native OVSDB support failed.'))
|
||||
return result
|
||||
|
||||
|
||||
# Define CLI opts to test specific features, with a calback for the test
|
||||
OPTS = [
|
||||
BoolOptCallback('ovs_vxlan', check_ovs_vxlan, default=False,
|
||||
@@ -147,6 +155,8 @@ OPTS = [
|
||||
help=_('Check netns permission settings')),
|
||||
BoolOptCallback('dnsmasq_version', check_dnsmasq_version,
|
||||
help=_('Check minimal dnsmasq version')),
|
||||
BoolOptCallback('ovsdb_native', check_ovsdb_native,
|
||||
help=_('Check ovsdb native interface support')),
|
||||
]
|
||||
|
||||
|
||||
@@ -176,6 +186,8 @@ def enable_tests_from_config():
|
||||
cfg.CONF.set_override('read_netns', True)
|
||||
if cfg.CONF.dhcp_driver == 'neutron.agent.linux.dhcp.Dnsmasq':
|
||||
cfg.CONF.set_override('dnsmasq_version', True)
|
||||
if cfg.CONF.OVS.ovsdb_interface == 'native':
|
||||
cfg.CONF.set_override('ovsdb_native', True)
|
||||
|
||||
|
||||
def all_tests_passed():
|
||||
|
||||
@@ -61,3 +61,6 @@ class SanityTestCaseRoot(functional_base.BaseSudoTestCase):
|
||||
|
||||
def test_namespace_root_read_detection_runs(self):
|
||||
checks.netns_read_requires_helper()
|
||||
|
||||
def test_ovsdb_native_supported_runs(self):
|
||||
checks.ovsdb_native_supported()
|
||||
|
||||
Reference in New Issue
Block a user