#NEWLINE# def _select_ra_ips_for_network_ids( self , context , network_ids ) : #NEWLINE# #INDENT# "Select IP addresses to allow sending router advertisement from.\n\n        If the OpenStack managed radvd process sends an RA, get link local\n        address of gateway and allow RA from this Link Local address.\n        The gateway port link local address will only be obtained\n        when router is created before VM instance is booted and\n        subnet is attached to router.\n\n        If OpenStack doesn't send RA, allow RA from gateway IP.\n        Currently, the gateway IP needs to be link local to be able\n        to send RA to VM.\n        " #NEWLINE# if ( not network_ids ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# ips = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for network_id in network_ids : #NEWLINE# #INDENT# ips [ network_id ] = set ( [ ] ) #NEWLINE# #UNINDENT# query = context . session . query ( models_v2 . Subnet ) #NEWLINE# subnets = query . filter ( models_v2 . Subnet . network_id . in_ ( network_ids ) ) #NEWLINE# for subnet in subnets : #NEWLINE# #INDENT# gateway_ip = subnet [ 'gateway_ip' ] #NEWLINE# if ( ( subnet [ 'ip_version' ] != 6 ) or ( not gateway_ip ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( not netaddr . IPAddress ( gateway_ip ) . is_link_local ( ) ) : #NEWLINE# #INDENT# if subnet [ 'ipv6_ra_mode' ] : #NEWLINE# #INDENT# gateway_ip = self . _get_lla_gateway_ip_for_subnet ( context , subnet ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# if gateway_ip : #NEWLINE# #INDENT# ips [ subnet [ 'network_id' ] ] . add ( gateway_ip ) #NEWLINE# #UNINDENT# #UNINDENT# return ips