Browse Source

Merge "fix update port bug" into stable/rocky

tags/13.0.5
Zuul 11 months ago
committed by Gerrit Code Review
parent
commit
1d053a63ba
2 changed files with 9 additions and 1 deletions
  1. +1
    -1
      neutron/plugins/ml2/plugin.py
  2. +8
    -0
      neutron/tests/unit/plugins/ml2/test_plugin.py

+ 1
- 1
neutron/plugins/ml2/plugin.py View File

@@ -413,7 +413,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
binding.host = host
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
binding.vnic_type != vnic_type):
binding.vnic_type = vnic_type


+ 8
- 0
neutron/tests/unit/plugins/ml2/test_plugin.py View File

@@ -965,6 +965,14 @@ class TestMl2PortsV2(test_plugin.TestPortsV2, Ml2PluginV2TestCase):
plugin.update_port_status(ctx, short_id, 'UP')
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):
agent = mock.Mock()
plugin = directory.get_plugin()


Loading…
Cancel
Save