Merge "Allow neutron-sanity-check to check OVS patch port support"
This commit is contained in:
commit
30e140fb69
@ -26,3 +26,13 @@ def vxlan_supported(root_helper, from_ip='192.0.2.1', to_ip='192.0.2.2'):
|
|||||||
with ovs_lib.OVSBridge(name, root_helper) as br:
|
with ovs_lib.OVSBridge(name, root_helper) as br:
|
||||||
port = br.add_tunnel_port(from_ip, to_ip, const.TYPE_VXLAN)
|
port = br.add_tunnel_port(from_ip, to_ip, const.TYPE_VXLAN)
|
||||||
return port != ovs_const.INVALID_OFPORT
|
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
|
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
|
# Define CLI opts to test specific features, with a calback for the test
|
||||||
OPTS = [
|
OPTS = [
|
||||||
BoolOptCallback('ovs_vxlan', check_ovs_vxlan, default=False,
|
BoolOptCallback('ovs_vxlan', check_ovs_vxlan, default=False,
|
||||||
help=_('Check for vxlan support')),
|
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:
|
if 'vxlan' in cfg.CONF.AGENT.tunnel_types:
|
||||||
cfg.CONF.set_override('ovs_vxlan', True)
|
cfg.CONF.set_override('ovs_vxlan', True)
|
||||||
|
if cfg.CONF.AGENT.tunnel_types:
|
||||||
|
cfg.CONF.set_override('ovs_patch', True)
|
||||||
|
|
||||||
|
|
||||||
def all_tests_passed():
|
def all_tests_passed():
|
||||||
|
@ -37,3 +37,10 @@ class OVSSanityTestCase(base.BaseTestCase):
|
|||||||
"""
|
"""
|
||||||
self.check_sudo_enabled()
|
self.check_sudo_enabled()
|
||||||
checks.vxlan_supported(self.root_helper)
|
checks.vxlan_supported(self.root_helper)
|
||||||
|
|
||||||
|
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
|
||||||
|
"""
|
||||||
|
self.check_sudo_enabled()
|
||||||
|
checks.patch_supported(self.root_helper)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user