{%   if not helpers.empty('dhcpd') %}
{%     for interface, dhcpd in dhcpd.items() %}
{%       if dhcpd.enable|default('0') == '1'  %}
{%         if 'range' in dhcpd and dhcpd.domain|default('') != '' %}
[range_{{interface}}]
start={{dhcpd.range.from}}
end={{dhcpd.range.to}}
domain={{dhcpd.domain}}

{%         endif %}
{%         if 'pool' in dhcpd %}
{%           for pool in helpers.toList('dhcpd.'+interface+'.pool') %}
{%             if 'range' in pool and (pool.domain|default('') != '' or dhcpd.domain|default('') != '') %}
[range_{{interface}}_pool_{{loop.index}}]
start={{pool.range.from}}
end={{pool.range.to}}
domain={{pool.domain|default(dhcpd.domain)}}

{%             endif %}
{%           endfor %}
{%         endif %}
{%      endif %}
{%    endfor %}
{%  endif %}
