#NEWLINE# def _iter_hosts( self ) : #NEWLINE# #INDENT# "Iterate over hosts.\n\n        For each host on the network we yield a tuple containing:\n        (\n            port,  # a DictModel instance representing the port.\n            alloc,  # a DictModel instance of the allocated ip and subnet.\n                    # if alloc is None, it means there is no need to allocate\n                    # an IPv6 address because of stateless DHCPv6 network.\n            host_name,  # Host name.\n            name,  # Canonical hostname in the format 'hostname[.domain]'.\n            no_dhcp,  # A flag indicating that the address doesn't need a DHCP\n                      # IP address.\n            no_opts,  # A flag indication that options shouldn't be written\n        )\n        " #NEWLINE# v6_nets = dict ( ( ( subnet . id , subnet ) for subnet in self . network . subnets if ( subnet . ip_version == 6 ) ) ) #NEWLINE# for port in self . network . ports : #NEWLINE# #INDENT# fixed_ips = self . _sort_fixed_ips_for_dnsmasq ( port . fixed_ips , v6_nets ) #NEWLINE# dns_assignment = getattr ( port , 'dns_assignment' , None ) #NEWLINE# if dns_assignment : #NEWLINE# #INDENT# dns_ip_map = { d . ip_address : d for d in dns_assignment } #NEWLINE# #UNINDENT# for alloc in fixed_ips : #NEWLINE# #INDENT# no_dhcp = False #NEWLINE# no_opts = False #NEWLINE# if ( alloc . subnet_id in v6_nets ) : #NEWLINE# #INDENT# addr_mode = v6_nets [ alloc . subnet_id ] . ipv6_address_mode #NEWLINE# no_dhcp = ( addr_mode in ( n_const . IPV6_SLAAC , n_const . DHCPV6_STATELESS ) ) #NEWLINE# no_opts = ( addr_mode == n_const . IPV6_SLAAC ) #NEWLINE# #UNINDENT# if dns_assignment : #NEWLINE# #INDENT# hostname = dns_ip_map [ alloc . ip_address ] . hostname #NEWLINE# fqdn = dns_ip_map [ alloc . ip_address ] . fqdn #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# hostname = ( 'host-%s' % alloc . ip_address . replace ( '.' , '-' ) . replace ( ':' , '-' ) ) #NEWLINE# fqdn = hostname #NEWLINE# if self . conf . dhcp_domain : #NEWLINE# #INDENT# fqdn = ( '%s.%s' % ( fqdn , self . conf . dhcp_domain ) ) #NEWLINE# #UNINDENT# #UNINDENT# ( yield ( port , alloc , hostname , fqdn , no_dhcp , no_opts ) )