Merge "ML2: Call _dict_extend in create_(net|port) ops"

This commit is contained in:
Jenkins 2016-02-09 03:43:53 +00:00 committed by Gerrit Code Review
commit 62c0c0771f
3 changed files with 14 additions and 1 deletions
neutron
plugins/ml2
tests/unit

@ -675,6 +675,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
result['id'], {'network': {'vlan_transparent': vlt}})
result['vlan_transparent'] = vlt
# NOTE(kevinbenton): this extra lookup is necessary to get the
# latest db model for the extension functions
net_model = self._get_network(context, result['id'])
self._apply_dict_extend_functions('networks', result, net_model)
return result, mech_context
def create_network(self, context, network):
@ -1067,6 +1071,10 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
dhcp_opts)
self.mechanism_manager.create_port_precommit(mech_context)
# NOTE(kevinbenton): this extra lookup is necessary to get the
# latest db model for the extension functions
port_model = self._get_port(context, result['id'])
self._apply_dict_extend_functions('ports', result, port_model)
return result, mech_context
def create_port(self, context, port):

@ -98,6 +98,11 @@ class TestAZNetworkCase(AZTestCommon):
ext_mgr = AZExtensionManager()
super(TestAZNetworkCase, self).setUp(plugin=plugin, ext_mgr=ext_mgr)
def test_availability_zones_in_create_response(self):
with self.network() as net:
self.assertIn('availability_zone_hints', net['network'])
self.assertIn('availability_zones', net['network'])
def test_create_network_with_az(self):
self._register_azs()
az_hints = ['nova1']

@ -81,7 +81,7 @@ class ExtensionDriverTestCase(test_plugin.Ml2PluginV2TestCase):
def test_faulty_extend_dict(self):
with mock.patch.object(ext_test.TestExtensionDriver,
'extend_network_dict',
side_effect=[None, TypeError]):
side_effect=[None, None, TypeError]):
network, tid = self._verify_network_create(201, None)
self._verify_network_update(network, 400, 'ExtensionDriverError')