original_port = self._make_port_dict(port_db)
updated_port = super(Ml2Plugin, self).update_port(context, id,
port)
- if self.is_address_pairs_attribute_updated(original_port, port):
- self._delete_allowed_address_pairs(context, id)
- self._process_create_allowed_address_pairs(
- context, updated_port,
- port['port'][addr_pair.ADDRESS_PAIRS])
- need_port_update_notify = True
+ if addr_pair.ADDRESS_PAIRS in port['port']:
+ need_port_update_notify |= (
+ self.update_address_pairs_on_port(context, id, port,
+ original_port,
+ updated_port))
elif changed_fixed_ips:
self._check_fixed_ips_and_address_pairs_no_overlap(
context, updated_port)
new_port = super(NECPluginV2, self).update_port(context, id, port)
portinfo_changed = self._process_portbindings_update(
context, port['port'], new_port)
- if self.is_address_pairs_attribute_updated(old_port, port):
- self._delete_allowed_address_pairs(context, id)
- self._process_create_allowed_address_pairs(
- context, new_port,
- port['port'][addr_pair.ADDRESS_PAIRS])
- need_port_update_notify = True
+ if addr_pair.ADDRESS_PAIRS in port['port']:
+ need_port_update_notify |= (
+ self.update_address_pairs_on_port(context, id, port,
+ old_port,
+ new_port))
elif changed_fixed_ips:
self._check_fixed_ips_and_address_pairs_no_overlap(
context, new_port)
from neutron.plugins.ml2 import plugin as ml2_plugin
from neutron.tests.unit import _test_extension_portbindings as test_bindings
from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import test_extension_allowedaddresspairs as test_pair
from neutron.tests.unit import test_extension_extradhcpopts as test_dhcpopts
from neutron.tests.unit import test_security_groups_rpc as test_sg_rpc
self.assertIsNone(network[pnet.SEGMENTATION_ID])
+class TestMl2AllowedAddressPairs(Ml2PluginV2TestCase,
+ test_pair.TestAllowedAddressPairs):
+ def setUp(self, plugin=None):
+ super(test_pair.TestAllowedAddressPairs, self).setUp(
+ plugin=PLUGIN_NAME)
+
+
class DHCPOptsTestCase(test_dhcpopts.TestExtraDhcpOpt):
def setUp(self, plugin=None):
from neutron.plugins.nec import nec_plugin
from neutron.tests.unit.nec import fake_ofc_manager
from neutron.tests.unit import test_db_plugin as test_plugin
+from neutron.tests.unit import test_extension_allowedaddresspairs as test_pair
PLUGIN_NAME = 'neutron.plugins.nec.nec_plugin.NECPluginV2'
def test_delete_port_for_noofcmap_ofc_port(self):
self._test_delete_port_for_disappeared_ofc_port(
nexc.OFCMappingNotFound(resource='port', neutron_id='port1'))
+
+
+class TestNecAllowedAddressPairs(NecPluginV2TestCase,
+ test_pair.TestAllowedAddressPairs):
+ pass