Allowed address pair: Removing check for overlap with fixed ips
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
This commit is contained in:
parent
8e321dcd3b
commit
8c432a14a9
@ -48,11 +48,6 @@ class AllowedAddressPairsMixin(object):
|
|||||||
# use port.mac_address if no mac address in address pair
|
# use port.mac_address if no mac address in address pair
|
||||||
if 'mac_address' not in address_pair:
|
if 'mac_address' not in address_pair:
|
||||||
address_pair['mac_address'] = port['mac_address']
|
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(
|
db_pair = AllowedAddressPair(
|
||||||
port_id=port['id'],
|
port_id=port['id'],
|
||||||
mac_address=address_pair['mac_address'],
|
mac_address=address_pair['mac_address'],
|
||||||
|
@ -32,10 +32,6 @@ class DuplicateAddressPairInRequest(nexception.InvalidInput):
|
|||||||
"mac_address %(mac_address)s ip_address %(ip_address)s.")
|
"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):
|
def _validate_allowed_address_pairs(address_pairs, valid_values=None):
|
||||||
unique_check = {}
|
unique_check = {}
|
||||||
for address_pair in address_pairs:
|
for address_pair in address_pairs:
|
||||||
|
@ -159,6 +159,22 @@ class TestAllowedAddressPairs(AllowedAddressPairDBTestCase):
|
|||||||
'ip_address': '10.0.0.1'}]
|
'ip_address': '10.0.0.1'}]
|
||||||
self._create_port_with_address_pairs(address_pairs, 400)
|
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):
|
def test_create_port_extra_args(self):
|
||||||
address_pairs = [{'mac_address': '00:00:00:00:00:01',
|
address_pairs = [{'mac_address': '00:00:00:00:00:01',
|
||||||
'ip_address': '10.0.0.1',
|
'ip_address': '10.0.0.1',
|
||||||
|
Loading…
Reference in New Issue
Block a user