Allow neutron-sanity-check to check OVS patch port support

This patch allows to check OVS patch port support using:

  neutron-sanity-check --ovs_patch

or pass in the deployed configuration files with a non-empty
AGENT/tunnel_types (indeed patch ports are used to interconnect
br-int and br-tun):

  neutron-sanity-check --config-file ml2.conf.ini

Related-Bug: #1285335
Change-Id: Ic7bfabd1f4b85bfa490dd06c70eb5682ee42a681
Cedric Brandily 9 years ago
parent ab4dc5261e
commit dc9704255d

@ -26,3 +26,13 @@ def vxlan_supported(root_helper, from_ip='', to_ip=''):
with ovs_lib.OVSBridge(name, root_helper) as br:
port = br.add_tunnel_port(from_ip, to_ip, const.TYPE_VXLAN)
return port != ovs_const.INVALID_OFPORT
def patch_supported(root_helper):
seed = utils.get_random_string(6)
name = "patchtest-" + seed
peer_name = "peertest0-" + seed
patch_name = "peertest1-" + seed
with ovs_lib.OVSBridge(name, root_helper) as br:
port = br.add_patch_port(patch_name, peer_name)
return port != ovs_const.INVALID_OFPORT

@ -42,10 +42,22 @@ def check_ovs_vxlan():
return result
def check_ovs_patch():
result = checks.patch_supported(root_helper=cfg.CONF.AGENT.root_helper)
if not result:
LOG.error(_('Check for Open vSwitch patch port support failed. '
'Please ensure that the version of openvswitch '
'being used has patch port support or disable features '
'requiring patch ports (gre/vxlan, etc.).'))
return result
# Define CLI opts to test specific features, with a calback for the test
OPTS = [
BoolOptCallback('ovs_vxlan', check_ovs_vxlan, default=False,
help=_('Check for vxlan support')),
BoolOptCallback('ovs_patch', check_ovs_patch, default=False,
help=_('Check for patch port support')),
@ -57,6 +69,8 @@ def enable_tests_from_config():
if 'vxlan' in cfg.CONF.AGENT.tunnel_types:
cfg.CONF.set_override('ovs_vxlan', True)
if cfg.CONF.AGENT.tunnel_types:
cfg.CONF.set_override('ovs_patch', True)
def all_tests_passed():

@ -37,3 +37,10 @@ class OVSSanityTestCase(base.BaseTestCase):
def test_ovs_patch_support_runs(self):
"""This test just ensures that the test in neutron-sanity-check
can run through without error, without mocking anything out