diff --git a/neutron/db/allowedaddresspairs_db.py b/neutron/db/allowedaddresspairs_db.py index 7fdde0e5293..b648c8c479e 100644 --- a/neutron/db/allowedaddresspairs_db.py +++ b/neutron/db/allowedaddresspairs_db.py @@ -48,11 +48,6 @@ class AllowedAddressPairsMixin(object): # use port.mac_address if no mac address in address pair if 'mac_address' not in address_pair: address_pair['mac_address'] = port['mac_address'] - for fixed_ip in port['fixed_ips']: - if ((fixed_ip['ip_address'] == address_pair['ip_address']) - and (port['mac_address'] == - address_pair['mac_address'])): - raise addr_pair.AddressPairMatchesPortFixedIPAndMac() db_pair = AllowedAddressPair( port_id=port['id'], mac_address=address_pair['mac_address'], diff --git a/neutron/extensions/allowedaddresspairs.py b/neutron/extensions/allowedaddresspairs.py index 96512f327a6..a9328aaa48c 100644 --- a/neutron/extensions/allowedaddresspairs.py +++ b/neutron/extensions/allowedaddresspairs.py @@ -32,10 +32,6 @@ class DuplicateAddressPairInRequest(nexception.InvalidInput): "mac_address %(mac_address)s ip_address %(ip_address)s.") -class AddressPairMatchesPortFixedIPAndMac(nexception.InvalidInput): - message = _("Port's Fixed IP and Mac Address match an address pair entry.") - - def _validate_allowed_address_pairs(address_pairs, valid_values=None): unique_check = {} for address_pair in address_pairs: diff --git a/neutron/tests/unit/test_extension_allowedaddresspairs.py b/neutron/tests/unit/test_extension_allowedaddresspairs.py index 850ebc43a52..28dcd91b165 100644 --- a/neutron/tests/unit/test_extension_allowedaddresspairs.py +++ b/neutron/tests/unit/test_extension_allowedaddresspairs.py @@ -159,6 +159,22 @@ class TestAllowedAddressPairs(AllowedAddressPairDBTestCase): 'ip_address': '10.0.0.1'}] self._create_port_with_address_pairs(address_pairs, 400) + def test_create_overlap_with_fixed_ip(self): + address_pairs = [{'mac_address': '00:00:00:00:00:01', + 'ip_address': '10.0.0.2'}] + with self.network() as network: + with self.subnet(network=network, cidr='10.0.0.0/24') as subnet: + fixed_ips = [{'subnet_id': subnet['subnet']['id'], + 'ip_address': '10.0.0.2'}] + res = self._create_port(self.fmt, network['network']['id'], + arg_list=(addr_pair.ADDRESS_PAIRS, + 'fixed_ips'), + allowed_address_pairs=address_pairs, + fixed_ips=fixed_ips) + self.assertEqual(res.status_int, 201) + port = self.deserialize(self.fmt, res) + self._delete('ports', port['port']['id']) + def test_create_port_extra_args(self): address_pairs = [{'mac_address': '00:00:00:00:00:01', 'ip_address': '10.0.0.1',