Add provider info to network for update

Ml2 Plugin is not sending provider info
while update_network to mechanism update_precommit,
due to which network becomes un-usable, This patch
extends the updated_network to include provider info.

Change-Id: I1838ce375b80f26ad37ede4bf438317f3bbd439f
Closes-Bug: #1698804
This commit is contained in:
Manjeet Singh Bhatia 2017-06-20 18:10:37 +00:00
parent c4fd0317a3
commit be8e9fc425
2 changed files with 12 additions and 2 deletions

View File

@ -840,8 +840,6 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
self.extension_manager.process_update_network(context, net_data,
updated_network)
self._process_l3_update(context, updated_network, net_data)
self.type_manager.extend_network_dict_provider(context,
updated_network)
# ToDO(QoS): This would change once EngineFacade moves out
db_network = self._get_network(context, id)
@ -850,6 +848,8 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
context.session.expire(db_network)
updated_network = self._make_network_dict(
db_network, context=context)
self.type_manager.extend_network_dict_provider(
context, updated_network)
kwargs = {'context': context, 'network': updated_network,
'original_network': original_network,

View File

@ -2613,6 +2613,16 @@ class TestML2Segments(Ml2PluginV2TestCase):
mech_context = all_args[0][0][0]
self.assertEqual(1100, mech_context.__dict__['_network']['mtu'])
def test_provider_info_update_network(self):
with self.network() as network:
network_id = network['network']['id']
plugin = directory.get_plugin()
updated_network = plugin.update_network(
self.context, network_id, {'network': {'name': 'test-net'}})
self.assertIn('provider:network_type', updated_network)
self.assertIn('provider:physical_network', updated_network)
self.assertIn('provider:segmentation_id', updated_network)
def test_reserve_segment_update_network_mtu(self):
with self.network() as network:
network_id = network['network']['id']