Merge "Fixes port update failure when device ID is not updated"

This commit is contained in:
Jenkins 2014-07-16 21:42:30 +00:00 committed by Gerrit Code Review
commit 5654621326
2 changed files with 9 additions and 0 deletions

View File

@ -1294,6 +1294,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
p = port['port']
changed_ips = False
changed_device_id = False
with context.session.begin(subtransactions=True):
port = self._get_port(context, id)
if 'device_owner' in p:

View File

@ -1101,6 +1101,14 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
neutron_context=neutron_context)
self.assertEqual(port['port']['admin_state_up'], False)
def test_update_device_id_unchanged(self):
with self.port() as port:
data = {'port': {'admin_state_up': True,
'device_id': port['port']['device_id']}}
req = self.new_update_request('ports', data, port['port']['id'])
res = self.deserialize(self.fmt, req.get_response(self.api))
self.assertEqual(res['port']['admin_state_up'], True)
def test_update_device_id_null(self):
with self.port() as port:
data = {'port': {'device_id': None}}