Merge "fix update port bug" into stable/rocky

This commit is contained in:
Zuul 2019-08-13 14:26:04 +00:00 committed by Gerrit Code Review
commit 1d053a63ba
2 changed files with 9 additions and 1 deletions

View File

@ -413,7 +413,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
binding.host = host binding.host = host
changes = True changes = True
vnic_type = attrs and attrs.get(portbindings.VNIC_TYPE) vnic_type = attrs.get(portbindings.VNIC_TYPE) if attrs else None
if (validators.is_attr_set(vnic_type) and if (validators.is_attr_set(vnic_type) and
binding.vnic_type != vnic_type): binding.vnic_type != vnic_type):
binding.vnic_type = vnic_type binding.vnic_type = vnic_type

View File

@ -965,6 +965,14 @@ class TestMl2PortsV2(test_plugin.TestPortsV2, Ml2PluginV2TestCase):
plugin.update_port_status(ctx, short_id, 'UP') plugin.update_port_status(ctx, short_id, 'UP')
mock_gbl.assert_called_once_with(mock.ANY, port_id, mock.ANY) mock_gbl.assert_called_once_with(mock.ANY, port_id, mock.ANY)
def test_update_port_with_empty_data(self):
ctx = context.get_admin_context()
plugin = directory.get_plugin()
with self.port() as port:
port_id = port['port']['id']
new_port = plugin.update_port(ctx, port_id, {"port": {}})
self.assertEqual(port["port"], new_port)
def _add_fake_dhcp_agent(self): def _add_fake_dhcp_agent(self):
agent = mock.Mock() agent = mock.Mock()
plugin = directory.get_plugin() plugin = directory.get_plugin()