Add DHCP agent MAC address to gbp_details
The MAC address and IP list of the ports belonging to the DHCP agent responsible for a given port are added to the get_gbp_details RPC. This allows the agent to support proxying ARPs for the DHCP agent's IP, using the appropriate MAC. Change-Id: Ia125dbc3207731a753d4fa1cafa50d4a4a928b89
This commit is contained in:
parent
4eb848fb89
commit
c6e97a945e
|
@ -1959,18 +1959,21 @@ class AIMMappingDriver(nrd.CommonNeutronBase, aim_rpc.AIMMappingRPCMixin):
|
|||
plugin_context,
|
||||
filters={'id': [ip['subnet_id'] for ip in port['fixed_ips']]})
|
||||
for subnet in subnets:
|
||||
dhcp_ips = set()
|
||||
for port in self._get_ports(
|
||||
dhcp_ports = {}
|
||||
subnet_dhcp_ips = set()
|
||||
for dhcp_port in self._get_ports(
|
||||
plugin_context,
|
||||
filters={
|
||||
'network_id': [subnet['network_id']],
|
||||
'device_owner': [n_constants.DEVICE_OWNER_DHCP]}):
|
||||
dhcp_ips |= set([x['ip_address'] for x in port['fixed_ips']
|
||||
if x['subnet_id'] == subnet['id']])
|
||||
dhcp_ips = list(dhcp_ips)
|
||||
dhcp_ips = set([x['ip_address'] for x in dhcp_port['fixed_ips']
|
||||
if x['subnet_id'] == subnet['id']])
|
||||
dhcp_ports.setdefault(dhcp_port['mac_address'], list(dhcp_ips))
|
||||
subnet_dhcp_ips |= dhcp_ips
|
||||
subnet_dhcp_ips = list(subnet_dhcp_ips)
|
||||
if not subnet['dns_nameservers']:
|
||||
# Use DHCP namespace port IP
|
||||
subnet['dns_nameservers'] = dhcp_ips
|
||||
subnet['dns_nameservers'] = subnet_dhcp_ips
|
||||
# Set Default & Metadata routes if needed
|
||||
default_route = metadata_route = {}
|
||||
if subnet['ip_version'] == 4:
|
||||
|
@ -1996,12 +1999,19 @@ class AIMMappingDriver(nrd.CommonNeutronBase, aim_rpc.AIMMappingRPCMixin):
|
|||
'nexthop': subnet['gateway_ip']})
|
||||
optimized = self._is_metadata_optimized(plugin_context,
|
||||
port)
|
||||
if not metadata_route and dhcp_ips and (not optimized or
|
||||
(optimized and not default_route)):
|
||||
subnet['host_routes'].append(
|
||||
{'destination': dhcp.METADATA_DEFAULT_CIDR,
|
||||
'nexthop': dhcp_ips[0]})
|
||||
subnet['dhcp_server_ips'] = dhcp_ips
|
||||
# REVISIT: We need to decide if we should provide
|
||||
# host-routes for all of the DHCP agents. For now
|
||||
# use the first DHCP agent in our list for the
|
||||
# metadata host-route next-hop IPs
|
||||
if not metadata_route and dhcp_ports and (
|
||||
not optimized or (optimized and not default_route)):
|
||||
for ip in dhcp_ports[dhcp_ports.keys()[0]]:
|
||||
subnet['host_routes'].append(
|
||||
{'destination': dhcp.METADATA_DEFAULT_CIDR,
|
||||
'nexthop': ip})
|
||||
subnet['dhcp_server_ips'] = subnet_dhcp_ips
|
||||
if dhcp_ports:
|
||||
subnet['dhcp_server_ports'] = dhcp_ports
|
||||
return subnets
|
||||
|
||||
def _send_port_update_notification(self, plugin_context, port):
|
||||
|
|
Loading…
Reference in New Issue