Merge "Fix allowed address pair row unique ID" into stable/2024.1
This commit is contained in:
commit
5dfb79b95f
@ -213,7 +213,8 @@ class PortAllowedAddressPair(NeutronAPIDictWrapper):
|
||||
def __init__(self, addr_pair):
|
||||
super().__init__(addr_pair)
|
||||
# Horizon references id property for table operations
|
||||
self.id = addr_pair['ip_address']
|
||||
mac_addr = addr_pair['mac_address'].replace(':', '-')
|
||||
self.id = addr_pair['ip_address'] + ":" + mac_addr
|
||||
|
||||
|
||||
class Router(NeutronAPIDictWrapper):
|
||||
|
@ -81,13 +81,13 @@ class DeleteAllowedAddressPair(tables.DeleteAction):
|
||||
|
||||
return policy_target
|
||||
|
||||
def delete(self, request, ip_address):
|
||||
def delete(self, request, obj_id):
|
||||
try:
|
||||
port_id = self.table.kwargs['port_id']
|
||||
port = api.neutron.port_get(request, port_id)
|
||||
pairs = port.get('allowed_address_pairs', [])
|
||||
pairs = [pair for pair in pairs
|
||||
if pair['ip_address'] != ip_address]
|
||||
if pair.id != obj_id]
|
||||
pairs = [pair.to_dict() for pair in pairs]
|
||||
api.neutron.port_update(request, port_id,
|
||||
allowed_address_pairs=pairs)
|
||||
|
@ -486,8 +486,8 @@ class NetworkPortTests(test.TestCase):
|
||||
self._stub_is_extension_supported({'mac-learning': False,
|
||||
'allowed-address-pairs': True})
|
||||
|
||||
pair_ip = pair['ip_address']
|
||||
form_data = {'action': 'allowed_address_pairs__delete__%s' % pair_ip}
|
||||
id = pair['ip_address'] + ":" + pair['mac_address'].replace(':', '-')
|
||||
form_data = {'action': 'allowed_address_pairs__delete__%s' % id}
|
||||
url = reverse(detail_path, args=[pre_port.id])
|
||||
|
||||
res = self.client.post(url, form_data)
|
||||
|
Loading…
Reference in New Issue
Block a user