diff --git a/neutron/plugins/ml2/plugin.py b/neutron/plugins/ml2/plugin.py index 81bfb7117db..1c7a32ea32d 100644 --- a/neutron/plugins/ml2/plugin.py +++ b/neutron/plugins/ml2/plugin.py @@ -713,7 +713,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2, } ) else: - mtu = type_driver.get_mtu(provider.PHYSICAL_NETWORK) + mtu = type_driver.get_mtu(s[provider.PHYSICAL_NETWORK]) # Some drivers, like 'local', may return None; the assumption # then is that for the segment type, MTU has no meaning or # unlimited, and so we should then ignore those values. diff --git a/neutron/tests/unit/plugins/ml2/test_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py index c4c60554a92..52166740365 100644 --- a/neutron/tests/unit/plugins/ml2/test_plugin.py +++ b/neutron/tests/unit/plugins/ml2/test_plugin.py @@ -1161,6 +1161,19 @@ class TestMl2PluginOnly(Ml2PluginV2TestCase): class Test_GetNetworkMtu(Ml2PluginV2TestCase): + def test_get_mtu_with_physical_net(self): + plugin = manager.NeutronManager.get_plugin() + mock_type_driver = mock.MagicMock() + plugin.type_manager.drivers['driver1'] = mock.Mock() + plugin.type_manager.drivers['driver1'].obj = mock_type_driver + net = { + 'name': 'net1', + pnet.NETWORK_TYPE: 'driver1', + pnet.PHYSICAL_NETWORK: 'physnet1', + } + plugin._get_network_mtu(net) + mock_type_driver.get_mtu.assert_called_once_with('physnet1') + def _register_type_driver_with_mtu(self, driver, mtu): plugin = manager.NeutronManager.get_plugin()