From 823ac73badb062641e16cdabfeb4ae0d55651b82 Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Tue, 18 Jun 2019 10:45:03 +0200 Subject: [PATCH] Restore execution of FloatingIpWithMtuWritableTest Test floating IP with a network with a custom MTU size. Change-Id: I47ff6e0dc5eee366951ac46b52c471bbbb58a555 --- tobiko/openstack/neutron/config.py | 12 +++++++- tobiko/openstack/stacks/_neutron.py | 28 +++++++++++-------- .../scenario/neutron/test_floating_ip.py | 26 ++++++----------- 3 files changed, 36 insertions(+), 30 deletions(-) diff --git a/tobiko/openstack/neutron/config.py b/tobiko/openstack/neutron/config.py index 8ef25a6db..8fb9b0ce9 100644 --- a/tobiko/openstack/neutron/config.py +++ b/tobiko/openstack/neutron/config.py @@ -32,4 +32,14 @@ def register_tobiko_options(conf): help="The CIDR block to allocate IPv6 subnets from"), cfg.IntOpt('ipv6_prefixlen', default=64, - help="The mask bits for IPv6 subnets")]) + help="The mask bits for IPv6 subnets"), + cfg.IntOpt('custom_mtu_size', + default=1400, + help=("Customized maximum transfer unit size\n" + "Notes:\n" + " - MTU values as small as 1000 has been seen " + "breaking networking binding due to an " + "unknown cause.\n" + " - Too big MTU values (like greater than 1400)" + " may be refused during network creation")), + ]) diff --git a/tobiko/openstack/stacks/_neutron.py b/tobiko/openstack/stacks/_neutron.py index 209b7cccd..90c63e017 100644 --- a/tobiko/openstack/stacks/_neutron.py +++ b/tobiko/openstack/stacks/_neutron.py @@ -16,6 +16,7 @@ from __future__ import absolute_import import netaddr +from oslo_log import log import tobiko from tobiko import config @@ -28,6 +29,7 @@ from tobiko.shell import ssh CONF = config.CONF +LOG = log.getLogger(__name__) @neutron.skip_if_missing_networking_extensions('port-security') @@ -68,16 +70,20 @@ class NetworkStackFixture(heat.HeatStackFixture): def value_specs(self): return {} - #: Floating IP network where the Neutron floating IPs are created - gateway_network = CONF.tobiko.neutron.floating_network + @property + def gateway_network(self): + """Floating IP network where the Neutron floating IPs are created""" + return CONF.tobiko.neutron.floating_network @property def has_gateway(self): """Whenever to setup gateway router""" return bool(self.gateway_network) - # Whenever cat obtain network MTU value - has_net_mtu = neutron.has_networking_extensions('net-mtu') + @property + def has_net_mtu(self): + """Whenever can obtain network MTU value""" + return neutron.has_networking_extensions('net-mtu') @property def network_details(self): @@ -129,17 +135,15 @@ class NetworkStackFixture(heat.HeatStackFixture): @neutron.skip_if_missing_networking_extensions('net-mtu-writable') class NetworkWithNetMtuWriteStackFixture(NetworkStackFixture): - # Whenever cat obtain network MTU value - has_net_mtu = True - - #: Value for maximum transfer unit on the internal network - mtu = 1000 + @property + def custom_mtu_size(self): + return CONF.tobiko.neutron.custom_mtu_size @property def value_specs(self): - return dict( - super(NetworkWithNetMtuWriteStackFixture, self).value_specs, - mtu=int(self.mtu)) + value_specs = super( + NetworkWithNetMtuWriteStackFixture, self).value_specs + return dict(value_specs, mtu=self.custom_mtu_size) @neutron.skip_if_missing_networking_extensions('security-group') diff --git a/tobiko/tests/scenario/neutron/test_floating_ip.py b/tobiko/tests/scenario/neutron/test_floating_ip.py index ec9373350..22b2649d8 100644 --- a/tobiko/tests/scenario/neutron/test_floating_ip.py +++ b/tobiko/tests/scenario/neutron/test_floating_ip.py @@ -108,18 +108,6 @@ class FloatingIPTest(base.TobikoTest): count=5, check=False).assert_not_replied() - @neutron.skip_if_missing_networking_extensions('net-mtu-writable') - def test_mtu_net_attribute(self): - """Test 'mtu' network attribute""" - if self.expected_net_mtu: - self.assertEqual(self.expected_net_mtu, - self.observed_net_mtu) - - @property - def expected_net_mtu(self): - """Expected MTU value for internal network""" - return self.stack.network_stack.mtu - @property def observed_net_mtu(self): """Actual MTU value for internal network""" @@ -220,13 +208,17 @@ class FloatingIPWithNetMtuWritableFixture(stacks.FloatingIpServerStackFixture): @neutron.skip_if_missing_networking_extensions('net-mtu-writable') -class FlatingIpWithMtuWritableTest(FloatingIPTest): +class FloatingIpWithMtuWritableTest(FloatingIPTest): """Tests connectivity via floating IP with a custom MTU value""" #: Resources stack with floating IP and Nova server stack = tobiko.required_setup_fixture(FloatingIPWithNetMtuWritableFixture) - @classmethod - def setUpClass(cls): - super(FlatingIpWithMtuWritableTest, cls).setUpClass() - tobiko.skip('Disable this test to see if it fixes the problem') + def test_net_mtu_write(self): + """Test 'mtu' network attribute""" + self.assertEqual(self.expected_net_mtu, self.observed_net_mtu) + + @property + def expected_net_mtu(self): + """Expected MTU value for internal network""" + return self.stack.network_stack.custom_mtu_size