#NEWLINE# def _select_dhcp_ips_for_network_ids( self , context , network_ids ) : #NEWLINE# #INDENT# if ( not network_ids ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# query = context . session . query ( models_v2 . Port . mac_address , models_v2 . Port . network_id , models_v2 . IPAllocation . ip_address ) #NEWLINE# query = query . join ( models_v2 . IPAllocation ) #NEWLINE# query = query . filter ( models_v2 . Port . network_id . in_ ( network_ids ) ) #NEWLINE# owner = const . DEVICE_OWNER_DHCP #NEWLINE# query = query . filter ( ( models_v2 . Port . device_owner == owner ) ) #NEWLINE# ips = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for network_id in network_ids : #NEWLINE# #INDENT# ips [ network_id ] = [ ] #NEWLINE# #UNINDENT# for ( mac_address , network_id , ip ) in query : #NEWLINE# #INDENT# if ( ( netaddr . IPAddress ( ip ) . version == 6 ) and ( not netaddr . IPAddress ( ip ) . is_link_local ( ) ) ) : #NEWLINE# #INDENT# ip = str ( ipv6 . get_ipv6_addr_by_EUI64 ( n_const . IPV6_LLA_PREFIX , mac_address ) ) #NEWLINE# #UNINDENT# if ( ip not in ips [ network_id ] ) : #NEWLINE# #INDENT# ips [ network_id ] . append ( ip ) #NEWLINE# #UNINDENT# #UNINDENT# return ips