]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Allowed address pair: Removing check for overlap with fixed ips
authorLiping Mao <limao@cisco.com>
Wed, 4 Jun 2014 07:41:44 +0000 (15:41 +0800)
committerLiping Mao <limao@cisco.com>
Thu, 12 Jun 2014 01:43:09 +0000 (09:43 +0800)
Some of the overlap check has been removed in the following patch:
https://review.openstack.org/#/c/94508/
But the patch did not remove all the overlap check. I remove the
rest part.

Change-Id: I575ec54c0b3d6dc31ef80819d4258c6d162b4cfd
Closes-Bug: #1326007

neutron/db/allowedaddresspairs_db.py
neutron/extensions/allowedaddresspairs.py
neutron/tests/unit/test_extension_allowedaddresspairs.py

index 7fdde0e529311dc5d4ec822e1075073f801caa99..b648c8c479e9a71a87ee29fe6f1bbb0542f1bc05 100644 (file)
@@ -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'],
index 96512f327a69e408ccbbc460cf9562eb6b0961d7..a9328aaa48cfa8d151edb0977dd4915ad8441264 100644 (file)
@@ -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:
index 850ebc43a5256edb88f8df4f065bafe829391825..28dcd91b1653d3670cfc586ceec66479df1b12e8 100644 (file)
@@ -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',