Merge "Fix ml2 & nec plugins for allowedaddresspairs tests"

This commit is contained in:
Jenkins 2014-03-15 00:47:15 +00:00 committed by Gerrit Code Review
commit e9f161ce94
4 changed files with 24 additions and 12 deletions

View File

@ -654,12 +654,11 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
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)

View File

@ -597,12 +597,11 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
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)

View File

@ -28,6 +28,7 @@ from neutron.plugins.ml2 import config
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
@ -315,6 +316,13 @@ class TestMultiSegmentNetworks(Ml2PluginV2TestCase):
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):

View File

@ -31,6 +31,7 @@ from neutron.plugins.nec.db import api as ndb
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'
@ -890,3 +891,8 @@ class TestNecPluginOfcManager(NecPluginV2TestCase):
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