Fix passing error physical network for get_mtu

The network's physical network should be used to get the network's mtu.

Change-Id: Ib68cf7a64332c6a4b3df7b5d0a41922421b58dba
Closes-bug: #1617284
This commit is contained in:
Hong Hui Xiao 2016-08-26 08:20:58 -04:00
parent 665fd24623
commit 0d96b9b43c
2 changed files with 14 additions and 1 deletions

View File

@ -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.

View File

@ -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()